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 options.
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: Guido Trotter <[email protected]> --- daemons/ganeti-masterd | 2 +- daemons/ganeti-noded | 2 +- lib/backend.py | 18 +++++++++++++++--- lib/bootstrap.py | 5 ++--- lib/cmdlib.py | 2 +- lib/rpc.py | 4 ++-- man/gnt-cluster.sgml | 8 -------- 7 files changed, 22 insertions(+), 19 deletions(-) diff --git a/daemons/ganeti-masterd b/daemons/ganeti-masterd index e5f291a..1ba7e5d 100755 --- a/daemons/ganeti-masterd +++ b/daemons/ganeti-masterd @@ -525,7 +525,7 @@ def main(): try: # 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) diff --git a/daemons/ganeti-noded b/daemons/ganeti-noded index c1dfa1f..876321d 100755 --- a/daemons/ganeti-noded +++ b/daemons/ganeti-noded @@ -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]) @staticmethod def perspective_node_stop_master(params): diff --git a/lib/backend.py b/lib/backend.py index 456ba69..e7c4787 100644 --- a/lib/backend.py +++ b/lib/backend.py @@ -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: + daemons_params['ganeti-masterd'].append('--no-voting') + daemons_params['ganeti-masterd'].append('--yes-do-it') + for daemon in daemons_params: + cmd = [daemon] + cmd.extend(daemons_params[daemon]) + result = utils.RunCmd(cmd) if result.failed: msg = "Can't start daemon %s: %s" % (daemon, result.output) logging.error(msg) diff --git a/lib/bootstrap.py b/lib/bootstrap.py index e576c93..0ec6bd4 100644 --- a/lib/bootstrap.py +++ b/lib/bootstrap.py @@ -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(hostname.name, True) + rpc.RpcRunner.call_node_start_master(hostname.name, True, False) def InitConfig(version, cluster_config, master_node_config, @@ -457,8 +457,7 @@ def MasterFailover(no_voting=False): # cluster info cfg.Update(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" diff --git a/lib/cmdlib.py b/lib/cmdlib.py index 25e598b..c79dcdd 100644 --- a/lib/cmdlib.py +++ b/lib/cmdlib.py @@ -1440,7 +1440,7 @@ class LURenameCluster(LogicalUnit): self.proc.LogWarning(msg) finally: - 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" diff --git a/lib/rpc.py b/lib/rpc.py index ed11ae4..b02cc1a 100644 --- a/lib/rpc.py +++ b/lib/rpc.py @@ -676,14 +676,14 @@ class RpcRunner(object): [checkdict, cluster_name]) @classmethod - 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]) + [start_daemons, no_voting]) @classmethod def call_node_stop_master(cls, node, stop_daemons): diff --git a/man/gnt-cluster.sgml b/man/gnt-cluster.sgml index 2634adb..220b3c9 100644 --- a/man/gnt-cluster.sgml +++ b/man/gnt-cluster.sgml @@ -483,14 +483,6 @@ and gnt-cluster redist-conf to make sure the cluster is consistent again. </para> - <para> - 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. - </para> - </refsect2> <refsect2> -- 1.5.6.5
