Fixes Hyper-V live migration with attached volumes
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

n0ano/gantt,n0ano/gantt