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

commit 2dd322a64291c20da33f28fd5c302ff27e70eae4
Author: esberglu <esber...@us.ibm.com>
Date:   Wed Jan 31 16:29:57 2018 -0600

    Use dict.get() when accessing capabilities dict
    
    Many compute drivers override the driver capabilities dict [1]. The
    code should be using dict.get() to avoid throwing KeyErrors if the
    overriding dictionaries do not have the corresponding keys. If the
    key is not found it will be assumed the the capability is not supported
    and default to false. This ensures that no drivers are broken because
    they are missing a capability.
    
    [1] 
https://github.com/openstack/nova/blob/5251f18d87/nova/virt/driver.py#L124-L134
    
    Change-Id: I1fa04fa110f2c65e10c065c61f2f0f58c1fad646
    Closes-Bug: #1746608


** 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/1746608

Title:
  Nova not always using get to access driver capabilites dict

Status in OpenStack Compute (nova):
  Fix Released

Bug description:
  When accessing the capabilities dict [1], nova should be using
  dict.get(). Since many compute drivers override the capabilities
  dictionary,

  capabilites['capability']

  will fail with a KeyError if their dictionary has not been updated to
  include the capability. By using get() it will default instead of
  throwing the KeyError.

  [1]
  
https://github.com/openstack/nova/blob/5251f18d87/nova/virt/driver.py#L124-L134

To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1746608/+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