summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2012-11-06 07:20:37 +0000
committerGerrit Code Review <review@openstack.org>2012-11-06 07:20:37 +0000
commitb0efa623936bbe95efd467a166cb990266db2487 (patch)
tree7487ac40ae426af2ed22f34272a7588d0a19d5eb
parent181e44c9e5327392e5b4b9da18b5ce863780a3b1 (diff)
parentcfceed71dabfbac538e65bd1d5a95197beb94001 (diff)
downloadnova-b0efa623936bbe95efd467a166cb990266db2487.tar.gz
nova-b0efa623936bbe95efd467a166cb990266db2487.tar.xz
nova-b0efa623936bbe95efd467a166cb990266db2487.zip
Merge "Look up stuck-in-rebooting instances in manager"
-rw-r--r--nova/compute/manager.py5
-rw-r--r--nova/tests/test_virt_drivers.py3
-rw-r--r--nova/virt/driver.py10
-rw-r--r--nova/virt/fake.py2
-rw-r--r--nova/virt/libvirt/driver.py2
-rw-r--r--nova/virt/xenapi/driver.py4
-rw-r--r--nova/virt/xenapi/vmops.py3
7 files changed, 19 insertions, 10 deletions
diff --git a/nova/compute/manager.py b/nova/compute/manager.py
index e06bbc4aa..de848abdd 100644
--- a/nova/compute/manager.py
+++ b/nova/compute/manager.py
@@ -2670,7 +2670,10 @@ class ComputeManager(manager.SchedulerDependentManager):
@manager.periodic_task
def _poll_rebooting_instances(self, context):
if FLAGS.reboot_timeout > 0:
- self.driver.poll_rebooting_instances(FLAGS.reboot_timeout)
+ instances = self.db.instance_get_all_hung_in_rebooting(
+ context, FLAGS.reboot_timeout)
+ self.driver.poll_rebooting_instances(FLAGS.reboot_timeout,
+ instances)
@manager.periodic_task
def _poll_rescued_instances(self, context):
diff --git a/nova/tests/test_virt_drivers.py b/nova/tests/test_virt_drivers.py
index 1f30ee695..9d48cdf06 100644
--- a/nova/tests/test_virt_drivers.py
+++ b/nova/tests/test_virt_drivers.py
@@ -269,7 +269,8 @@ class _VirtDriverTestCase(_FakeDriverBackendTestCase):
@catch_notimplementederror
def test_poll_rebooting_instances(self):
- self.connection.poll_rebooting_instances(10)
+ instances = [self._get_running_instance()]
+ self.connection.poll_rebooting_instances(10, instances)
@catch_notimplementederror
def test_poll_rescued_instances(self):
diff --git a/nova/virt/driver.py b/nova/virt/driver.py
index 9c8a6448d..a466fa180 100644
--- a/nova/virt/driver.py
+++ b/nova/virt/driver.py
@@ -604,8 +604,14 @@ class ComputeDriver(object):
# TODO(Vek): Need to pass context in for access to auth_token
pass
- def poll_rebooting_instances(self, timeout):
- """Poll for rebooting instances"""
+ def poll_rebooting_instances(self, timeout, instances):
+ """Poll for rebooting instances
+
+ :param timeout: the currently configured timeout for considering
+ rebooting instances to be stuck
+ :param instances: instances that have been in rebooting state
+ longer than the configured timeout
+ """
# TODO(Vek): Need to pass context in for access to auth_token
raise NotImplementedError()
diff --git a/nova/virt/fake.py b/nova/virt/fake.py
index 03711fe98..877fb7603 100644
--- a/nova/virt/fake.py
+++ b/nova/virt/fake.py
@@ -123,7 +123,7 @@ class FakeDriver(driver.ComputeDriver):
def unrescue(self, instance, network_info):
pass
- def poll_rebooting_instances(self, timeout):
+ def poll_rebooting_instances(self, timeout, instances):
pass
def poll_rescued_instances(self, timeout):
diff --git a/nova/virt/libvirt/driver.py b/nova/virt/libvirt/driver.py
index 97ce1710c..3104fafd3 100644
--- a/nova/virt/libvirt/driver.py
+++ b/nova/virt/libvirt/driver.py
@@ -1052,7 +1052,7 @@ class LibvirtDriver(driver.ComputeDriver):
libvirt_utils.file_delete(rescue_file)
@exception.wrap_exception()
- def poll_rebooting_instances(self, timeout):
+ def poll_rebooting_instances(self, timeout, instances):
pass
@exception.wrap_exception()
diff --git a/nova/virt/xenapi/driver.py b/nova/virt/xenapi/driver.py
index e4c4150a8..a928bf861 100644
--- a/nova/virt/xenapi/driver.py
+++ b/nova/virt/xenapi/driver.py
@@ -290,9 +290,9 @@ class XenAPIDriver(driver.ComputeDriver):
"""Restore the specified instance"""
self._vmops.restore(instance)
- def poll_rebooting_instances(self, timeout):
+ def poll_rebooting_instances(self, timeout, instances):
"""Poll for rebooting instances"""
- self._vmops.poll_rebooting_instances(timeout)
+ self._vmops.poll_rebooting_instances(timeout, instances)
def poll_rescued_instances(self, timeout):
"""Poll for rescued instances"""
diff --git a/nova/virt/xenapi/vmops.py b/nova/virt/xenapi/vmops.py
index d148ab73e..7aa4a20ce 100644
--- a/nova/virt/xenapi/vmops.py
+++ b/nova/virt/xenapi/vmops.py
@@ -1174,7 +1174,7 @@ class VMOps(object):
if timeutils.is_older_than(task_created, timeout):
self._session.call_xenapi("task.cancel", task_ref)
- def poll_rebooting_instances(self, timeout):
+ def poll_rebooting_instances(self, timeout, instances):
"""Look for expirable rebooting instances.
- issue a "hard" reboot to any instance that has been stuck in a
@@ -1185,7 +1185,6 @@ class VMOps(object):
self._cancel_stale_tasks(timeout, 'VM.clean_reboot')
ctxt = nova_context.get_admin_context()
- instances = db.instance_get_all_hung_in_rebooting(ctxt, timeout)
instances_info = dict(instance_count=len(instances),
timeout=timeout)