lib/client/gnt_cluster.py:
* Add activate-master-ip and deactivate-master-ip commands
man/gnt-cluster.rst:
* Document the new commands
lib/opcodes.py lib/cmdlib.py
* Add two opcodes and the LU that call the relevant RPCs
test/docs_unittest.py
* Silence an error about RAPI not implemented for the two new opcodes
Signed-off-by: Andrea Spadaccini <spadaccio@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
(cherry picked from commit
fb926117f623a61776b90e992126f953679ca066)
Conflicts:
test/docs_unittest.py
- kept devel-2.5 version, without the RAPI opcode checks
return 0
+def ActivateMasterIp(opts, args):
+ """Activates the master IP.
+
+ """
+ op = opcodes.OpClusterActivateMasterIp()
+ SubmitOpCode(op)
+ 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()
+ SubmitOpCode(op)
+ return 0
+
+
def RedistributeConfig(opts, args):
"""Forces push of the cluster configuration.
SHUTDOWN_TIMEOUT_OPT, POWER_DELAY_OPT],
"[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"),
}
_RedistributeAncillaryFiles(self)
+class LUClusterActivateMasterIp(NoHooksLU):
+ """Activate the master IP on the master node.
+
+ """
+ def Exec(self, feedback_fn):
+ """Activate the master IP.
+
+ """
+ master = self.cfg.GetMasterNode()
+ self.rpc.call_node_activate_master_ip(master)
+
+
+class LUClusterDeactivateMasterIp(NoHooksLU):
+ """Deactivate the master IP on the master node.
+
+ """
+ def Exec(self, feedback_fn):
+ """Deactivate the master IP.
+
+ """
+ master = self.cfg.GetMasterNode()
+ self.rpc.call_node_deactivate_master_ip(master)
+
+
def _WaitForSync(lu, instance, disks=None, oneshot=False):
"""Sleep and poll for an instance's disk to sync.
"""
+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.
COMMANDS
--------
+ACTIVATE-MASTER-IP
+~~~~~~~~~~~~~~~~~~
+
+**activate-master-ip**
+
+Activates the master IP on the master node.
+
ADD-TAGS
~~~~~~~~
This will copy the file /tmp/test from the current node to the two
named nodes.
+DEACTIVATE-MASTER-IP
+~~~~~~~~~~~~~~~~~~~~
+
+**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.
+
DESTROY
~~~~~~~