(2.10) Some fixes in _GenerateKVMBlockDevicesOptions()
[ganeti-local] / lib / ssh.py
index dba13df..c694341 100644 (file)
@@ -183,6 +183,8 @@ class SshRunner:
 
     if self.ipv6:
       options.append("-6")
+    else:
+      options.append("-4")
 
     return options
 
@@ -328,6 +330,10 @@ def WriteKnownHostsFile(cfg, file_name):
   """Writes the cluster-wide equally known_hosts file.
 
   """
-  utils.WriteFile(file_name, mode=0600,
-                  data="%s ssh-rsa %s\n" % (cfg.GetClusterName(),
-                                            cfg.GetHostKey()))
+  data = ""
+  if cfg.GetRsaHostKey():
+    data += "%s ssh-rsa %s\n" % (cfg.GetClusterName(), cfg.GetRsaHostKey())
+  if cfg.GetDsaHostKey():
+    data += "%s ssh-dss %s\n" % (cfg.GetClusterName(), cfg.GetDsaHostKey())
+
+  utils.WriteFile(file_name, mode=0600, data=data)