Handle HostMappingNotFound when deleting a service

Bug #1780727 reported by Surya Seetharaman
22
This bug affects 3 people
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
High
Matt Riedemann
Ocata
In Progress
High
Matt Riedemann
Pike
Fix Committed
High
Matt Riedemann
Queens
Fix Committed
High
Matt Riedemann

Bug Description

While deleting a service, we also try to delete the HostMapping before it here: https://github.com/openstack/nova/blob/fcf406003bcde2b60a515f694f2640e27a9d65fd/nova/api/openstack/compute/services.py#L243 . However there could be a situation where we do not find the HostMapping (for instance when we run nova-manage cell_v2 delete_host before nova service-delete). This needs to be handled in the try catch block and if we do not find the host_mapping, we just need to proceed to deleting the service as opposed to the current behaviour where it gives a 500.

Tags: api cells
Revision history for this message
Ghanshyam Mann (ghanshyammann) wrote :

yeah, that can be raised from [1]. I feel proceeding further if no host mapping is good way. We can discuss on patch if any side effect of that.

[1] https://github.com/openstack/nova/blob/d3fa585f5e2d11a91ee62744a0cf0c78921a47e4/nova/objects/host_mapping.py#L95

Changed in nova:
status: New → Confirmed
Revision history for this message
Matt Riedemann (mriedem) wrote :

It's valid to have a compute service w/o a host mapping if the nova-compute service was started but discover_hosts was not yet run, we shouldn't block the compute service delete on that, so we should just handle HostMappingNotFound and pass.

Changed in nova:
importance: Undecided → High
assignee: Surya Seetharaman (tssurya) → Matt Riedemann (mriedem)
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/582674

Changed in nova:
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

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

commit ee6e0c1e7eb861e56915c5b6c60a214b75240366
Author: Matt Riedemann <email address hidden>
Date: Fri Jul 13 15:42:03 2018 -0400

    Handle HostMappingNotFound when deleting a compute service

    If the compute service we're deleting has never been
    discovered (mapped to a cell using discover_hosts) or the
    host mapping was already deleted, we need to handle the
    HostMappingNotFound error when deleting a compute service
    so that we (1) don't 500 out of the API and (2) continue to
    delete the compute service.

    Change-Id: I0d7644db3537a67b94e75972b3c4fce25a623763
    Closes-Bug: #1780727

Changed in nova:
status: In Progress → Fix Released
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.openstack.org/583566

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

Fix proposed to branch: stable/pike
Review: https://review.openstack.org/583567

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 merged to nova (stable/queens)

Reviewed: https://review.openstack.org/583566
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=0be8cbc302aa77b312e031f6a7a419e83afd6e3b
Submitter: Zuul
Branch: stable/queens

commit 0be8cbc302aa77b312e031f6a7a419e83afd6e3b
Author: Matt Riedemann <email address hidden>
Date: Fri Jul 13 15:42:03 2018 -0400

    Handle HostMappingNotFound when deleting a compute service

    If the compute service we're deleting has never been
    discovered (mapped to a cell using discover_hosts) or the
    host mapping was already deleted, we need to handle the
    HostMappingNotFound error when deleting a compute service
    so that we (1) don't 500 out of the API and (2) continue to
    delete the compute service.

    Change-Id: I0d7644db3537a67b94e75972b3c4fce25a623763
    Closes-Bug: #1780727
    (cherry picked from commit ee6e0c1e7eb861e56915c5b6c60a214b75240366)

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

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

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

Reviewed: https://review.openstack.org/583567
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=0b45fcd3ba345b3f400ce729992ffdca07548b0b
Submitter: Zuul
Branch: stable/pike

commit 0b45fcd3ba345b3f400ce729992ffdca07548b0b
Author: Matt Riedemann <email address hidden>
Date: Fri Jul 13 15:42:03 2018 -0400

    Handle HostMappingNotFound when deleting a compute service

    If the compute service we're deleting has never been
    discovered (mapped to a cell using discover_hosts) or the
    host mapping was already deleted, we need to handle the
    HostMappingNotFound error when deleting a compute service
    so that we (1) don't 500 out of the API and (2) continue to
    delete the compute service.

    Change-Id: I0d7644db3537a67b94e75972b3c4fce25a623763
    Closes-Bug: #1780727
    (cherry picked from commit ee6e0c1e7eb861e56915c5b6c60a214b75240366)
    (cherry picked from commit 0be8cbc302aa77b312e031f6a7a419e83afd6e3b)

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

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

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

Fix proposed to branch: stable/ocata
Review: https://review.opendev.org/666872

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on nova (stable/ocata)

Change abandoned by "Lee Yarwood <email address hidden>" on branch: stable/ocata
Review: https://review.opendev.org/c/openstack/nova/+/666872

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

Duplicates of this bug

Other bug subscribers

Remote bug watches

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