diff options
| author | Hans Lindgren <hanlind@kth.se> | 2013-02-27 00:23:47 +0100 |
|---|---|---|
| committer | Hans Lindgren <hanlind@kth.se> | 2013-03-03 14:02:22 +0100 |
| commit | 58889a08fcce7407366f8aae0c703b4fa0480725 (patch) | |
| tree | 0691c58701a89080335d5d26b714e651a8e1cd78 /nova/compute | |
| parent | e03a3df8869ad5303aaba0f006c17d0927fa6dab (diff) | |
| download | nova-58889a08fcce7407366f8aae0c703b4fa0480725.tar.gz nova-58889a08fcce7407366f8aae0c703b4fa0480725.tar.xz nova-58889a08fcce7407366f8aae0c703b4fa0480725.zip | |
Make ComputeManager _running_deleted_instances query by uuid
Reuse existing _get_instances_on_driver method to query driver for
running instances.
Resolves bug 1129519.
Change-Id: I9186b289fadfc4414874b3ba52195e9acfac18b4
Diffstat (limited to 'nova/compute')
| -rwxr-xr-x | nova/compute/manager.py | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/nova/compute/manager.py b/nova/compute/manager.py index c875c50e1..48e33da39 100755 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -3674,22 +3674,20 @@ class ComputeManager(manager.SchedulerDependentManager): def _running_deleted_instances(self, context): """Returns a list of instances nova thinks is deleted, - but the hypervisor thinks is still running. This method - should be pushed down to the virt layer for efficiency. + but the hypervisor thinks is still running. """ + timeout = CONF.running_deleted_instance_timeout + def deleted_instance(instance): - timeout = CONF.running_deleted_instance_timeout - present = instance['name'] in present_name_labels - erroneously_running = instance['deleted'] and present + erroneously_running = instance['deleted'] old_enough = (not instance['deleted_at'] or timeutils.is_older_than(instance['deleted_at'], timeout)) if erroneously_running and old_enough: return True return False - present_name_labels = set(self.driver.list_instances()) - instances = self.conductor_api.instance_get_all_by_host(context, - self.host) + + instances = self._get_instances_on_driver(context) return [i for i in instances if deleted_instance(i)] @contextlib.contextmanager |
