From 86bcb49b43e052b17fc173520ce8094dcc1db965 Mon Sep 17 00:00:00 2001 From: Johannes Erdfelt Date: Thu, 8 Mar 2012 20:08:34 +0000 Subject: Simplify unnecessary XenAPI Async calls to be synchronous It's silly to make an Async call and then immediately block waiting for the result Change-Id: I197d786679fd9e2a287fa39d374c5f7e12bf121c --- nova/tests/test_xenapi.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'nova/tests') diff --git a/nova/tests/test_xenapi.py b/nova/tests/test_xenapi.py index bc58330bb..11ba7b1cc 100644 --- a/nova/tests/test_xenapi.py +++ b/nova/tests/test_xenapi.py @@ -213,10 +213,6 @@ def configure_instance(*args): pass -def _find_rescue_vbd_ref(*args): - pass - - class XenAPIVMTestCase(test.TestCase): """Unit tests for VM operations.""" def setUp(self): @@ -238,8 +234,6 @@ class XenAPIVMTestCase(test.TestCase): stubs.stubout_is_vdi_pv(self.stubs) self.stubs.Set(vmops.VMOps, '_configure_instance', configure_instance) - self.stubs.Set(vmops.VMOps, '_find_rescue_vbd_ref', - _find_rescue_vbd_ref) stubs.stub_out_vm_methods(self.stubs) glance_stubs.stubout_glance_client(self.stubs) fake_utils.stub_out_utils_execute(self.stubs) @@ -709,7 +703,15 @@ class XenAPIVMTestCase(test.TestCase): str(3 * 1024)) def test_rescue(self): + def _find_rescue_vbd_ref(*args): + return vbd + + self.stubs.Set(vmops.VMOps, '_find_rescue_vbd_ref', + _find_rescue_vbd_ref) instance = self._create_instance() + session = xenapi_conn.XenAPISession('test_url', 'root', 'test_pass') + vm = vm_utils.VMHelper.lookup(session, instance.name) + vbd = xenapi_fake.create_vbd(vm, None) conn = xenapi_conn.get_connection(False) conn.rescue(self.context, instance, [], None) -- cgit