Merge "Raises NotImplementedError for LVM migration."
This commit is contained in:
@@ -3477,6 +3477,11 @@ class ComputeManager(manager.Manager):
|
|||||||
instance_type, quotas,
|
instance_type, quotas,
|
||||||
request_spec, filter_properties,
|
request_spec, filter_properties,
|
||||||
node)
|
node)
|
||||||
|
# NOTE(dgenin): This is thrown in LibvirtDriver when the
|
||||||
|
# instance to be migrated is backed by LVM.
|
||||||
|
# Remove when LVM migration is implemented.
|
||||||
|
except exception.MigrationPreCheckError:
|
||||||
|
raise
|
||||||
except Exception:
|
except Exception:
|
||||||
# try to re-schedule the resize elsewhere:
|
# try to re-schedule the resize elsewhere:
|
||||||
exc_info = sys.exc_info()
|
exc_info = sys.exc_info()
|
||||||
|
|||||||
@@ -9501,6 +9501,46 @@ class LibvirtDriverTestCase(test.TestCase):
|
|||||||
self.assertFalse(self.copy_or_move_swap_called)
|
self.assertFalse(self.copy_or_move_swap_called)
|
||||||
self.assertEqual(disk_info_text, out)
|
self.assertEqual(disk_info_text, out)
|
||||||
|
|
||||||
|
def test_migrate_disk_and_power_off_lvm(self):
|
||||||
|
"""Test for nova.virt.libvirt.libvirt_driver.LibvirtConnection
|
||||||
|
.migrate_disk_and_power_off.
|
||||||
|
"""
|
||||||
|
|
||||||
|
self.flags(images_type='lvm', group='libvirt')
|
||||||
|
disk_info = [{'type': 'raw', 'path': '/dev/vg/disk',
|
||||||
|
'disk_size': '83886080'},
|
||||||
|
{'type': 'raw', 'path': '/dev/disk.local',
|
||||||
|
'disk_size': '83886080'}]
|
||||||
|
disk_info_text = jsonutils.dumps(disk_info)
|
||||||
|
|
||||||
|
def fake_get_instance_disk_info(instance, xml=None,
|
||||||
|
block_device_info=None):
|
||||||
|
return disk_info_text
|
||||||
|
|
||||||
|
def fake_destroy(instance):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def fake_get_host_ip_addr():
|
||||||
|
return '10.0.0.1'
|
||||||
|
|
||||||
|
def fake_execute(*args, **kwargs):
|
||||||
|
pass
|
||||||
|
|
||||||
|
self.stubs.Set(self.libvirtconnection, 'get_instance_disk_info',
|
||||||
|
fake_get_instance_disk_info)
|
||||||
|
self.stubs.Set(self.libvirtconnection, '_destroy', fake_destroy)
|
||||||
|
self.stubs.Set(self.libvirtconnection, 'get_host_ip_addr',
|
||||||
|
fake_get_host_ip_addr)
|
||||||
|
self.stubs.Set(utils, 'execute', fake_execute)
|
||||||
|
|
||||||
|
ins_ref = self._create_instance()
|
||||||
|
flavor = {'root_gb': 10, 'ephemeral_gb': 20}
|
||||||
|
|
||||||
|
# Migration is not implemented for LVM backed instances
|
||||||
|
self.assertRaises(exception.MigrationPreCheckError,
|
||||||
|
self.libvirtconnection.migrate_disk_and_power_off,
|
||||||
|
None, ins_ref, '10.0.0.1', flavor, None)
|
||||||
|
|
||||||
def test_migrate_disk_and_power_off_resize_error(self):
|
def test_migrate_disk_and_power_off_resize_error(self):
|
||||||
instance = self._create_instance()
|
instance = self._create_instance()
|
||||||
flavor = {'root_gb': 5}
|
flavor = {'root_gb': 5}
|
||||||
|
|||||||
@@ -5128,6 +5128,12 @@ class LibvirtDriver(driver.ComputeDriver):
|
|||||||
block_device_info=block_device_info)
|
block_device_info=block_device_info)
|
||||||
disk_info = jsonutils.loads(disk_info_text)
|
disk_info = jsonutils.loads(disk_info_text)
|
||||||
|
|
||||||
|
# NOTE(dgenin): Migration is not implemented for LVM backed instances.
|
||||||
|
if (CONF.libvirt.images_type == 'lvm' and
|
||||||
|
not self._is_booted_from_volume(instance, disk_info_text)):
|
||||||
|
reason = "Migration is not supported for LVM backed instances"
|
||||||
|
raise exception.MigrationPreCheckError(reason)
|
||||||
|
|
||||||
# copy disks to destination
|
# copy disks to destination
|
||||||
# rename instance dir to +_resize at first for using
|
# rename instance dir to +_resize at first for using
|
||||||
# shared storage for instance dir (eg. NFS).
|
# shared storage for instance dir (eg. NFS).
|
||||||
|
|||||||
Reference in New Issue
Block a user