summaryrefslogtreecommitdiff
path: root/nova/virt/libvirt/driver.py
diff options
context:
space:
mode:
authorPawel Koniszewski <pawel.koniszewski@intel.com>2016-07-06 11:04:16 +0200
committerRong Han <han.rong3@zte.com.cn>2016-09-05 03:21:15 +0000
commit48d30c16d339c8d1218c3b85c9da7a69f7e99bb8 (patch)
treefba8063094cc5c0930c7d15558753efa74126c8e /nova/virt/libvirt/driver.py
parentcc2105fc4be0ebd65207792b77361bf05064fd29 (diff)
downloadnova-48d30c16d339c8d1218c3b85c9da7a69f7e99bb8.tar.gz
[libvirt] Live migration fails when config_drive_format=iso9660
This patch enables block live migration with read-only config drive. Basically it copies config drive to destination host prior to migration start, so that QEMU will not try to write to read-only device and therefore it will not raise an exception. Co-Authored-By: Bartosz Fic <bartosz.fic@intel.com> Co-Authored-By: Michael Still <mikal@stillhq.com> Change-Id: I9ddaef658e3d9a77e4982275d7df9e56b0a5459f Closes-Bug: #1246201 (cherry picked from commit bc4b9980fa74e15e98aed5633c61480c751767b5)
Diffstat (limited to 'nova/virt/libvirt/driver.py')
-rw-r--r--nova/virt/libvirt/driver.py29
1 files changed, 13 insertions, 16 deletions
diff --git a/nova/virt/libvirt/driver.py b/nova/virt/libvirt/driver.py
index bac17cfbec..8e2ea91673 100644
--- a/nova/virt/libvirt/driver.py
+++ b/nova/virt/libvirt/driver.py
@@ -6614,22 +6614,6 @@ class LibvirtDriver(driver.ComputeDriver):
is_shared_instance_path = migrate_data.is_shared_instance_path
is_block_migration = migrate_data.block_migration
- if configdrive.required_by(instance):
- # NOTE(sileht): configdrive is stored into the block storage
- # kvm is a block device, live migration will work
- # NOTE(sileht): the configdrive is stored into a shared path
- # kvm don't need to migrate it, live migration will work
- # NOTE(dims): Using config drive with iso format does not work
- # because of a bug in libvirt with read only devices. However
- # one can use vfat as config_drive_format which works fine.
- # Please see bug/1246201 for details on the libvirt bug.
- if (is_shared_block_storage or
- is_shared_instance_path or
- CONF.config_drive_format == 'vfat'):
- pass
- else:
- raise exception.NoLiveMigrationForConfigDriveInLibVirt()
-
if not is_shared_instance_path:
instance_dir = libvirt_utils.get_instance_path_at_destination(
instance, migrate_data)
@@ -6666,6 +6650,19 @@ class LibvirtDriver(driver.ComputeDriver):
self._create_images_and_backing(
context, instance, instance_dir, disk_info,
fallback_from_host=instance.host)
+ if (configdrive.required_by(instance) and
+ CONF.config_drive_format == 'iso9660'):
+ # NOTE(pkoniszewski): Due to a bug in libvirt iso config
+ # drive needs to be copied to destination prior to
+ # migration when instance path is not shared and block
+ # storage is not shared. Files that are already present
+ # on destination are excluded from a list of files that
+ # need to be copied to destination. If we don't do that
+ # live migration will fail on copying iso config drive to
+ # destination and writing to read-only device.
+ # Please see bug/1246201 for more details.
+ src = "%s:%s/disk.config" % (instance.host, instance_dir)
+ self._remotefs.copy_file(src, instance_dir)
if not is_block_migration:
# NOTE(angdraug): when block storage is shared between source