From c40fc8a4db3fe2d4d415f27d275b1d784a90cfe5 Mon Sep 17 00:00:00 2001 From: Andrew Laski Date: Tue, 11 Dec 2012 13:48:11 -0500 Subject: Fix poll_rescued_instances periodic task The poll_rescued_instances periodic task now checks the amount of time that an instance has been in the RESCUED stated before timing out the rescue. It also now performs the unrescue through the compute api in order to make sure the database is left in a consistent state. The poll_rescued_instances method is no longer necessary in the virt driver interface and has been removed. And also removed from the different virt drivers, since it was just doing a 'pass' in each of them. bug 1088625 bug 1088627 Change-Id: I75f7dc188cc49e5f6e5c8a3cb256d1c42ff7d882 --- nova/compute/manager.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'nova/compute') diff --git a/nova/compute/manager.py b/nova/compute/manager.py index 616083079..979f7c53a 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -1592,6 +1592,7 @@ class ComputeManager(manager.SchedulerDependentManager): vm_state=vm_states.RESCUED, task_state=None, power_state=current_power_state, + launched_at=timeutils.utcnow(), expected_task_state=task_states.RESCUING) @exception.wrap_exception(notifier=notifier, publisher_id=publisher_id()) @@ -2818,7 +2819,22 @@ class ComputeManager(manager.SchedulerDependentManager): @manager.periodic_task def _poll_rescued_instances(self, context): if CONF.rescue_timeout > 0: - self.driver.poll_rescued_instances(CONF.rescue_timeout) + instances = self.conductor_api.instance_get_all_by_host(context, + self.host) + + rescued_instances = [] + for instance in instances: + if instance['vm_state'] == vm_states.RESCUED: + rescued_instances.append(instance) + + to_unrescue = [] + for instance in rescued_instances: + if timeutils.is_older_than(instance['launched_at'], + CONF.rescue_timeout): + to_unrescue.append(instance) + + for instance in to_unrescue: + self.compute_api.unrescue(context, instance) @manager.periodic_task def _poll_unconfirmed_resizes(self, context): -- cgit