from ganeti import objects
from ganeti import ssconf
+from ganeti.rpc import RpcRunner
def _InitSSHSetup(node):
"""Setup the SSH configuration for the cluster.
" range (%s). Please fix DNS or %s." %
(hostname.ip, constants.ETC_HOSTS))
- if not utils.TcpPing(hostname.ip, constants.DEFAULT_NODED_PORT,
- source=constants.LOCALHOST_IP_ADDRESS):
+ if not utils.OwnIpAddress(hostname.ip):
raise errors.OpPrereqError("Inconsistency: this host's name resolves"
" to %s,\nbut this ip address does not"
" belong to this host."
if not utils.IsValidIP(secondary_ip):
raise errors.OpPrereqError("Invalid secondary ip given")
if (secondary_ip != hostname.ip and
- (not utils.TcpPing(secondary_ip, constants.DEFAULT_NODED_PORT,
- source=constants.LOCALHOST_IP_ADDRESS))):
+ not utils.OwnIpAddress(secondary_ip)):
raise errors.OpPrereqError("You gave %s as secondary IP,"
" but it does not belong to this host." %
secondary_ip)
# start the master ip
# TODO: Review rpc call from bootstrap
- rpc.call_node_start_master(hostname.name, True)
+ RpcRunner.call_node_start_master(hostname.name, True)
def InitConfig(version, cluster_config, master_node_config,
begun in cmdlib.LUDestroyOpcode.
"""
- if not rpc.call_node_stop_master(master, True):
+ if not RpcRunner.call_node_stop_master(master, True):
logging.warning("Could not disable the master role")
- if not rpc.call_node_leave_cluster(master):
+ if not RpcRunner.call_node_leave_cluster(master):
logging.warning("Could not shutdown the node daemon and cleanup the node")
logging.info("setting master to %s, old master: %s", new_master, old_master)
- if not rpc.call_node_stop_master(old_master, True):
+ if not RpcRunner.call_node_stop_master(old_master, True):
logging.error("could 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 rpc.call_upload_file(cfg.GetNodeList(),
- constants.CLUSTER_CONF_FILE):
+ if not RpcRunner.call_upload_file(cfg.GetNodeList(),
+ constants.CLUSTER_CONF_FILE):
logging.error("could not distribute the new simple store master file"
" to the other nodes, please check.")
- if not rpc.call_node_start_master(new_master, True):
+ if not 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