Commit 78411c60 authored by Iustin Pop's avatar Iustin Pop
Browse files

Introduce HV_MIGRATION_PORT hypervisor parameter



This parameter will replace the direct use of KVM_MIGRATION_PORT and the
implicit use of the Xen migration port.

While it doesn't make sense to change this at instance level, we don't
have any other infrastructure for cluster-wide hypervisor parameters, so
we add it here (and document that it usually shouldn't be changed on a
per-instance basis).
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
parent 58d38b02
......@@ -390,6 +390,7 @@ HV_SERIAL_CONSOLE = "serial_console"
HV_USB_MOUSE = "usb_mouse"
HV_DEVICE_MODEL = "device_model"
HV_INIT_SCRIPT = "init_script"
HV_MIGRATION_PORT = "migration_port"
HVS_PARAMETER_TYPES = {
HV_BOOT_ORDER: VTYPE_STRING,
......@@ -414,6 +415,7 @@ HVS_PARAMETER_TYPES = {
HV_USB_MOUSE: VTYPE_STRING,
HV_DEVICE_MODEL: VTYPE_STRING,
HV_INIT_SCRIPT: VTYPE_STRING,
HV_MIGRATION_PORT: VTYPE_INT,
}
HVS_PARAMETERS = frozenset(HVS_PARAMETER_TYPES.keys())
......@@ -607,6 +609,7 @@ HVC_DEFAULTS = {
HV_INITRD_PATH: '',
HV_ROOT_PATH: '/dev/sda1',
HV_KERNEL_ARGS: 'ro',
HV_MIGRATION_PORT: 8002,
},
HT_XEN_HVM: {
HV_BOOT_ORDER: "cd",
......@@ -619,6 +622,7 @@ HVC_DEFAULTS = {
HV_PAE: True,
HV_KERNEL_PATH: "/usr/lib/xen/boot/hvmloader",
HV_DEVICE_MODEL: "/usr/lib/xen/bin/qemu-dm",
HV_MIGRATION_PORT: 8002,
},
HT_KVM: {
HV_KERNEL_PATH: "/boot/vmlinuz-2.6-kvmU",
......@@ -637,6 +641,7 @@ HVC_DEFAULTS = {
HV_NIC_TYPE: HT_NIC_PARAVIRTUAL,
HV_DISK_TYPE: HT_DISK_PARAVIRTUAL,
HV_USB_MOUSE: '',
HV_MIGRATION_PORT: _autoconf.KVM_MIGRATION_PORT,
},
HT_FAKE: {
},
......
......@@ -62,6 +62,8 @@ REQ_FILE_CHECK = (True, ) + _FILE_CHECK
OPT_FILE_CHECK = (False, ) + _FILE_CHECK
REQ_DIR_CHECK = (True, ) + _DIR_CHECK
OPT_DIR_CHECK = (False, ) + _DIR_CHECK
NET_PORT_CHECK = (True, lambda x: x > 0 and x < 65535, "invalid port number",
None, None)
# no checks at all
NO_CHECK = (False, None, None, None, None)
......
......@@ -72,6 +72,7 @@ class KVMHypervisor(hv_base.BaseHypervisor):
hv_base.ParamInSet(True, constants.HT_KVM_VALID_DISK_TYPES),
constants.HV_USB_MOUSE:
hv_base.ParamInSet(False, constants.HT_KVM_VALID_MOUSE_TYPES),
constants.HV_MIGRATION_PORT: hv_base.NET_PORT_CHECK,
}
_MIGRATION_STATUS_RE = re.compile('Migration\s+status:\s+(\w+)',
......@@ -556,8 +557,8 @@ class KVMHypervisor(hv_base.BaseHypervisor):
# to shutdown and restart.
pidfile, pid, alive = self._InstancePidAlive(instance.name)
if not alive:
raise errors.HypervisorError("Failed to reboot instance %s: not running" %
(instance.name))
raise errors.HypervisorError("Failed to reboot instance %s:"
" not running" % instance.name)
# StopInstance will delete the saved KVM runtime so:
# ...first load it...
kvm_runtime = self._LoadKVMRuntime(instance)
......
......@@ -445,6 +445,7 @@ class XenPvmHypervisor(XenHypervisor):
constants.HV_INITRD_PATH: hv_base.OPT_FILE_CHECK,
constants.HV_ROOT_PATH: hv_base.REQUIRED_CHECK,
constants.HV_KERNEL_ARGS: hv_base.NO_CHECK,
constants.HV_MIGRATION_PORT: hv_base.NET_PORT_CHECK,
}
@classmethod
......@@ -542,6 +543,7 @@ class XenHvmHypervisor(XenHypervisor):
constants.HV_KERNEL_PATH: hv_base.REQ_FILE_CHECK,
constants.HV_DEVICE_MODEL: hv_base.REQ_FILE_CHECK,
constants.HV_VNC_PASSWORD_FILE: hv_base.REQ_FILE_CHECK,
constants.HV_MIGRATION_PORT: hv_base.NET_PORT_CHECK,
}
@classmethod
......
......@@ -504,7 +504,23 @@
emulate a serial console for the instance.</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>migration_port</term>
<listitem>
<simpara>Valid for the Xen PVM and KVM hypervisors.</simpara>
<para>
This options specifies the TCP port to use for
live-migration. Note that this shouldn't (usually)
be changed at the instance level, but only at
cluster-level.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
<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