From 40feb35898ed0a6d57b1f481c165e683796b045c Mon Sep 17 00:00:00 2001 From: Rick Harris Date: Wed, 6 Mar 2013 05:28:41 +0000 Subject: xenapi: Fix reboot with hung volumes If a volume becomes inoperable (e.g. the ISCSI connection is severed) and the user goes to reboot, the instance may enter a permanently halted state. The root cause is that a VBD that points to 'bad' volume prevents VM operations ('reboot', 'start') from completing under XenServer. The work around is to detect which volumes are bad, detach in the virt-layer, retry the operation (or in the case of reboot, just 'start' the halted instance), and then notify the compute manager via a callback so it can detach the volume in Cinder. Fixes bug 1148614 Change-Id: Id4e8e84bb5748cfa267c2a418f9405fd86829e8f --- nova/tests/compute/test_compute.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'nova/tests') diff --git a/nova/tests/compute/test_compute.py b/nova/tests/compute/test_compute.py index e94d8b788..3cdb69857 100644 --- a/nova/tests/compute/test_compute.py +++ b/nova/tests/compute/test_compute.py @@ -1150,15 +1150,20 @@ class ComputeTestCase(BaseTestCase): # this is called with the wrong args, so we have to hack # around it. reboot_call_info = {} - expected_call_info = {'args': (econtext, updated_instance1, - expected_nw_info, reboot_type, - fake_block_dev_info), - 'kwargs': {}} + expected_call_info = { + 'args': (econtext, updated_instance1, expected_nw_info, + reboot_type), + 'kwargs': {'block_device_info': fake_block_dev_info}} def fake_reboot(*args, **kwargs): reboot_call_info['args'] = args reboot_call_info['kwargs'] = kwargs + # NOTE(sirp): Since `bad_volumes_callback` is a function defined + # within `reboot_instance`, we don't have access to its value and + # can't stub it out, thus we skip that comparison. + kwargs.pop('bad_volumes_callback') + self.stubs.Set(self.compute.driver, 'reboot', fake_reboot) # Power state should be updated again -- cgit