diff --git a/daemons/ganeti-masterd b/daemons/ganeti-masterd index 7456d4e6eab0632a5b18f0b803cb45e4b77a47d9..ca864e9940c4b8d12a4caa61f9c843670d0bf169 100755 --- a/daemons/ganeti-masterd +++ b/daemons/ganeti-masterd @@ -517,7 +517,7 @@ def main(): try: # activate ip master_node = ssconf.SimpleConfigReader().GetMasterNode() - if not rpc.RpcRunner.call_node_start_master(master_node, False): + if not rpc.RpcRunner.call_node_start_master(master_node, False, False): logging.error("Can't activate master IP address") master.setup_queue() diff --git a/daemons/ganeti-noded b/daemons/ganeti-noded index 9600e30ec6576cf41f1ba360ba81e7688bba5626..1f2862f16adb0739bb6df81497097dba44d80b59 100755 --- a/daemons/ganeti-noded +++ b/daemons/ganeti-noded @@ -520,7 +520,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 bca351242a991fd77c93242a45db0fa4443ee286..afb39213acf56ca5d75cc0e0d06e6bf1cbb2a38c 100644 --- a/lib/backend.py +++ b/lib/backend.py @@ -147,7 +147,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 @@ -157,6 +157,9 @@ def StartMaster(start_daemons): @type start_daemons: boolean @param start_daemons: whther 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 """ @@ -186,8 +189,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: logging.error("Can't start daemon %s: %s", daemon, result.output) ok = False diff --git a/lib/bootstrap.py b/lib/bootstrap.py index 5ff75f83a00971dc94f39bf3c43b63f1bcf1d43d..3f96561af6ee2d9b30928403b67a66cbb7b29a92 100644 --- a/lib/bootstrap.py +++ b/lib/bootstrap.py @@ -264,7 +264,7 @@ def InitCluster(cluster_name, mac_prefix, def_bridge, # start the master ip # TODO: Review rpc call from bootstrap - 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, @@ -442,8 +442,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) if result.failed or not result.data: logging.error("Could not start the master role on the new master" " %s, please check", new_master) diff --git a/lib/cmdlib.py b/lib/cmdlib.py index cb3bb3122dc7c70fbcc462b513c4c758c830d618..fdb77a6b633b4e740b4d14bee0f6be02b0a40e1b 100644 --- a/lib/cmdlib.py +++ b/lib/cmdlib.py @@ -1403,7 +1403,7 @@ class LURenameCluster(LogicalUnit): constants.SSH_KNOWN_HOSTS_FILE, to_node) finally: - result = self.rpc.call_node_start_master(master, False) + result = self.rpc.call_node_start_master(master, False, False) if result.failed or not result.data: self.LogWarning("Could not re-enable the master role on" " the master, please restart manually.") diff --git a/lib/rpc.py b/lib/rpc.py index b50c3d16669124f7a9d8d73acabd317ff5924610..1ce44acbb8f42aabf3926e0029ad2650ac0dc54c 100644 --- a/lib/rpc.py +++ b/lib/rpc.py @@ -682,14 +682,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 98ec7db76eb603337294d680669b7b7991f990f4..f675fcabd87bd1a6d845e1fb929aa02adaca0936 100644 --- a/man/gnt-cluster.sgml +++ b/man/gnt-cluster.sgml @@ -460,14 +460,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>