diff options
| author | Andrew Laski <andrew.laski@rackspace.com> | 2012-12-11 13:48:11 -0500 |
|---|---|---|
| committer | Andrew Laski <andrew.laski@rackspace.com> | 2012-12-13 09:13:48 -0500 |
| commit | c40fc8a4db3fe2d4d415f27d275b1d784a90cfe5 (patch) | |
| tree | e172b191dff6e70d78e6187893c37ddadf7b6281 /nova/compute | |
| parent | dc48ce7fb1f18616bde1f95cecbef49d12f73c99 (diff) | |
| download | nova-c40fc8a4db3fe2d4d415f27d275b1d784a90cfe5.tar.gz nova-c40fc8a4db3fe2d4d415f27d275b1d784a90cfe5.tar.xz nova-c40fc8a4db3fe2d4d415f27d275b1d784a90cfe5.zip | |
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
Diffstat (limited to 'nova/compute')
| -rw-r--r-- | nova/compute/manager.py | 18 |
1 files changed, 17 insertions, 1 deletions
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): |
