Commit 641ae041 authored by Iustin Pop's avatar Iustin Pop
Browse files

hypervisors: switch to using HV_MIGRATION_PORT



This changes KVM to use HV_MIGRATION_PORT instead of KVM_MIGRATION_PORT
and enables passing the port for Xen migrations.

Since KVM_MIGRATION_PORT is not used anymore, we stop exporting it from
constants.py.
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
parent 78411c60
......@@ -165,7 +165,6 @@ XEN_INITRD = _autoconf.XEN_INITRD
KVM_PATH = _autoconf.KVM_PATH
SOCAT_PATH = _autoconf.SOCAT_PATH
KVM_MIGRATION_PORT = _autoconf.KVM_MIGRATION_PORT
VALUE_DEFAULT = "default"
VALUE_AUTO = "auto"
......
......@@ -592,7 +592,7 @@ class KVMHypervisor(hv_base.BaseHypervisor):
"""
kvm_runtime = self._LoadKVMRuntime(instance, serialized_runtime=info)
incoming_address = (target, constants.KVM_MIGRATION_PORT)
incoming_address = (target, instance.hvparams[constants.HV_MIGRATION_PORT])
self._ExecuteKVMRuntime(instance, kvm_runtime, incoming=incoming_address)
def FinalizeMigration(self, instance, info, success):
......@@ -631,8 +631,8 @@ class KVMHypervisor(hv_base.BaseHypervisor):
if not live:
self._CallMonitorCommand(instance_name, 'stop')
migrate_command = ('migrate -d tcp:%s:%s' %
(target, constants.KVM_MIGRATION_PORT))
port = instance.hvparams[constants.HV_MIGRATION_PORT]
migrate_command = 'migrate -d tcp:%s:%s' % (target, port)
self._CallMonitorCommand(instance_name, migrate_command)
info_command = 'info migrate'
......
......@@ -402,7 +402,8 @@ class XenHypervisor(hv_base.BaseHypervisor):
"""
if self.GetInstanceInfo(instance.name) is None:
raise errors.HypervisorError("Instance not running, cannot migrate")
args = ["xm", "migrate"]
port = instance.hvparams[constants.HV_MIGRATION_PORT]
args = ["xm", "migrate", "-p", "%d" % port]
if live:
args.append("-l")
args.extend([instance.name, target])
......
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