diff options
author | Alessandro Pilotti <ap@pilotti.it> | 2013-03-12 18:17:16 +0200 |
---|---|---|
committer | Alessandro Pilotti <ap@pilotti.it> | 2013-03-14 04:31:27 +0200 |
commit | c4c478dec76d5eb21b9cd3e8fe8e2f401872c848 (patch) | |
tree | 9cc9a6283c557aa786c6ec007cc0bfef44bd090c /nova/virt/hyperv/livemigrationops.py | |
parent | 6242afabe863e2e557b2ec3d909dfa40c3c55e56 (diff) | |
download | nova-c4c478dec76d5eb21b9cd3e8fe8e2f401872c848.tar.gz |
Fixes Hyper-V live migration with attached volumes
Fixes bug: 1153429
The previous Hyper-V driver live migration implementation expects to find iSCSI
devices mounted on the same path on source and destination, which is not an
option in this context.
In order to be able to live migrate instances with attached volumes, this fix
provides the following behavior, based on the creation of a staged VM on the
target, so called "planned" in the Hyper-V documentation and in this patch.
pre_live_migration
The target host logs into the storage targets.
live_migration
The source host:
1) checks and removes a previously created planned VM for the current
instance if present on the target
2) creates a planned VM on the target by using the Hyper-V WMI API
3) maps the volume devices on the planned VM based on the target host
devices
4) live migrates the source VM on the planned VM
5) logs off the storage targets on the source
This solution provides live migration of volumes without needing to pause
the VM and detach / attach the volumes, preserving also the atomicity of the
live operation.
In the case in which no volumes are attached to the VM, live migration is
performed without creating explicitly a planned VM, starting from step 4
on the source in the above list.
Unit tests have been added for this scenario.
Change-Id: Ib634b77894f492896d86dce65a7269ece8f3d55b
Diffstat (limited to 'nova/virt/hyperv/livemigrationops.py')
-rw-r--r-- | nova/virt/hyperv/livemigrationops.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/nova/virt/hyperv/livemigrationops.py b/nova/virt/hyperv/livemigrationops.py index 94f6f74d83..adca7b8f3f 100644 --- a/nova/virt/hyperv/livemigrationops.py +++ b/nova/virt/hyperv/livemigrationops.py @@ -25,7 +25,6 @@ from nova.openstack.common import log as logging from nova.virt.hyperv import imagecache from nova.virt.hyperv import livemigrationutils from nova.virt.hyperv import pathutils -from nova.virt.hyperv import vmutils from nova.virt.hyperv import volumeops LOG = logging.getLogger(__name__) @@ -35,9 +34,7 @@ CONF.import_opt('use_cow_images', 'nova.virt.driver') class LiveMigrationOps(object): def __init__(self): - self._pathutils = pathutils.PathUtils() - self._vmutils = vmutils.VMUtils() self._livemigrutils = livemigrationutils.LiveMigrationUtils() self._volumeops = volumeops.VolumeOps() self._imagecache = imagecache.ImageCache() @@ -49,7 +46,10 @@ class LiveMigrationOps(object): instance_name = instance_ref["name"] try: - self._livemigrutils.live_migrate_vm(instance_name, dest) + iscsi_targets = self._livemigrutils.live_migrate_vm(instance_name, + dest) + for (target_iqn, target_lun) in iscsi_targets: + self._volumeops.logout_storage_target(target_iqn) except Exception: with excutils.save_and_reraise_exception(): LOG.debug(_("Calling live migration recover_method " @@ -66,11 +66,13 @@ class LiveMigrationOps(object): self._livemigrutils.check_live_migration_config() if CONF.use_cow_images: - ebs_root = self._volumeops.ebs_root_in_block_devices( + boot_from_volume = self._volumeops.ebs_root_in_block_devices( block_device_info) - if not ebs_root: + if not boot_from_volume: self._imagecache.get_cached_image(context, instance) + self._volumeops.login_storage_targets(block_device_info) + def post_live_migration_at_destination(self, ctxt, instance_ref, network_info, block_migration): LOG.debug(_("post_live_migration_at_destination called"), |