return 0
+def PowercycleNode(opts, args):
+ """Remove a node from the cluster.
+
+ @param opts: the command line options selected by the user
+ @type args: list
+ @param args: should contain only one element, the name of
+ the node to be removed
+ @rtype: int
+ @return: the desired exit code
+
+ """
+ node = args[0]
+ if (not opts.confirm and
+ not AskUser("Are you sure you want to hard powercycle node %s?" % node)):
+ return 2
+
+ op = opcodes.OpPowercycleNode(node_name=node, force=opts.force)
+ result = SubmitOpCode(op)
+ ToStderr(result)
+ return 0
+
+
def ListVolumes(opts, args):
"""List logical volumes on node(s).
SUBMIT_OPT,
make_option("-C", "--master-candidate", dest="master_candidate",
choices=('yes', 'no'), default=None,
+ metavar="yes|no",
help="Set the master_candidate flag on the node"),
- make_option("-O", "--offline", dest="offline",
+
+ make_option("-O", "--offline", dest="offline", metavar="yes|no",
choices=('yes', 'no'), default=None,
help="Set the offline flag on the node"),
- make_option("-D", "--drained", dest="drained",
+ make_option("-D", "--drained", dest="drained", metavar="yes|no",
choices=('yes', 'no'), default=None,
help="Set the drained flag on the node"),
],
"<instance>", "Alters the parameters of an instance"),
+ 'powercycle': (PowercycleNode, ARGS_ONE, [DEBUG_OPT, FORCE_OPT, CONFIRM_OPT],
+ "<node_name>", "Tries to forcefully powercycle a node"),
'remove': (RemoveNode, ARGS_ONE, [DEBUG_OPT],
"<node_name>", "Removes a node from the cluster"),
'volumes': (ListVolumes, ARGS_ANY,