Commit 919852da authored by Adeodato Simo's avatar Adeodato Simo

Add `gnt-group assign-nodes` in the CLI

Signed-off-by: default avatarAdeodato Simo <dato@google.com>
Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
parent 8ec505dd
......@@ -50,6 +50,24 @@ def AddGroup(opts, args):
SubmitOpCode(op, opts=opts)
def AssignNodes(opts, args):
"""Assign nodes to a group.
@param opts: the command line options selected by the user
@type args: list
@param args: args[0]: group to assign nodes to; args[1:]: nodes to assign
@rtype: int
@return: the desired exit code
"""
group_name = args[0]
node_names = args[1:]
op = opcodes.OpAssignGroupNodes(group_name=group_name, nodes=node_names,
force=opts.force)
SubmitOpCode(op, opts=opts)
def ListGroups(opts, args):
"""List node groups and their properties.
......@@ -148,6 +166,9 @@ commands = {
"add": (
AddGroup, ARGS_ONE_GROUP, [DRY_RUN_OPT, ALLOC_POLICY_OPT, NODE_PARAMS_OPT],
"<group_name>", "Add a new node group to the cluster"),
"assign-nodes": (
AssignNodes, ARGS_ONE_GROUP + ARGS_MANY_NODES, [DRY_RUN_OPT, FORCE_OPT],
"<group_name> <node>...", "Assign nodes to a group"),
"list": (
ListGroups, ARGS_MANY_GROUPS,
[NOHDR_OPT, SEP_OPT, FIELDS_OPT],
......
......@@ -29,7 +29,7 @@ ADD
| {*group*}
Creates a new group with the given name. The node group will be
initially empty.
initially empty; to add nodes to it, use ``gnt-group assign-nodes``.
The ``--node-parameters`` option allows you to set default node
parameters for nodes in the group. Please see **ganeti**(7) for more
......@@ -52,6 +52,21 @@ preferred
(this is the default). Note that prioritization among groups in this
state will be deferred to the iallocator plugin that's being used.
ASSIGN-NODES
~~~~~~~~~~~~
| **assign-nodes**
| [--force]
| {*group*} {*node*...}
Assigns one or more nodes to the specified group, moving them from their
original group (or groups).
By default, this command will refuse to proceed if the move would split
between groups any instance that was not previously split (a split
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``.
MODIFY
~~~~~~
......
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