ResourceTracker._update_usage_from_migrations() is inefficient due to multiple Instance.get_by_uuid() lookups
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Compute (nova) |
Fix Released
|
Medium
|
Diana Clarke |
Bug Description
Here is our ResourceTracker
def _update_
filtered = {}
# do some defensive filtering against bad migrations records in the
# database:
for migration in migrations:
if not instance:
# migration referencing deleted instance
uuid = instance['uuid']
# skip migration if instance isn't in a resize state:
if not self._instance_
# filter to most recently updated migration for each instance:
m = filtered.get(uuid, None)
if not m or migration[
for migration in filtered.values():
try:
except exception.
Unfortunately, when the migration object's 'instance' attribute is accessed, a call across RPC and DB occurs:
https:/
@property
def instance(self):
return instance_
For some very strange reason, the code in _update_
There's no reason to do this at all. The filtered variable can go away and the call to _update_
instance = migration[
That way, for each migration, we don't need to do two lookup by UUID calls through the conductor to get the migration's instance object...
Changed in nova: | |
status: | New → Confirmed |
importance: | Undecided → Medium |
Changed in nova: | |
assignee: | nobody → Chaitanya Challa (cvskchaitanya) |
Changed in nova: | |
assignee: | Chaitanya Challa (cvskchaitanya) → nobody |
Changed in nova: | |
assignee: | nobody → Chaitanya Challa (cchalla) |
Changed in nova: | |
assignee: | Chaitanya Challa (cchalla) → nobody |
status: | In Progress → Incomplete |
Changed in nova: | |
assignee: | nobody → Vineet Menon (mvineetmenon) |
Changed in nova: | |
status: | Incomplete → Confirmed |
assignee: | Vineet Menon (mvineetmenon) → nobody |
Changed in nova: | |
assignee: | nobody → Geronimo Orozco (gorozco) |
summary: |
- ResourceTracker._update_usage_from_migration() is inefficient due to + ResourceTracker._update_usage_from_migrations() is inefficient due to multiple Instance.get_by_uuid() lookups |
Changed in nova: | |
assignee: | Geronimo Orozco (gorozco) → Diana Clarke (diana-clarke) |
Changed in nova: | |
status: | Confirmed → In Progress |
Changed in nova: | |
milestone: | none → liberty-rc1 |
status: | Fix Committed → Fix Released |
Changed in nova: | |
milestone: | liberty-rc1 → 12.0.0 |
Fix proposed to branch: master /review. openstack. org/131676
Review: https:/