Reviewed:  https://review.openstack.org/582171
Committed: 
https://git.openstack.org/cgit/openstack/nova/commit/?id=0ef4ed96d19a3576d67fdc9c1958610887d57ed4
Submitter: Zuul
Branch:    master

commit 0ef4ed96d19a3576d67fdc9c1958610887d57ed4
Author: Chen <[email protected]>
Date:   Thu Jul 12 20:33:14 2018 +0800

    fix cellv2 delete_host
    
    When trying to delete host that can be found in host_mappings
    but not in compute_nodes, current cellv2 delete_host will throw
    an exception but does not really handle it.
    
    This patch tries to handle this exception and allow the delete
    operation to continue since it shows the host has gone anyway.
    
    Change-Id: I99bd79fb45777edc0e33d846ba478b0a94a1191e
    Closes-Bug: #1781391


** Changed in: nova
       Status: In Progress => Fix Released

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1781391

Title:
  cellv2_delete_host when host not found by ComputeNodeList

Status in OpenStack Compute (nova):
  Fix Released

Bug description:
  Problematic Situation:

  1 check the hosts visible to nova compute
  nova hypervisor-list
  id   hypervisor hostname  state  status
  xx         compute2         up    enbled
   
  2 check the hosts visible to cellv2
  nova-manage cell_v2 list_hosts
  cell name   cell uuid      hostname
  cell1         xxxx         compute1
  cell1         xxxx         compute2
  Here compute1 that actually does not exist (like renamed) still remains in 
cell_mappings

  3 now try to delete host compute1
  nova-manage cell_v2 delete_host --cell_uuid xxxx --host compute1
  then the following error is shown:
  Traceback (most recent call last):
    File "/usr/lib/python2.7/site-packages/nova/cmd/manage.py", line 1620, in 
main
      ret = fn(*fn_args, **fn_kwargs)
    File "/usr/lib/python2.7/site-packages/nova/cmd/manage.py", line 1558, in 
delete_host
      nodes = objects.ComputeNodeList.get_all_by_host(cctxt, host)
    File "/usr/lib/python2.7/site-packages/oslo_versionedobjects/base.py", line 
184, in wrapper
      result = fn(cls, context, *args, **kwargs)
    File "/usr/lib/python2.7/site-packages/nova/objects/compute_node.py", line 
437, in get_all_by_host
      use_slave=use_slave)
    File "/usr/lib/python2.7/site-packages/nova/db/sqlalchemy/api.py", line 
225, in wrapper
      return f(*args, **kwargs)
    File "/usr/lib/python2.7/site-packages/nova/objects/compute_node.py", line 
432, in _db_compute_node_get_all_by_host
      return db.compute_node_get_all_by_host(context, host)
    File "/usr/lib/python2.7/site-packages/nova/db/api.py", line 297, in 
compute_node_get_all_by_host
      return IMPL.compute_node_get_all_by_host(context, host)
    File "/usr/lib/python2.7/site-packages/nova/db/sqlalchemy/api.py", line 
270, in wrapped
      return f(context, *args, **kwargs)
    File "/usr/lib/python2.7/site-packages/nova/db/sqlalchemy/api.py", line 
672, in compute_node_get_all_by_host
      raise exception.ComputeHostNotFound(host=host)
  ComputeHostNotFound: Compute host compute1 could not be found.

  Not quite sure the exact way to reproduce it, but I think it would be nicer 
to allow the delete_host
  operation for situations like this.

To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1781391/+subscriptions

-- 
Mailing list: https://launchpad.net/~yahoo-eng-team
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~yahoo-eng-team
More help   : https://help.launchpad.net/ListHelp

Reply via email to