Raises NotImplementedError for LVM migration.

Currently migration of an LVM backed instance results in a new
instance being launched on the destination node, but the instance
disk is neither copied to the destination nor deleted on the
origin node. The problem is addressed by raising a NotImplementedError.

Closes-Bug: #1270305
Closes-Bug: #1245595
Closes-Bug: #1241866
Change-Id: I8010230b1aa5ddc322d0c93dd916b7700c25ab81
DocImpact
This commit is contained in:
Daniel Genin 2014-07-28 17:12:40 -04:00
parent 0701dcc247
commit e24f333cd5
3 changed files with 51 additions and 0 deletions

View File

@ -3463,6 +3463,11 @@ class ComputeManager(manager.Manager):
instance_type, quotas,
request_spec, filter_properties,
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:
# try to re-schedule the resize elsewhere:
exc_info = sys.exc_info()

View File

@ -9380,6 +9380,46 @@ class LibvirtDriverTestCase(test.TestCase):
self.assertFalse(self.copy_or_move_swap_called)
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):
instance = self._create_instance()
flavor = {'root_gb': 5}

View File

@ -5096,6 +5096,12 @@ class LibvirtDriver(driver.ComputeDriver):
block_device_info=block_device_info)
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
# rename instance dir to +_resize at first for using
# shared storage for instance dir (eg. NFS).