Commit e43d4f9f authored by Apollon Oikonomopoulos's avatar Apollon Oikonomopoulos Committed by Balazs Lecz
Browse files

KVM: Migration bandwidth and downtime control



Introduce 2 new hypervisor options, migration_bandwidth and migration_downtime
and implement KVM migration bandwidth and downtime control.

migration_bandwidth controls KVM's maximal bandwidth during migration, in
MiB/s. Default value is 32 MiB/s, same as KVM's internal default. This option
is a global hypervisor option.

migration_downtime sets the amount of time (in ms) a KVM instance is allowed to
freeze while copying memory pages. This is useful when migrating busy guests,
as KVM's internal default of 30ms is too low for the page-copying algorithm to
converge. This is a per-instance option, with a default of 30ms, same as KVM's
internal default.
Signed-off-by: default avatarApollon Oikonomopoulos <apollon@noc.grnet.gr>
Signed-off-by: default avatarBalazs Lecz <leczb@google.com>
Reviewed-by: default avatarBalazs Lecz <leczb@google.com>
parent b73360e3
......@@ -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 = {
......
......@@ -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)
......
......@@ -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>
......
......@@ -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>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment