Commit b726aff0 authored by Iustin Pop's avatar Iustin Pop
Browse files

Convert node_start_master to new style result

This is used in multiple places outside, so it's a more
interesting patch.
Signed-off-by: default avatarIustin Pop <>
Reviewed-by: default avatarGuido Trotter <>
parent 6f68a739
......@@ -520,8 +520,10 @@ def main():
# activate ip
master_node = ssconf.SimpleConfigReader().GetMasterNode()
if not rpc.RpcRunner.call_node_start_master(master_node, False):
logging.error("Can't activate master IP address")
result = rpc.RpcRunner.call_node_start_master(master_node, False)
msg = result.RemoteFailMsg()
if msg:
logging.error("Can't activate master IP address: %s", msg)
......@@ -189,25 +189,27 @@ def StartMaster(start_daemons):
@rtype: None
ok = True
master_netdev, master_ip, _ = GetMasterInfo()
if not master_netdev:
return False
return False, "Cluster configuration incomplete, cannot read ssconf files"
payload = []
if utils.TcpPing(master_ip, constants.DEFAULT_NODED_PORT):
if utils.OwnIpAddress(master_ip):
# we already have the ip:
logging.debug("Already started")
logging.debug("Master IP already configured, doing nothing")
logging.error("Someone else has the master ip, not activating")
ok = False
msg = "Someone else has the master ip, not activating"
result = utils.RunCmd(["ip", "address", "add", "%s/32" % master_ip,
"dev", master_netdev, "label",
"%s:0" % master_netdev])
if result.failed:
logging.error("Can't activate master IP: %s", result.output)
ok = False
msg = "Can't activate master IP: %s" % result.output
result = utils.RunCmd(["arping", "-q", "-U", "-c 3", "-I", master_netdev,
"-s", master_ip, master_ip])
......@@ -218,9 +220,11 @@ def StartMaster(start_daemons):
for daemon in 'ganeti-masterd', 'ganeti-rapi':
result = utils.RunCmd([daemon])
if result.failed:
logging.error("Can't start daemon %s: %s", daemon, result.output)
ok = False
return ok
msg = "Can't start daemon %s: %s" % (daemon, result.output)
return not payload, "; ".join(payload)
def StopMaster(stop_daemons):
......@@ -271,6 +271,7 @@ def InitCluster(cluster_name, mac_prefix,
# start the master ip
# TODO: Review rpc call from bootstrap
# TODO: Warn on failed start master
rpc.RpcRunner.call_node_start_master(, True)
......@@ -444,9 +445,10 @@ def MasterFailover():
result = rpc.RpcRunner.call_node_start_master(new_master, True)
if result.failed or not
msg = result.RemoteFailMsg()
if msg:
logging.error("Could not start the master role on the new master"
" %s, please check", new_master)
" %s, please check: %s", new_master, msg)
rcode = 1
return rcode
......@@ -1425,9 +1425,10 @@ class LURenameCluster(LogicalUnit):
result = self.rpc.call_node_start_master(master, False)
if result.failed or not
msg = result.RemoteFailMsg()
if msg:
self.LogWarning("Could not re-enable the master role on"
" the master, please restart manually.")
" the master, please restart manually: %s", msg)
def _RecursiveCheckIfLVMBased(disk):
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment