diff options
author | Jenkins <jenkins@review.openstack.org> | 2014-09-25 10:59:13 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2014-09-25 10:59:13 +0000 |
commit | 9bc59c02d5d4fdf2237760ba4a80bc64e68fb179 (patch) | |
tree | 0b92b578ffdd047422de95b0b50983c8e78a73fd | |
parent | 956e8e726bdde200b7b54598187910d080dc5913 (diff) | |
parent | 97a5578657ef3a9efaaff134780f565b9c5f415f (diff) | |
download | nova-9bc59c02d5d4fdf2237760ba4a80bc64e68fb179.tar.gz |
Merge "Revert "libvirt: support live migrate of instances with conf drives""
-rw-r--r-- | nova/exception.py | 6 | ||||
-rw-r--r-- | nova/tests/virt/libvirt/test_driver.py | 27 | ||||
-rw-r--r-- | nova/virt/libvirt/driver.py | 27 |
3 files changed, 34 insertions, 26 deletions
diff --git a/nova/exception.py b/nova/exception.py index b4b471e864..efc5492529 100644 --- a/nova/exception.py +++ b/nova/exception.py @@ -1650,6 +1650,12 @@ class InvalidWatchdogAction(Invalid): msg_fmt = _("Provided watchdog action (%(action)s) is not supported.") +class NoLiveMigrationForConfigDriveInLibVirt(NovaException): + msg_fmt = _("Live migration of instances with config drives is not " + "supported in libvirt unless libvirt instance path and " + "drive data is shared across compute nodes.") + + class LiveMigrationWithOldNovaNotSafe(NovaException): msg_fmt = _("Host %(server)s is running an old version of Nova, " "live migrations involving that version may cause data loss. " diff --git a/nova/tests/virt/libvirt/test_driver.py b/nova/tests/virt/libvirt/test_driver.py index b7e914e2ab..0dd21bd86b 100644 --- a/nova/tests/virt/libvirt/test_driver.py +++ b/nova/tests/virt/libvirt/test_driver.py @@ -5753,6 +5753,26 @@ class LibvirtConnTestCase(test.TestCase): 'vnc': '127.0.0.1'}} self.assertEqual(result, target_res) + def test_pre_live_migration_block_with_config_drive_mocked(self): + # Creating testdata + vol = {'block_device_mapping': [ + {'connection_info': 'dummy', 'mount_device': '/dev/sda'}, + {'connection_info': 'dummy', 'mount_device': '/dev/sdb'}]} + conn = libvirt_driver.LibvirtDriver(fake.FakeVirtAPI(), False) + + def fake_true(*args, **kwargs): + return True + + self.stubs.Set(configdrive, 'required_by', fake_true) + + inst_ref = {'id': 'foo'} + c = context.get_admin_context() + + self.assertRaises(exception.NoLiveMigrationForConfigDriveInLibVirt, + conn.pre_live_migration, c, inst_ref, vol, None, + None, {'is_shared_instance_path': False, + 'is_shared_block_storage': False}) + def test_pre_live_migration_vol_backed_works_correctly_mocked(self): # Creating testdata, using temp dir. with utils.tempdir() as tmpdir: @@ -12030,13 +12050,6 @@ class LibvirtDriverTestCase(test.TestCase): cdb.make_drive(mox.Regex(configdrive_path)) cdb.__exit__(mox.IgnoreArg(), mox.IgnoreArg(), mox.IgnoreArg() ).AndReturn(None) - - imagebackend.Backend.image(instance, 'disk.config.rescue', 'raw' - ).AndReturn(fake_imagebackend.Raw()) - imagebackend.Image.cache(fetch_func=mox.IgnoreArg(), - context=mox.IgnoreArg(), - filename='disk.config.rescue') - image_meta = {'id': 'fake', 'name': 'fake'} self.libvirtconnection._get_guest_xml(mox.IgnoreArg(), instance, network_info, mox.IgnoreArg(), diff --git a/nova/virt/libvirt/driver.py b/nova/virt/libvirt/driver.py index f587bb8147..6b1c1b7a98 100644 --- a/nova/virt/libvirt/driver.py +++ b/nova/virt/libvirt/driver.py @@ -3083,16 +3083,6 @@ class LibvirtDriver(driver.ComputeDriver): 'with error: %s'), e, instance=instance) - def dummy_fetch_func(target, *args, **kwargs): - # NOTE(sileht): this is never called because the - # the target have already been created by - # cdb.make_drive call - pass - - raw('disk.config').cache(fetch_func=dummy_fetch_func, - context=context, - filename='disk.config' + suffix) - # File injection only if needed elif inject_files and CONF.libvirt.inject_partition != -2: if booted_from_volume: @@ -3478,19 +3468,11 @@ class LibvirtDriver(driver.ComputeDriver): block_device.prepend_dev(diskswap.target_dev)) if 'disk.config' in disk_mapping: - # NOTE(sileht): a configdrive is a raw image - # it works well with rbd, lvm and raw images_type - # but we must force to raw image_type if the desired - # images_type is qcow2 - if CONF.libvirt.images_type not in ['rbd', 'lvm']: - image_type = "raw" - else: - image_type = None diskconfig = self._get_guest_disk_config(instance, 'disk.config', disk_mapping, inst_type, - image_type) + 'raw') devices.append(diskconfig) for vol in block_device.get_bdms_to_connect(block_device_mapping, @@ -5440,6 +5422,13 @@ class LibvirtDriver(driver.ComputeDriver): is_block_migration = migrate_data.get('block_migration', True) instance_relative_path = migrate_data.get('instance_relative_path') + if not (is_shared_instance_path and is_shared_block_storage): + # NOTE(mikal): live migration of instances using config drive is + # not supported because of a bug in libvirt (read only devices + # are not copied by libvirt). See bug/1246201 + if configdrive.required_by(instance): + raise exception.NoLiveMigrationForConfigDriveInLibVirt() + if not is_shared_instance_path: # NOTE(mikal): this doesn't use libvirt_utils.get_instance_path # because we are ensuring that the same instance directory name |