Commit 3583908a authored by Guido Trotter's avatar Guido Trotter
Browse files

Extend call_node_start_master rpc with no_voting

When the parameter is set to True and start_daemons is also True,
ganeti-masterd will be started with the new --no-voting --yes-do-it

This new option is set to True only on masterfailover, when no_voting is
used. This changed the behavior from 2.0, where we didn't start the
master daemon at all, when this option was used.

The manpage is also updated to remove the 2.0 only change.
Signed-off-by: default avatarGuido Trotter <>
Reviewed-by: default avatarIustin Pop <>
parent 2f7140ba
......@@ -525,7 +525,7 @@ def main():
# activate ip
master_node = ssconf.SimpleConfigReader().GetMasterNode()
result = rpc.RpcRunner.call_node_start_master(master_node, False)
result = rpc.RpcRunner.call_node_start_master(master_node, False, False)
msg = result.RemoteFailMsg()
if msg:
logging.error("Can't activate master IP address: %s", msg)
......@@ -529,7 +529,7 @@ class NodeHttpServer(http.server.HttpServer):
"""Promote this node to master status.
return backend.StartMaster(params[0])
return backend.StartMaster(params[0], params[1])
def perspective_node_stop_master(params):
......@@ -177,7 +177,7 @@ def GetMasterInfo():
return (master_netdev, master_ip, master_node)
def StartMaster(start_daemons):
def StartMaster(start_daemons, no_voting):
"""Activate local node as master node.
The function will always try activate the IP address of the master
......@@ -187,6 +187,9 @@ def StartMaster(start_daemons):
@type start_daemons: boolean
@param start_daemons: whether to also start the master
daemons (ganeti-masterd and ganeti-rapi)
@type no_voting: boolean
@param no_voting: whether to start ganeti-masterd without a node vote
(if start_daemons is True), but still non-interactively
@rtype: None
......@@ -217,8 +220,17 @@ def StartMaster(start_daemons):
# and now start the master and rapi daemons
if start_daemons:
for daemon in 'ganeti-masterd', 'ganeti-rapi':
result = utils.RunCmd([daemon])
daemons_params = {
'ganeti-masterd': [],
'ganeti-rapi': [],
if no_voting:
for daemon in daemons_params:
cmd = [daemon]
result = utils.RunCmd(cmd)
if result.failed:
msg = "Can't start daemon %s: %s" % (daemon, result.output)
......@@ -275,7 +275,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)
rpc.RpcRunner.call_node_start_master(, True, False)
def InitConfig(version, cluster_config, master_node_config,
......@@ -457,8 +457,7 @@ def MasterFailover(no_voting=False):
# cluster info
# 2.0.X: Don't start the master if no_voting is true
result = rpc.RpcRunner.call_node_start_master(new_master, not no_voting)
result = rpc.RpcRunner.call_node_start_master(new_master, True, no_voting)
msg = result.RemoteFailMsg()
if msg:
logging.error("Could not start the master role on the new master"
......@@ -1440,7 +1440,7 @@ class LURenameCluster(LogicalUnit):
result = self.rpc.call_node_start_master(master, False)
result = self.rpc.call_node_start_master(master, False, False)
msg = result.fail_msg
if msg:
self.LogWarning("Could not re-enable the master role on"
......@@ -676,14 +676,14 @@ class RpcRunner(object):
[checkdict, cluster_name])
def call_node_start_master(cls, node, start_daemons):
def call_node_start_master(cls, node, start_daemons, no_voting):
"""Tells a node to activate itself as a master.
This is a single-node call.
return cls._StaticSingleNodeCall(node, "node_start_master",
[start_daemons, no_voting])
def call_node_stop_master(cls, node, stop_daemons):
......@@ -483,14 +483,6 @@
and gnt-cluster redist-conf to make sure the cluster is consistent again.
In version 2.0.X ganeti-masterd will not be able to start if
masterfailover is called with the --no-voting option (which, again,
should only be used on 2 nodes clusters with the former master being
down). In that case just start it manually passing --no-voting to it
as well, until you have restored cluster redundancy.
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