diff --git a/lib/constants.py b/lib/constants.py index 5cd8be503bbc95a46239d15829f52581abfbacf1..e5b10746a292f132c3147c9d823ef7499a246ae6 100644 --- a/lib/constants.py +++ b/lib/constants.py @@ -267,7 +267,10 @@ EXPORT_CONF_FILE = "config.ini" XEN_BOOTLOADER = _autoconf.XEN_BOOTLOADER XEN_KERNEL = _autoconf.XEN_KERNEL XEN_INITRD = _autoconf.XEN_INITRD -XEN_CMD = "xm" +XEN_CMD_XM = "xm" +XEN_CMD_XL = "xl" +# FIXME: This will be made configurable using hvparams in Ganeti 2.7 +XEN_CMD = _autoconf.XEN_CMD KVM_PATH = _autoconf.KVM_PATH KVM_KERNEL = _autoconf.KVM_KERNEL diff --git a/lib/hypervisor/hv_xen.py b/lib/hypervisor/hv_xen.py index 50abe1a0f41ae639916aeac0eadf064447485bac..a757617e15902ae986764a29bbf9c48cd39b8291 100644 --- a/lib/hypervisor/hv_xen.py +++ b/lib/hypervisor/hv_xen.py @@ -537,13 +537,19 @@ class XenHypervisor(hv_base.BaseHypervisor): " %s, cannot migrate" % (target, port)) # FIXME: migrate must be upgraded for transitioning to "xl" (xen 4.1). - # -l doesn't exist anymore - # -p doesn't exist anymore - # -C config_file must be passed + # This should be reworked in Ganeti 2.7 # ssh must recognize the key of the target host for the migration - args = [constants.XEN_CMD, "migrate", "-p", "%d" % port] - if live: - args.append("-l") + args = [constants.XEN_CMD, "migrate"] + if constants.XEN_CMD == constants.XEN_CMD_XM: + args.extend(["-p", "%d" % port]) + if live: + args.append("-l") + elif constants.XEN_CMD == constants.XEN_CMD_XL: + args.extend(["-C", self._ConfigFileName(instance.name)]) + else: + raise errors.HypervisorError("Unsupported xen command: %s" % + constants.XEN_CMD) + args.extend([instance.name, target]) result = utils.RunCmd(args) if result.failed: