from ganeti import objects
from ganeti import ssconf
-from ganeti.rpc import RpcRunner
-
def _InitSSHSetup(node):
"""Setup the SSH configuration for the cluster.
master_netdev, file_storage_dir,
secondary_ip=None,
vg_name=None, beparams=None, hvparams=None,
- enabled_hypervisors=None):
+ enabled_hypervisors=None, default_hypervisor=None):
"""Initialise the cluster.
"""
cluster_name=clustername.name,
file_storage_dir=file_storage_dir,
enabled_hypervisors=enabled_hypervisors,
+ default_hypervisor=default_hypervisor,
beparams={constants.BEGR_DEFAULT: beparams},
hvparams=hvparams,
)
# start the master ip
# TODO: Review rpc call from bootstrap
- RpcRunner.call_node_start_master(hostname.name, True)
+ rpc.RpcRunner.call_node_start_master(hostname.name, True)
def InitConfig(version, cluster_config, master_node_config,
begun in cmdlib.LUDestroyOpcode.
"""
- if not RpcRunner.call_node_stop_master(master, True):
+ if not rpc.RpcRunner.call_node_stop_master(master, True):
logging.warning("Could not disable the master role")
- if not RpcRunner.call_node_leave_cluster(master):
+ if not rpc.RpcRunner.call_node_leave_cluster(master):
logging.warning("Could not shutdown the node daemon and cleanup the node")
gntpass = utils.GetNodeDaemonPassword()
if not re.match('^[a-zA-Z0-9.]{1,64}$', gntpass):
raise errors.OpExecError("ganeti password corruption detected")
- f = open(constants.SSL_CERT_FILE)
- try:
- gntpem = f.read(8192)
- finally:
- f.close()
+ gntpem = utils.ReadFile(constants.SSL_CERT_FILE)
# in the base64 pem encoding, neither '!' nor '.' are valid chars,
# so we use this to detect an invalid certificate; as long as the
# cert doesn't contain this, the here-document will be correctly
logging.info("Setting master to %s, old master: %s", new_master, old_master)
- if not RpcRunner.call_node_stop_master(old_master, True):
+ if not rpc.RpcRunner.call_node_stop_master(old_master, True):
logging.error("Could not disable the master role on the old master"
" %s, please disable manually", old_master)
# Here we have a phase where no master should be running
- if not RpcRunner.call_upload_file(cfg.GetNodeList(),
+ if not rpc.RpcRunner.call_upload_file(cfg.GetNodeList(),
constants.CLUSTER_CONF_FILE):
logging.error("Could not distribute the new configuration"
" to the other nodes, please check.")
- if not RpcRunner.call_node_start_master(new_master, True):
+ if not rpc.RpcRunner.call_node_start_master(new_master, True):
logging.error("Could not start the master role on the new master"
" %s, please check", new_master)
rcode = 1