[placement] Attempting to find allocation candidates for shared-only resources results in KeyError

Bug #1705071 reported by Jay Pipes
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
High
Chris Dent

Bug Description

When attempting to perform a GET /allocation_candidates request for only resources that are shared, a KeyError is produced:

http://paste.openstack.org/show/615753/

The problem is that the _get_usages_by_provider_and_rc() method returns a dict with only the sharing resource provider usage information but the _get_all_with_shared() returns a list of resource provider IDs including both the *sharing* resource provider *and* the shared-with providers.

When the code attempts to cross-reference provider summaries (which are constructed by looping over the usage dicts) with each provider ID in the result from _get_all_with_shared(), we hit a KeyError on the shared-with provider IDs because there was no usage record (because the usage query filters on resource class ID and we requested only a resource class ID that was shared)

Tags: placement
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/484900

Changed in nova:
assignee: nobody → Jay Pipes (jaypipes)
status: Triaged → In Progress
Changed in nova:
assignee: Jay Pipes (jaypipes) → Matt Riedemann (mriedem)
Changed in nova:
assignee: Matt Riedemann (mriedem) → Jay Pipes (jaypipes)
Changed in nova:
assignee: Jay Pipes (jaypipes) → Chris Dent (cdent)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/484900
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=d67d3459afd5271f09cc6bbeb0359ad419a4ec7a
Submitter: Jenkins
Branch: master

commit d67d3459afd5271f09cc6bbeb0359ad419a4ec7a
Author: Jay Pipes <email address hidden>
Date: Tue Jul 18 14:03:53 2017 -0400

    placement: alloc candidates only shared resources

    When attempting to perform a GET /allocation_candidates request for
    only resources that are shared, a KeyError was being produced:

    http://paste.openstack.org/show/615753/

    The problem is that the _get_usages_by_provider_and_rc() method returns
    a dict with only the sharing resource provider usage information but
    the _get_all_with_shared() returns a list of resource provider IDs
    including both the *sharing* resource provider *and* the shared-with
    providers.

    When the code attempts to cross-reference provider summaries (which are
    constructed by looping over the usage dicts) with each provider ID in
    the result from _get_all_with_shared(), we hit a KeyError on the
    shared-with provider IDs because there was no usage record (because the
    usage query filters on resource class ID and we requested only a
    resource class ID that was shared)

    This patch fixes the problem with a KeyError being produced for those
    providers that do not provide any resources (i.e. they are only
    included in the returned results because they have requested resource
    shared *with* them) by returning both the internal integer ID and the
    UUID of providers from the _get_all_shared_with() function and then in
    the loop to create allocation requests, simply ignoring any resource provider
    that doesn't exist in the provider_summaries dict.

    Closes-Bug: #1705071

    Change-Id: I742fd093a8b33ff88244b2990021784e4b65f51f

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

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

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.