Commit 38db4e7c authored by Adam Ingrassia's avatar Adam Ingrassia Committed by Bernardo Dal Seno

Front-end and doc to use allocator in recreate-disks

The recreate-disks command no longer requires an explicit list of nodes.
Signed-off-by: default avatarAdam Ingrassia <api@google.com>
Signed-off-by: default avatarBernardo Dal Seno <bdalseno@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent 3d091af0
......@@ -667,7 +667,9 @@ command::
$ gnt-instance recreate-disks %INSTANCE%
Note that this will fail if the disks already exists.
Note that this will fail if the disks already exists. The instance can
be assigned to new nodes automatically by specifying an iallocator
through the ``--iallocator`` option.
Conversion of an instance's disk type
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
......
......@@ -630,6 +630,9 @@ def RecreateDisks(opts, args):
# LUInstanceRecreateDisks, but it'd be nice to have in the client)
if opts.node:
if opts.iallocator:
msg = "At most one of either --nodes or --iallocator can be passed"
raise errors.OpPrereqError(msg, errors.ECODE_INVAL)
pnode, snode = SplitNodeOption(opts.node)
nodes = [pnode]
if snode is not None:
......@@ -638,7 +641,8 @@ def RecreateDisks(opts, args):
nodes = []
op = opcodes.OpInstanceRecreateDisks(instance_name=instance_name,
disks=disks, nodes=nodes)
disks=disks, nodes=nodes,
iallocator=opts.iallocator)
SubmitOrSend(op, opts)
return 0
......@@ -1638,7 +1642,8 @@ commands = {
"[-f] <instance>", "Deactivate an instance's disks"),
"recreate-disks": (
RecreateDisks, ARGS_ONE_INSTANCE,
[SUBMIT_OPT, DISK_OPT, NODE_PLACEMENT_OPT, DRY_RUN_OPT, PRIORITY_OPT],
[SUBMIT_OPT, DISK_OPT, NODE_PLACEMENT_OPT, DRY_RUN_OPT, PRIORITY_OPT,
IALLOCATOR_OPT],
"<instance>", "Recreate an instance's disks"),
"grow-disk": (
GrowDisk,
......
......@@ -1428,7 +1428,8 @@ instance.
RECREATE-DISKS
^^^^^^^^^^^^^^
| **recreate-disks** [\--submit] [-n node1:[node2]]
| **recreate-disks** [\--submit]
| [{-n node1:[node2] \| {-I\|\--iallocator *name*}}]
| [\--disk=*N*[:[size=*VAL*][,mode=*ro\|rw*]]] {*instance*}
Recreates all or a subset of disks of the given instance.
......@@ -1454,6 +1455,11 @@ passed must equal the number of nodes that the instance currently
has. Note that changing nodes is only allowed when all disks are
replaced, e.g. when no ``--disk`` option is passed.
Another method of chosing which nodes to place the instance on is by
using the specified iallocator, passing the ``--iallocator`` option.
The primary and secondary nodes will be chosen by the specified
iallocator plugin.
See **ganeti(7)** for a description of ``--submit`` and other common
options.
......
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