From 91c39baedcbcacc90ab87fad602adb7c20de2de0 Mon Sep 17 00:00:00 2001 From: Rick Harris Date: Mon, 7 Nov 2011 23:10:12 +0000 Subject: Fixing create_vbd call per VolumeHelper refactoring Change-Id: I6a34984104b5c62e9b494beef521e447104ec408 --- nova/tests/test_network.py | 2 +- nova/virt/xenapi/vm_utils.py | 21 +++++++++++++-------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/nova/tests/test_network.py b/nova/tests/test_network.py index afcebc223..c66c38c85 100644 --- a/nova/tests/test_network.py +++ b/nova/tests/test_network.py @@ -206,7 +206,7 @@ class FlatNetworkTestCase(test.TestCase): is_admin=True) nets = self.network.create_networks(context_admin, 'fake', '192.168.0.0/24', False, 1, - 256, None, None, None, None ) + 256, None, None, None, None) self.assertEqual(1, len(nets)) network = nets[0] self.assertEqual(3, db.network_count_reserved_ips(context_admin, diff --git a/nova/virt/xenapi/vm_utils.py b/nova/virt/xenapi/vm_utils.py index 296f9b0e4..b27ff63ac 100644 --- a/nova/virt/xenapi/vm_utils.py +++ b/nova/virt/xenapi/vm_utils.py @@ -45,7 +45,7 @@ from nova.compute import power_state from nova.virt import disk from nova.virt import images from nova.virt.xenapi import HelperBase -from nova.virt.xenapi.volume_utils import StorageError +from nova.virt.xenapi import volume_utils LOG = logging.getLogger("nova.virt.xenapi.vm_utils") @@ -245,7 +245,8 @@ class VMHelper(HelperBase): return vbd_ref except cls.XenAPI.Failure, exc: LOG.exception(exc) - raise StorageError(_('VBD not found in instance %s') % vm_ref) + raise volume_utils.StorageError( + _('VBD not found in instance %s') % vm_ref) @classmethod def unplug_vbd(cls, session, vbd_ref): @@ -255,7 +256,8 @@ class VMHelper(HelperBase): except cls.XenAPI.Failure, exc: LOG.exception(exc) if exc.details[0] != 'DEVICE_ALREADY_DETACHED': - raise StorageError(_('Unable to unplug VBD %s') % vbd_ref) + raise volume_utils.StorageError( + _('Unable to unplug VBD %s') % vbd_ref) @classmethod def destroy_vbd(cls, session, vbd_ref): @@ -265,7 +267,8 @@ class VMHelper(HelperBase): session.wait_for_task(task) except cls.XenAPI.Failure, exc: LOG.exception(exc) - raise StorageError(_('Unable to destroy VBD %s') % vbd_ref) + raise volume_utils.StorageError( + _('Unable to destroy VBD %s') % vbd_ref) @classmethod def destroy_vdi(cls, session, vdi_ref): @@ -274,7 +277,8 @@ class VMHelper(HelperBase): session.wait_for_task(task) except cls.XenAPI.Failure, exc: LOG.exception(exc) - raise StorageError(_('Unable to destroy VDI %s') % vdi_ref) + raise volume_utils.StorageError( + _('Unable to destroy VDI %s') % vdi_ref) @classmethod def create_vdi(cls, session, sr_ref, name_label, virtual_size, read_only): @@ -502,8 +506,8 @@ w run_as_root=True) # 4. Create VBD between instance VM and swap VDI - cls.create_vbd(session, vm_ref, vdi_ref, userdevice, - bootable=False) + volume_utils.VolumeHelper.create_vbd( + session, vm_ref, vdi_ref, userdevice, bootable=False) except: with utils.save_and_reraise_exception(): cls.destroy_vdi(session, vdi_ref) @@ -1220,7 +1224,8 @@ def _wait_for_device(dev): return time.sleep(1) - raise StorageError(_('Timeout waiting for device %s to be created') % dev) + raise volume_utils.StorageError( + _('Timeout waiting for device %s to be created') % dev) @contextlib.contextmanager -- cgit