diff --git a/lib/constants.py b/lib/constants.py index 1673bed290cededfe8e6a536010258801eb47c5c..5e24bfdafdcbea98e1102eb213236eb3e6f8c80d 100644 --- a/lib/constants.py +++ b/lib/constants.py @@ -197,6 +197,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 729d3f120246d040b4b91059e9b8907a0df6b1c1..574ddc99a7d240190686e39b5ecc885557dda1c5 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 57dcc20d91bccd9a1d513be061d17e5f39b80dbe..9be1a0e90e16a39df93c8efe2c4f2c04f8301134 100644 --- a/lib/hypervisor/hv_xen.py +++ b/lib/hypervisor/hv_xen.py @@ -34,6 +34,7 @@ from ganeti import netutils from ganeti import objects from ganeti import pathutils from ganeti import vcluster +from ganeti import ssconf XEND_CONFIG_FILE = vcluster.AddNodePrefix("/etc/xen/xend-config.sxp") @@ -534,7 +535,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)) @@ -547,6 +549,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" %