diff --git a/lib/constants.py b/lib/constants.py index e13d82c971320f8547dd0eb7a940c7627ca02567..2fbc0257577e3ff58319072aa85b402c4cd2dcce 100644 --- a/lib/constants.py +++ b/lib/constants.py @@ -434,6 +434,8 @@ HV_USB_MOUSE = "usb_mouse" HV_DEVICE_MODEL = "device_model" HV_INIT_SCRIPT = "init_script" HV_MIGRATION_PORT = "migration_port" +HV_MIGRATION_BANDWIDTH = "migration_bandwidth" +HV_MIGRATION_DOWNTIME = "migration_downtime" HV_USE_LOCALTIME = "use_localtime" HV_DISK_CACHE = "disk_cache" HV_SECURITY_MODEL = "security_model" @@ -465,6 +467,8 @@ HVS_PARAMETER_TYPES = { HV_DEVICE_MODEL: VTYPE_STRING, HV_INIT_SCRIPT: VTYPE_STRING, HV_MIGRATION_PORT: VTYPE_INT, + HV_MIGRATION_BANDWIDTH: VTYPE_INT, + HV_MIGRATION_DOWNTIME: VTYPE_INT, HV_USE_LOCALTIME: VTYPE_BOOL, HV_DISK_CACHE: VTYPE_STRING, HV_SECURITY_MODEL: VTYPE_STRING, @@ -732,6 +736,8 @@ HVC_DEFAULTS = { HV_DISK_TYPE: HT_DISK_PARAVIRTUAL, HV_USB_MOUSE: '', HV_MIGRATION_PORT: 8102, + HV_MIGRATION_BANDWIDTH: 32, # MiB/s + HV_MIGRATION_DOWNTIME: 30, # ms HV_USE_LOCALTIME: False, HV_DISK_CACHE: HT_CACHE_DEFAULT, HV_SECURITY_MODEL: HT_SM_NONE, @@ -748,6 +754,7 @@ HVC_DEFAULTS = { HVC_GLOBALS = frozenset([ HV_MIGRATION_PORT, + HV_MIGRATION_BANDWIDTH, ]) BEC_DEFAULTS = { diff --git a/lib/hypervisor/hv_kvm.py b/lib/hypervisor/hv_kvm.py index af04dcacb5e5cae0bcba0b67a324cbc33b7438af..51fa10f2271157115a8fe1c91b88921e0fb063ff 100644 --- a/lib/hypervisor/hv_kvm.py +++ b/lib/hypervisor/hv_kvm.py @@ -78,6 +78,8 @@ class KVMHypervisor(hv_base.BaseHypervisor): constants.HV_USB_MOUSE: hv_base.ParamInSet(False, constants.HT_KVM_VALID_MOUSE_TYPES), constants.HV_MIGRATION_PORT: hv_base.NET_PORT_CHECK, + constants.HV_MIGRATION_BANDWIDTH: hv_base.NO_CHECK, + constants.HV_MIGRATION_DOWNTIME: hv_base.NO_CHECK, constants.HV_USE_LOCALTIME: hv_base.NO_CHECK, constants.HV_DISK_CACHE: hv_base.ParamInSet(True, constants.HT_VALID_CACHE_TYPES), @@ -811,6 +813,14 @@ class KVMHypervisor(hv_base.BaseHypervisor): if not live: self._CallMonitorCommand(instance_name, 'stop') + migrate_command = ('migrate_set_speed %dm' % + instance.hvparams[constants.HV_MIGRATION_BANDWIDTH]) + self._CallMonitorCommand(instance_name, migrate_command) + + migrate_command = ('migrate_set_downtime %dms' % + instance.hvparams[constants.HV_MIGRATION_DOWNTIME]) + 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-cluster.sgml b/man/gnt-cluster.sgml index 5de8cc1164e315f0a78ef29be1e39e973805ed99..13f4f7bb6b657bb39dd560863e42260111a1e644 100644 --- a/man/gnt-cluster.sgml +++ b/man/gnt-cluster.sgml @@ -419,6 +419,21 @@ </para> </listitem> </varlistentry> + <varlistentry> + <term>migration_bandwidth</term> + <listitem> + <simpara>Valid for the KVM hypervisor.</simpara> + + <para> + This option specifies the maximum bandwidth that KVM will + use for instance live migrations. The value is in MiB/s. + </para> + + <simpara>This option is only effective with kvm versions >= 78 + and qemu-kvm versions >= 0.10.0. + </simpara> + </listitem> + </varlistentry> </variablelist> </para> diff --git a/man/gnt-instance.sgml b/man/gnt-instance.sgml index 2cf24af1459cc4d6c08f3f342982213ef8499d26..44dd9ffea542927bc54305878928db5ab18392e0 100644 --- a/man/gnt-instance.sgml +++ b/man/gnt-instance.sgml @@ -658,6 +658,24 @@ </listitem> </varlistentry> + <varlistentry> + <term>migration_downtime</term> + <listitem> + <simpara>Valid for the KVM hypervisor.</simpara> + + <simpara>The maximum amount of time (in ms) a KVM instance is + allowed to be frozen during a live migration, in order to copy + dirty memory pages. Default value is 30ms, but you may need to + increase this value for busy instances. + </simpara> + + <simpara>This option is only effective with kvm versions >= 87 + and qemu-kvm versions >= 0.11.0. + </simpara> + + </listitem> + </varlistentry> + </variablelist> </para>