Commit fb44c6db authored by Andrea Spadaccini's avatar Andrea Spadaccini Committed by Guido Trotter
Browse files

Add gnt-cluster commands to toggle the master IP

* Add activate-master-ip and deactivate-master-ip commands

* Document the new commands

lib/ lib/
* Add two opcodes and the LU that call the relevant RPCs

* Silence an error about RAPI not implemented for the two new opcodes
Signed-off-by: default avatarAndrea Spadaccini <>
Reviewed-by: default avatarMichael Hanselmann <>
Reviewed-by: default avatarGuido Trotter <>
(cherry picked from commit fb926117)


	  - kept devel-2.5 version, without the RAPI opcode checks
parent c06e0c83
......@@ -223,6 +223,32 @@ def RenameCluster(opts, args):
return 0
def ActivateMasterIp(opts, args):
"""Activates the master IP.
op = opcodes.OpClusterActivateMasterIp()
return 0
def DeactivateMasterIp(opts, args):
"""Deactivates the master IP.
if not opts.confirm:
usertext = ("This will disable the master IP. All the open connections to"
" the master IP will be closed. To reach the master you will"
" need to use its node IP."
" Continue?")
if not AskUser(usertext):
return 1
op = opcodes.OpClusterDeactivateMasterIp()
return 0
def RedistributeConfig(opts, args):
"""Forces push of the cluster configuration.
......@@ -1411,6 +1437,11 @@ commands = {
"[opts...] [args]",
"Performs an emergency power-off on given args"),
"activate-master-ip": (
ActivateMasterIp, ARGS_NONE, [], "", "Activates the master IP"),
"deactivate-master-ip": (
DeactivateMasterIp, ARGS_NONE, [CONFIRM_OPT], "",
"Deactivates the master IP"),
......@@ -3797,6 +3797,30 @@ class LUClusterRedistConf(NoHooksLU):
class LUClusterActivateMasterIp(NoHooksLU):
"""Activate the master IP on the master node.
def Exec(self, feedback_fn):
"""Activate the master IP.
master = self.cfg.GetMasterNode()
class LUClusterDeactivateMasterIp(NoHooksLU):
"""Deactivate the master IP on the master node.
def Exec(self, feedback_fn):
"""Deactivate the master IP.
master = self.cfg.GetMasterNode()
def _WaitForSync(lu, instance, disks=None, oneshot=False):
"""Sleep and poll for an instance's disk to sync.
......@@ -784,6 +784,18 @@ class OpClusterRedistConf(OpCode):
class OpClusterActivateMasterIp(OpCode):
"""Activate the master IP on the master node.
class OpClusterDeactivateMasterIp(OpCode):
"""Deactivate the master IP on the master node.
class OpQuery(OpCode):
"""Query for resources/items.
......@@ -20,6 +20,13 @@ Ganeti system.
Activates the master IP on the master node.
......@@ -89,6 +96,18 @@ primary/secondary IPs are different). Example::
This will copy the file /tmp/test from the current node to the two
named nodes.
**deactivate-master-ip** [--yes]
Deactivates the master IP on the master node.
This should be run only locally or on a connection to the node ip
directly, as a connection to the master ip will be broken by this
operation. Because of this risk it will require user confirmation
unless the ``--yes`` option is passed.
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