Commit 93b19295 authored by Michael Hanselmann's avatar Michael Hanselmann

bootstrap.SetupNodeDaemon: Stop hardcoding bind address

Commit b43dcc5a added support for IPv6. To have the node daemon bind
to an IPv6 address on startup it changed the code to pass a static bind
address (0.0.0.0 or ::0). If a user had configured another bind address
using /etc/default/ganeti, that address would not be used until the
daemons were restarted.

By copying ssconf files before attempting to start the daemons we can
ensure that the built-in IP family detection in daemon.py works.

This fixes issue 267.
Signed-off-by: default avatarMichael Hanselmann <hansmi@google.com>
Reviewed-by: default avatarRené Nussbaumer <rn@google.com>
parent 0e1e0b6a
......@@ -656,14 +656,11 @@ def SetupNodeDaemon(cluster_name, node, ssh_key_check):
@param ssh_key_check: whether to do a strict key check
"""
family = ssconf.SimpleStore().GetPrimaryIPFamily()
sstore = ssconf.SimpleStore()
family = sstore.GetPrimaryIPFamily()
sshrunner = ssh.SshRunner(cluster_name,
ipv6=(family == netutils.IP6Address.family))
bind_address = constants.IP4_ADDRESS_ANY
if family == netutils.IP6Address.family:
bind_address = constants.IP6_ADDRESS_ANY
# set up inter-node password and certificate and restarts the node daemon
# and then connect with ssh to set password and start ganeti-noded
# note that all the below variables are sanitized at this point,
......@@ -673,9 +670,10 @@ def SetupNodeDaemon(cluster_name, node, ssh_key_check):
sshrunner.CopyFileToNode(node, pathutils.SPICE_CERT_FILE)
sshrunner.CopyFileToNode(node, pathutils.SPICE_CACERT_FILE)
sshrunner.CopyFileToNode(node, pathutils.CONFD_HMAC_KEY)
mycommand = ("%s stop-all; %s start %s -b %s" %
(pathutils.DAEMON_UTIL, pathutils.DAEMON_UTIL, constants.NODED,
utils.ShellQuote(bind_address)))
for filename in sstore.GetFileList():
sshrunner.CopyFileToNode(node, filename)
mycommand = ("%s stop-all; %s start %s" %
(pathutils.DAEMON_UTIL, pathutils.DAEMON_UTIL, constants.NODED))
result = sshrunner.Run(node, "root", mycommand, batch=False,
ask_key=ssh_key_check,
......
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