Handle HostMappingNotFound when deleting a service

Bug #1780727 reported by Surya Seetharaman on 2018-07-09
22
This bug affects 3 people
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
High
Matt Riedemann
Ocata
High
Matt Riedemann
Pike
High
Matt Riedemann
Queens
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.

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
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)

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

Changed in nova:
status: Confirmed → In Progress

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

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

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)

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

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)

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

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

Duplicates of this bug

Other bug subscribers