Commit 4c61d894 authored by Iustin Pop's avatar Iustin Pop
Browse files

Add the auto_promote option to cli and gnt-node



This allows one to cleanly set a node offline and promote as needed
other nodes.
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
parent 601908d0
......@@ -45,6 +45,7 @@ __all__ = [
# Command line options
"ALLOCATABLE_OPT",
"ALL_OPT",
"AUTO_PROMOTE_OPT",
"AUTO_REPLACE_OPT",
"BACKEND_OPT",
"CLEANUP_OPT",
......@@ -708,6 +709,11 @@ ON_SECONDARY_OPT = cli_option("-s", "--on-secondary", dest="on_secondary",
help="Replace the disk(s) on the secondary"
" node (only for the drbd template)")
AUTO_PROMOTE_OPT = cli_option("--auto-promote", dest="auto_promote",
default=False, action="store_true",
help="Lock all nodes and auto-promote as needed"
" to MC status")
AUTO_REPLACE_OPT = cli_option("-a", "--auto", dest="auto",
default=False, action="store_true",
help="Automatically replace faulty disks"
......
......@@ -596,6 +596,7 @@
<arg>--master-candidate=<option>yes|no</option></arg>
<arg>--drained=<option>yes|no</option></arg>
<arg>--offline=<option>yes|no</option></arg>
<arg>--auto-promote</arg>
<arg choice="req"><replaceable>node</replaceable></arg>
</cmdsynopsis>
......@@ -610,10 +611,15 @@
</para>
<para>
In case a node is demoted from the master candidate role, but
there are not enough new nodes for this case, the operation
will be refused. To override this check, pass the
<option>--force</option> option.
In case a node is demoted from the master candidate role, the
operation will be refused unless you pass
the <option>--auto-promote</option> option. This option will
cause the operation to lock all cluster nodes (thus it will
not be able to run in parallel with most other jobs), but it
allows automated maintenance of the cluster candidate pool. If
locking all cluster node is too expensive, another option is
to promote manually another node to master candidate before
demoting the current one.
</para>
<para>
......
......@@ -635,7 +635,8 @@ def SetNodeParams(opts, args):
master_candidate=candidate,
offline=offline,
drained=drained,
force=opts.force)
force=opts.force,
auto_promote=opts.auto_promote)
# even if here we process the result, we allow submit only
result = SubmitOrSend(op, opts)
......@@ -681,7 +682,8 @@ commands = {
(utils.CommaJoin(_LIST_HEADERS), utils.CommaJoin(_LIST_DEF_FIELDS))),
'modify': (
SetNodeParams, ARGS_ONE_NODE,
[FORCE_OPT, SUBMIT_OPT, MC_OPT, DRAINED_OPT, OFFLINE_OPT],
[FORCE_OPT, SUBMIT_OPT, MC_OPT, DRAINED_OPT, OFFLINE_OPT,
AUTO_PROMOTE_OPT],
"<node_name>", "Alters the parameters of a node"),
'powercycle': (
PowercycleNode, ARGS_ONE_NODE,
......
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