Commit b43dcc5a11 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.
---
 lib/bootstrap.py |   14 ++++++--------
 1 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/lib/bootstrap.py b/lib/bootstrap.py
index 1c6c5f6..6470f6e 100644
--- a/lib/bootstrap.py
+++ b/lib/bootstrap.py
@@ -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,
-- 
1.7.6

Reply via email to