From dcbeccd95a328528311d70cd719a752678aff6b4 Mon Sep 17 00:00:00 2001 From: Michael Hanselmann <hansmi@google.com> Date: Fri, 13 Apr 2012 21:11:05 +0200 Subject: [PATCH] gnt-group: Add "--submit" and "--priority" to commands Signed-off-by: Michael Hanselmann <hansmi@google.com> Reviewed-by: Iustin Pop <iustin@google.com> --- lib/client/gnt_group.py | 25 ++++++++++++++----------- man/gnt-group.rst | 30 ++++++++++++++++++++++++------ 2 files changed, 38 insertions(+), 17 deletions(-) diff --git a/lib/client/gnt_group.py b/lib/client/gnt_group.py index 018b74b07..3d8e66d46 100644 --- a/lib/client/gnt_group.py +++ b/lib/client/gnt_group.py @@ -70,7 +70,7 @@ def AddGroup(opts, args): diskparams=diskparams, ipolicy=ipolicy, hv_state=hv_state, disk_state=disk_state) - SubmitOpCode(op, opts=opts) + SubmitOrSend(op, opts) def AssignNodes(opts, args): @@ -88,7 +88,7 @@ def AssignNodes(opts, args): op = opcodes.OpGroupAssignNodes(group_name=group_name, nodes=node_names, force=opts.force) - SubmitOpCode(op, opts=opts) + SubmitOrSend(op, opts) def _FmtDict(data): @@ -224,7 +224,7 @@ def RemoveGroup(opts, args): """ (group_name,) = args op = opcodes.OpGroupRemove(group_name=group_name) - SubmitOpCode(op, opts=opts) + SubmitOrSend(op, opts) def RenameGroup(opts, args): @@ -239,7 +239,7 @@ def RenameGroup(opts, args): """ group_name, new_name = args op = opcodes.OpGroupRename(group_name=group_name, new_name=new_name) - SubmitOpCode(op, opts=opts) + SubmitOrSend(op, opts) def EvacuateGroup(opts, args): @@ -254,7 +254,7 @@ def EvacuateGroup(opts, args): iallocator=opts.iallocator, target_groups=opts.to, early_release=opts.early_release) - result = SubmitOpCode(op, cl=cl, opts=opts) + result = SubmitOrSend(op, opts, cl=cl) # Keep track of submitted jobs jex = JobExecutor(cl=cl, opts=opts) @@ -277,10 +277,12 @@ commands = { "add": ( AddGroup, ARGS_ONE_GROUP, [DRY_RUN_OPT, ALLOC_POLICY_OPT, NODE_PARAMS_OPT, DISK_PARAMS_OPT, - HV_STATE_OPT, DISK_STATE_OPT] + INSTANCE_POLICY_OPTS, + HV_STATE_OPT, DISK_STATE_OPT, PRIORITY_OPT, + SUBMIT_OPT] + INSTANCE_POLICY_OPTS, "<group_name>", "Add a new node group to the cluster"), "assign-nodes": ( - AssignNodes, ARGS_ONE_GROUP + ARGS_MANY_NODES, [DRY_RUN_OPT, FORCE_OPT], + AssignNodes, ARGS_ONE_GROUP + ARGS_MANY_NODES, + [DRY_RUN_OPT, FORCE_OPT, PRIORITY_OPT, SUBMIT_OPT], "<group_name> <node>...", "Assign nodes to a group"), "list": ( ListGroups, ARGS_MANY_GROUPS, @@ -295,18 +297,19 @@ commands = { "modify": ( SetGroupParams, ARGS_ONE_GROUP, [DRY_RUN_OPT, SUBMIT_OPT, ALLOC_POLICY_OPT, NODE_PARAMS_OPT, HV_STATE_OPT, - DISK_STATE_OPT, DISK_PARAMS_OPT] + INSTANCE_POLICY_OPTS, + DISK_STATE_OPT, DISK_PARAMS_OPT, PRIORITY_OPT] + INSTANCE_POLICY_OPTS, "<group_name>", "Alters the parameters of a node group"), "remove": ( - RemoveGroup, ARGS_ONE_GROUP, [DRY_RUN_OPT], + RemoveGroup, ARGS_ONE_GROUP, [DRY_RUN_OPT, PRIORITY_OPT, SUBMIT_OPT], "[--dry-run] <group-name>", "Remove an (empty) node group from the cluster"), "rename": ( - RenameGroup, [ArgGroup(min=2, max=2)], [DRY_RUN_OPT], + RenameGroup, [ArgGroup(min=2, max=2)], + [DRY_RUN_OPT, SUBMIT_OPT, PRIORITY_OPT], "[--dry-run] <group-name> <new-name>", "Rename a node group"), "evacuate": ( EvacuateGroup, [ArgGroup(min=1, max=1)], - [TO_GROUP_OPT, IALLOCATOR_OPT, EARLY_RELEASE_OPT], + [TO_GROUP_OPT, IALLOCATOR_OPT, EARLY_RELEASE_OPT, SUBMIT_OPT, PRIORITY_OPT], "[-I <iallocator>] [--to <group>]", "Evacuate all instances within a group"), "list-tags": ( diff --git a/man/gnt-group.rst b/man/gnt-group.rst index e54dcf285..2d59c28e1 100644 --- a/man/gnt-group.rst +++ b/man/gnt-group.rst @@ -23,7 +23,7 @@ COMMANDS ADD ~~~ -| **add** +| **add** [\--submit] | [\--node-parameters=*NDPARAMS*] | [\--alloc-policy=*POLICY*] | [{-D|\--disk-parameters} *disk-template*:*disk-param*=*value*[,*disk-param*=*value*...]] @@ -71,11 +71,14 @@ The ``--specs-...`` and ``--ipol-disk-templates`` options specify instance policies on the node group, and are documented in the **gnt-cluster**(8) man page. +See **ganeti(7)** for a description of ``--submit`` and other common +options. + ASSIGN-NODES ~~~~~~~~~~~~ | **assign-nodes** -| [\--force] +| [\--force] [\--submit] | {*group*} {*node*...} Assigns one or more nodes to the specified group, moving them from their @@ -87,10 +90,13 @@ instance is an instance with a mirrored disk template, e.g. DRBD, that has the primary and secondary nodes in different node groups). You can force the operation with ``--force``. +See **ganeti(7)** for a description of ``--submit`` and other common +options. + MODIFY ~~~~~~ -| **modify** +| **modify** [\--submit] | [\--node-parameters=*NDPARAMS*] | [\--alloc-policy=*POLICY*] | [\--hypervisor-state *hvstate*] @@ -118,14 +124,20 @@ The ``--specs-...`` and ``--ipol-disk-templates`` options specify instance policies on the node group, and are documented in the **gnt-cluster**(8) man page. +See **ganeti(7)** for a description of ``--submit`` and other common +options. + REMOVE ~~~~~~ -| **remove** {*group*} +| **remove** [\--submit] {*group*} Deletes the indicated node group, which must be empty. There must always be at least one group, so the last group cannot be removed. +See **ganeti(7)** for a description of ``--submit`` and other common +options. + LIST ~~~~ @@ -170,15 +182,18 @@ List available fields for node groups. RENAME ~~~~~~ -| **rename** {*oldname*} {*newname*} +| **rename** [\--submit] {*oldname*} {*newname*} Renames a given group from *oldname* to *newname*. +See **ganeti(7)** for a description of ``--submit`` and other common +options. + EVACUATE ~~~~~~~~ -**evacuate** [\--iallocator *NAME*] [\--to *GROUP*...] {*group*} +**evacuate** [\--submit] [\--iallocator *NAME*] [\--to *GROUP*...] {*group*} This command will move all instances out of the given node group. Instances are placed in a new group by an iallocator, either given on @@ -187,6 +202,9 @@ the command line or as a cluster default. If no specific destination groups are specified using ``--to``, all groups except the evacuated group are considered. +See **ganeti(7)** for a description of ``--submit`` and other common +options. + Example:: # gnt-group evacuate -I hail --to rack4 rack1 -- GitLab