From 58889a08fcce7407366f8aae0c703b4fa0480725 Mon Sep 17 00:00:00 2001 From: Hans Lindgren Date: Wed, 27 Feb 2013 00:23:47 +0100 Subject: 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 --- nova/compute/manager.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'nova/compute') 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 -- cgit