Latest QEMU versions support various migration capabilities. Each
can be enabled/disabled with 'migrate_set_capability' monitor
command.

Version 1.7.0 defines x-rdma-pin-all, auto-converge, zero-blocks,
and xbzrle migration capabilities.

Since migration capabilities are more than one, and because hvparams
accept only strings/integers and not dicts we decide to provide
the capabilities that should be on via a ":" separated string.

In other words one can use the following to enable xbzrle and
auto-converge:

-H kvm:migration_caps=xbzrle:auto-converge

IMPORTANT: xbzrle may result to BSOD for instances running
Windows 2008r8 on drbd.

Update man page of gnt-instance to include the new hvparam.

Signed-off-by: Dimitris Aragiorgis <[email protected]>
---
 lib/hypervisor/hv_kvm.py |    9 +++++++++
 man/gnt-instance.rst     |   10 ++++++++++
 src/Ganeti/Constants.hs  |    5 +++++
 3 files changed, 24 insertions(+)

diff --git a/lib/hypervisor/hv_kvm.py b/lib/hypervisor/hv_kvm.py
index 40a54e3..d9dae52 100644
--- a/lib/hypervisor/hv_kvm.py
+++ b/lib/hypervisor/hv_kvm.py
@@ -115,6 +115,8 @@ _RUNTIME_ENTRY = {
   constants.HOTPLUG_TARGET_DISK: lambda d, e: (d, e, None)
   }
 
+_MIGRATION_CAPS_DELIM = ":"
+
 
 def _GenerateDeviceKVMId(dev_type, dev):
   """Helper function to generate a unique device name used by KVM
@@ -743,6 +745,7 @@ class KVMHypervisor(hv_base.BaseHypervisor):
     constants.HV_VGA: hv_base.NO_CHECK,
     constants.HV_KVM_EXTRA: hv_base.NO_CHECK,
     constants.HV_KVM_MACHINE_VERSION: hv_base.NO_CHECK,
+    constants.HV_KVM_MIGRATION_CAPS: hv_base.NO_CHECK,
     constants.HV_VNET_HDR: hv_base.NO_CHECK,
     }
 
@@ -2574,6 +2577,12 @@ class KVMHypervisor(hv_base.BaseHypervisor):
                        instance.hvparams[constants.HV_MIGRATION_DOWNTIME])
     self._CallMonitorCommand(instance_name, migrate_command)
 
+    migration_caps = instance.hvparams[constants.HV_KVM_MIGRATION_CAPS]
+    if migration_caps:
+      for c in migration_caps.split(_MIGRATION_CAPS_DELIM):
+        migrate_command = ("migrate_set_capability %s on" % c)
+        self._CallMonitorCommand(instance_name, migrate_command)
+
     migrate_command = "migrate -d tcp:%s:%s" % (target, port)
     self._CallMonitorCommand(instance_name, migrate_command)
 
diff --git a/man/gnt-instance.rst b/man/gnt-instance.rst
index 1b1d995..3d667e6 100644
--- a/man/gnt-instance.rst
+++ b/man/gnt-instance.rst
@@ -804,6 +804,16 @@ machine\_version
     machine version (due to e.g. outdated drivers). In case it's not set
     the default version supported by your version of kvm is used.
 
+migration\_caps
+    Valid for the KVM hypervisor.
+
+    Enable specific migration capabilities by providing a ":" separated
+    list of supported capabilites. QEMU version 1.7.0 defines
+    x-rdma-pin-all, auto-converge, zero-blocks, and xbzrle. Please note
+    that while a combination of xbzrle and auto-converge might speed up
+    the migration process significantly, the first may cause BSOD on
+    Windows8r2 instances running on drbd.
+
 kvm\_path
     Valid for the KVM hypervisor.
 
diff --git a/src/Ganeti/Constants.hs b/src/Ganeti/Constants.hs
index 0742124..c2e3e36 100644
--- a/src/Ganeti/Constants.hs
+++ b/src/Ganeti/Constants.hs
@@ -1556,6 +1556,9 @@ hvKvmFloppyImagePath = "floppy_image_path"
 hvKvmMachineVersion :: String
 hvKvmMachineVersion = "machine_version"
 
+hvKvmMigrationCaps :: String
+hvKvmMigrationCaps = "migration_caps"
+
 hvKvmPath :: String
 hvKvmPath = "kvm_path"
 
@@ -1741,6 +1744,7 @@ hvsParameterTypes = Map.fromList
   , (hvKvmFlag,                         VTypeString)
   , (hvKvmFloppyImagePath,              VTypeString)
   , (hvKvmMachineVersion,               VTypeString)
+  , (hvKvmMigrationCaps,                VTypeString)
   , (hvKvmPath,                         VTypeString)
   , (hvKvmSpiceAudioCompr,              VTypeBool)
   , (hvKvmSpiceBind,                    VTypeString)
@@ -3776,6 +3780,7 @@ hvcDefaults =
           , (hvVga,                             PyValueEx "")
           , (hvKvmExtra,                        PyValueEx "")
           , (hvKvmMachineVersion,               PyValueEx "")
+          , (hvKvmMigrationCaps,                PyValueEx "")
           , (hvVnetHdr,                         PyValueEx True)])
   , (Fake, Map.fromList [(hvMigrationMode, PyValueEx htMigrationLive)])
   , (Chroot, Map.fromList [(hvInitScript, PyValueEx "/ganeti-chroot")])
-- 
1.7.10.4

Reply via email to