diff --git a/lib/constants.py b/lib/constants.py index 02aa6f673f7875b0a840bf15002472234d7a3613..e1e7057e4c4ef03d7703121103c2c8c79f36b50d 100644 --- a/lib/constants.py +++ b/lib/constants.py @@ -272,6 +272,15 @@ 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 +# When the Xen toolstack used is "xl", live migration requires the source host +# to connect to the target host via ssh (xl runs this command). We need to pass +# the command xl runs some extra info so that it can use Ganeti's key +# verification and not fail. Note that this string is incomplete: it must be +# filled with the cluster name before being used. +XL_SSH_CMD = ("ssh -l root -oGlobalKnownHostsFile=%s" + " -oUserKnownHostsFile=/dev/null" + " -oCheckHostIp=no -oStrictHostKeyChecking=yes" + " -oHostKeyAlias=%%s") % SSH_KNOWN_HOSTS_FILE KVM_PATH = _autoconf.KVM_PATH KVM_KERNEL = _autoconf.KVM_KERNEL diff --git a/lib/http/server.py b/lib/http/server.py index a5294964e0b58e542d5869ca492d9c771e9c5ab1..113ad1401e82e58412370d4691ed37f9634d1691 100644 --- a/lib/http/server.py +++ b/lib/http/server.py @@ -419,7 +419,8 @@ class HttpServerRequestExecutor(object): responder(compat.partial(self._ReadRequest, sock, self.READ_TIMEOUT)) if response_msg: # HttpMessage.start_line can be of different types - # pylint: disable=E1103 + # Instance of 'HttpClientToServerStartLine' has no 'code' member + # pylint: disable=E1103,E1101 logging.info("%s:%s %s %s", client_addr[0], client_addr[1], request_msg.start_line, response_msg.start_line.code) self._SendResponse(sock, request_msg, response_msg, diff --git a/lib/hypervisor/hv_xen.py b/lib/hypervisor/hv_xen.py index a757617e15902ae986764a29bbf9c48cd39b8291..6e4e22410f1158aafa11d9597c48b6b1486de881 100644 --- a/lib/hypervisor/hv_xen.py +++ b/lib/hypervisor/hv_xen.py @@ -32,6 +32,7 @@ from ganeti import utils from ganeti.hypervisor import hv_base from ganeti import netutils from ganeti import objects +from ganeti import ssconf XEND_CONFIG_FILE = "/etc/xen/xend-config.sxp" @@ -532,7 +533,8 @@ class XenHypervisor(hv_base.BaseHypervisor): port = instance.hvparams[constants.HV_MIGRATION_PORT] - if not netutils.TcpPing(target, port, live_port_needed=True): + if (constants.XEN_CMD == constants.XEN_CMD_XM and + not netutils.TcpPing(target, port, live_port_needed=True)): raise errors.HypervisorError("Remote host %s not listening on port" " %s, cannot migrate" % (target, port)) @@ -545,6 +547,8 @@ class XenHypervisor(hv_base.BaseHypervisor): if live: args.append("-l") elif constants.XEN_CMD == constants.XEN_CMD_XL: + cluster_name = ssconf.SimpleStore().GetClusterName() + args.extend(["-s", constants.XL_SSH_CMD % cluster_name]) args.extend(["-C", self._ConfigFileName(instance.name)]) else: raise errors.HypervisorError("Unsupported xen command: %s" %