commit 79a1a113775df87d420b242cea4bbf953df3779c
Author: Chris Dent <email address hidden>
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
(cherry picked from commit 724d440122232a5bfdfec51eb0d37ca4f1d748d8)
Reviewed: https:/ /review. openstack. org/573811 /git.openstack. org/cgit/ openstack/ nova/commit/ ?id=79a1a113775 df87d420b242cea 4bbf953df3779c
Committed: https:/
Submitter: Zuul
Branch: stable/queens
commit 79a1a113775df87 d420b242cea4bbf 953df3779c
Author: Chris Dent <email address hidden>
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: I00f7dee26f0313 66dbc0d3d6a03ab e89afeb85fd bfdfec51eb0d37c a4f1d748d8)
Closes-Bug: #1775308
(cherry picked from commit 724d440122232a5