diff options
| author | Johannes Erdfelt <johannes.erdfelt@rackspace.com> | 2012-10-02 17:55:00 +0000 |
|---|---|---|
| committer | Johannes Erdfelt <johannes.erdfelt@rackspace.com> | 2012-10-02 17:55:00 +0000 |
| commit | 6bc8c20be705f3cf704b5103e8bb998015d14248 (patch) | |
| tree | 2bd585d32c61826c2781184014f0a0e42356d3f0 /nova/compute | |
| parent | 0291266fb61dd398147fa2ae1a37366dd2fa869e (diff) | |
Make resource tracker uses faster DB query
Fixes bug 1060363
db.instance_get_all_by_filters() uses a regex when filtering on host,
which will do a full table scan. A regex isn't needed and instead,
db.instance_get_all_by_host() can be used which does not impact the
performance so much.
Change-Id: I812e1d5320763e5c65232351e1e21285e04e6a4b
Diffstat (limited to 'nova/compute')
| -rw-r--r-- | nova/compute/resource_tracker.py | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/nova/compute/resource_tracker.py b/nova/compute/resource_tracker.py index eb0d302b0..e5e1194a5 100644 --- a/nova/compute/resource_tracker.py +++ b/nova/compute/resource_tracker.py @@ -379,8 +379,7 @@ class ResourceTracker(object): self._purge_expired_claims() # Grab all instances assigned to this host: - filters = {'host': self.host, 'deleted': False} - instances = db.instance_get_all_by_filters(context, filters) + instances = db.instance_get_all_by_host(context, self.host) # Now calculate usage based on instance utilization: self._update_usage_from_instances(resources, instances) |
