from ganeti import hypervisor
from ganeti import bdev
from ganeti import netutils
-from ganeti import backend
from ganeti import luxi
from ganeti import jstore
from ganeti import pathutils
permitted hosts and adds the hostkey to its own known hosts.
"""
- priv_key, pub_key, auth_keys = ssh.GetUserFiles(constants.GANETI_RUNAS)
+ priv_key, pub_key, auth_keys = ssh.GetUserFiles(constants.SSH_LOGIN_USER)
for name in priv_key, pub_key:
if os.path.exists(name):
if ipcls.IsLoopback(hostname.ip):
raise errors.OpPrereqError("This host's IP (%s) resolves to a loopback"
" address. Please fix DNS or %s." %
- (hostname.ip, constants.ETC_HOSTS),
+ (hostname.ip, pathutils.ETC_HOSTS),
errors.ECODE_ENVIRON)
if not ipcls.Own(hostname.ip):
cfg = config.ConfigWriter(offline=True)
ssh.WriteKnownHostsFile(cfg, pathutils.SSH_KNOWN_HOSTS_FILE)
cfg.Update(cfg.GetClusterInfo(), logging.error)
- backend.WriteSsconfFiles(cfg.GetSsconfValues())
+ ssconf.WriteSsconfFiles(cfg.GetSsconfValues())
# set up the inter-node password and certificate
_InitGanetiServerSetup(hostname.name)
nodegroups=nodegroups,
nodes=nodes,
instances={},
+ networks={},
serial_no=1,
ctime=now, mtime=now)
utils.WriteFile(cfg_file,
@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,
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,
+ result = sshrunner.Run(node, constants.SSH_LOGIN_USER, mycommand, batch=False,
ask_key=ssh_key_check,
use_cluster_key=True,
strict_host_check=ssh_key_check)