Commit 9f8f740b authored by Neal Oakey's avatar Neal Oakey Committed by Klaus Aehlig

Read if IPv6 is used directly in SshRunner

Moved check if the Primary Network is running on IPv6 into the SshRunner.
Until now SshRunner was only initialized correctly in the bootstrap.py
and not in the other 5 places.

Fixing issue #892
Signed-off-by: default avatarNeal Oakey <neal.oakey@googlemail.com>
Signed-off-by: default avatarKlaus Aehlig <aehlig@google.com>
Reviewed-by: default avatarKlaus Aehlig <aehlig@google.com>
parent 682cd5fd
......@@ -261,10 +261,11 @@ def _WaitForMasterDaemon():
" %s seconds" % _DAEMON_READY_TIMEOUT)
def _WaitForSshDaemon(hostname, port, family):
def _WaitForSshDaemon(hostname, port):
"""Wait for SSH daemon to become responsive.
"""
family = ssconf.SimpleStore().GetPrimaryIPFamily()
hostip = netutils.GetHostname(name=hostname, family=family).ip
def _CheckSshDaemon():
......@@ -344,9 +345,7 @@ def RunNodeSetupCmd(cluster_name, node, basecmd, debug, verbose,
if port is None:
port = netutils.GetDaemonPort(constants.SSH)
family = ssconf.SimpleStore().GetPrimaryIPFamily()
srun = ssh.SshRunner(cluster_name,
ipv6=(family == netutils.IP6Address.family))
srun = ssh.SshRunner(cluster_name)
scmd = srun.BuildCmd(node, constants.SSH_LOGIN_USER,
utils.ShellQuoteArgs(
utils.ShellCombineCommands(all_cmds)),
......@@ -368,7 +367,7 @@ def RunNodeSetupCmd(cluster_name, node, basecmd, debug, verbose,
raise errors.OpExecError("Command '%s' failed: %s" %
(result.cmd, result.fail_reason))
_WaitForSshDaemon(node, port, family)
_WaitForSshDaemon(node, port)
def _InitFileStorageDir(file_storage_dir):
......
......@@ -43,6 +43,7 @@ from ganeti import netutils
from ganeti import pathutils
from ganeti import vcluster
from ganeti import compat
from ganeti import ssconf
def GetUserFiles(user, mkdir=False, dircheck=True, kind=constants.SSHK_DSA,
......@@ -119,17 +120,16 @@ class SshRunner(object):
"""Wrapper for SSH commands.
"""
def __init__(self, cluster_name, ipv6=False):
def __init__(self, cluster_name):
"""Initializes this class.
@type cluster_name: str
@param cluster_name: name of the cluster
@type ipv6: bool
@param ipv6: If true, force ssh to use IPv6 addresses only
"""
self.cluster_name = cluster_name
self.ipv6 = ipv6
family = ssconf.SimpleStore().GetPrimaryIPFamily()
self.ipv6 = (family == netutils.IP6Address.family)
def _BuildSshOptions(self, batch, ask_key, use_cluster_key,
strict_host_check, private_key=None, quiet=True,
......
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