Reviewed: https://review.openstack.org/572652 Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=724d440122232a5bfdfec51eb0d37ca4f1d748d8 Submitter: Zuul Branch: master
commit 724d440122232a5bfdfec51eb0d37ca4f1d748d8 Author: Chris Dent <cd...@anticdent.org> Date: Tue Jun 5 18:07:05 2018 -0700 Ensure resource class cache when listing usages In rare circumstances it is possible to list usages in a new placement process that has not yet instantiated the _RC_CACHE but for which there are inventories and allocations in the database (added by other processes running against the same db). Before this change that would cause a 500 error (AttributeError) when the Usage objects in the UsageList were instantiated. The fix is to added _ensure_rc_cache to the two list methods. The addition is done there rather than in the _from_db_object as the latter would cause a lot of redundant checks. While we could probably devise a test for this, it's perhaps good enough to evaluate the change by inspection. If not, suggestions welcome. Change-Id: I00f7dee26f031366dbc0d3d6a03abe89afeb85fd Closes-Bug: #1775308 ** 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/1775308 Title: Listing placement usages (total or per resource provider) in a new process can result in a 500 Status in OpenStack Compute (nova): Fix Released Bug description: When requesting /usages or /resource_providers/{uuid}/usages it is possible to cause a 500 error if placement is running in a multi- process scenario and the usages query is the first request a process has received. This is because the methods which provide UsageLists do not _ensure_rc_cache, resulting in: File "/usr/lib/python3.6/site-packages/nova/api/openstack/placement/objects/resource_provider.py", line 2374, in _from_db_object rc_str = _RC_CACHE.string_from_id(source['resource_class_id']) AttributeError: 'NoneType' object has no attribute 'string_from_id' We presumably don't see this in our usual testing because any process has already had other requests happen, setting the cache. For now, the fix is to add the _ensure_rc_cache call in the right places, but long term if/when we switch to the os-resource-class model we can do the caching or syncing a bit differently (see https://review.openstack.org/#/c/553857/ for an example). To manage notifications about this bug go to: https://bugs.launchpad.net/nova/+bug/1775308/+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