nova-manage placement heal allocation command wrongly assumes allocation not exists for an instance if placement returns error code

Bug #1835419 reported by Balazs Gibizer
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Low
Balazs Gibizer

Bug Description

The nova-manage placement heal_allocation implementation queries the instance consumer from placement[1][2]. It assumes that if the placement query returned a non 200 response then the consumer does not exists and needs to be healed. However placement returns http 200 even if the consumer does not exits [3] so the assumption in [1] is invalid.

[1]https://github.com/openstack/nova/blob/de2c04981b438d4d10d4ee0207d79b4d3ec5135e/nova/cmd/manage.py#L1718-L1727
[2]https://github.com/openstack/nova/blob/de2c04981b438d4d10d4ee0207d79b4d3ec5135e/nova/scheduler/client/report.py#L1509
[3] https://developer.openstack.org/api-ref/placement/?expanded=list-allocations-detail#list-allocations

Tags: nova-manage
description: updated
tags: added: nova-manage
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

Fix proposed to branch: master
Review: https://review.opendev.org/669188

Changed in nova:
assignee: nobody → Balazs Gibizer (balazs-gibizer)
status: New → In Progress
Changed in nova:
importance: Undecided → Low
Revision history for this message
Chris Dent (cdent) wrote :

To clarify the issue here (I think most people reading this will already know but just for clarify), this is common behavior for "collection" style HTTP API responses. If the response is a list, a list with 0 members is a 200 response.

So as long as the identifier passed to GET /allocation/{identifier} is well-formed, you'll get back a list, because that identifier notionally identifies a group of allocations that may exist, but right now is empty.

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

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

commit e6f011926295e0a36fa06c46f69525bcd7fa25dd
Author: Balazs Gibizer <email address hidden>
Date: Thu Jul 4 16:15:33 2019 +0200

    Remove assumption of http error if consumer not exists

    The heal_allocations_for_instance assumes that placement GET
    /allocations/<instance_uuid> query returns an error code if the consumer
    does not exists in placement. However placement returns an empty
    allocation instead.

    This patch removes such assumption and treates the negative response
    from placement as a fatal error.

    Change-Id: I7e2df32029e4cff57a0dddcd905b6c1aac207546
    Closes-Bug: #1835419

Changed in nova:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/nova 20.0.0.0rc1

This issue was fixed in the openstack/nova 20.0.0.0rc1 release candidate.

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.