cellv2_delete_host when host not found by ComputeNodeList

Bug #1781391 reported by Mike Chen
14
This bug affects 3 people
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Medium
Mike Chen
Queens
Fix Committed
Medium
Unassigned

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.

Mike Chen (chenn2)
Changed in nova:
assignee: nobody → Chen (chenn2)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

Fix proposed to branch: master
Review: https://review.openstack.org/582171

Changed in nova:
status: New → In Progress
tags: added: cells
tags: added: nova-manag
tags: added: nova-manage
removed: nova-manag
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

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 address hidden>
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
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/nova 18.0.0.0b3

This issue was fixed in the openstack/nova 18.0.0.0b3 development milestone.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (stable/queens)

Fix proposed to branch: stable/queens
Review: https://review.opendev.org/672690

Matt Riedemann (mriedem)
Changed in nova:
importance: Undecided → Medium
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (stable/queens)

Reviewed: https://review.opendev.org/672690
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=1535f8e215c99b730e63eafb1e2f8db2e526376f
Submitter: Zuul
Branch: stable/queens

commit 1535f8e215c99b730e63eafb1e2f8db2e526376f
Author: Chen <email address hidden>
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
    (cherry picked from commit 0ef4ed96d19a3576d67fdc9c1958610887d57ed4)

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/nova 17.0.12

This issue was fixed in the openstack/nova 17.0.12 release.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.