From 0625d08fcd90601ee94052f11c8a9d153d1733c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Nussbaumer?= <rn@google.com> Date: Thu, 31 May 2012 10:27:38 +0200 Subject: [PATCH] Support xl as a xen interface command MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit xm and xl are mostly compatible, there is just a change in migrate, which for now we simple bridge by comparing the command string. Also XEN_CMD is now set during configure time. This will then be fixed in Ganeti 2.7 when we make it an hvparams. Signed-off-by: RenΓ© Nussbaumer <rn@google.com> Reviewed-by: Iustin Pop <iustin@google.com> --- lib/constants.py | 5 ++++- lib/hypervisor/hv_xen.py | 18 ++++++++++++------ 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/lib/constants.py b/lib/constants.py index 5cd8be503..e5b10746a 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 50abe1a0f..a757617e1 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: -- GitLab