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 <jaypi...@gmail.com>
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

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1705071

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

Status in OpenStack Compute (nova):
  Fix Released

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)

To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1705071/+subscriptions

-- 
Mailing list: https://launchpad.net/~yahoo-eng-team
Post to     : yahoo-eng-team@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yahoo-eng-team
More help   : https://help.launchpad.net/ListHelp

Reply via email to