From: Bernardo Dal Seno Date: Mon, 6 May 2013 10:51:26 +0000 (+0200) Subject: Add "spindles" option to instance disk creation commands X-Git-Tag: v2.9.0beta1~320 X-Git-Url: https://code.grnet.gr/git/ganeti-local/commitdiff_plain/c615590c1108e44d1f3ed89ab7b1a57765187c4b Add "spindles" option to instance disk creation commands The option is parsed but ignored, for the moment. Signed-off-by: Bernardo Dal Seno Reviewed-by: Thomas Thrainer --- diff --git a/lib/cli.py b/lib/cli.py index 32ef069..0bddf43 100644 --- a/lib/cli.py +++ b/lib/cli.py @@ -2647,6 +2647,9 @@ def GenericInstanceCreate(mode, opts, args): raise errors.OpPrereqError("Invalid disk size for disk %d: %s" % (didx, err), errors.ECODE_INVAL) elif constants.IDISK_ADOPT in ddict: + if constants.IDISK_SPINDLES in ddict: + raise errors.OpPrereqError("spindles is not a valid option when" + " adopting a disk", errors.ECODE_INVAL) if mode == constants.INSTANCE_IMPORT: raise errors.OpPrereqError("Disk adoption not allowed for instance" " import", errors.ECODE_INVAL) diff --git a/lib/cmdlib/instance_storage.py b/lib/cmdlib/instance_storage.py index cc64a70..bf1b8ad 100644 --- a/lib/cmdlib/instance_storage.py +++ b/lib/cmdlib/instance_storage.py @@ -526,6 +526,7 @@ class LUInstanceRecreateDisks(LogicalUnit): _MODIFYABLE = compat.UniqueFrozenset([ constants.IDISK_SIZE, constants.IDISK_MODE, + constants.IDISK_SPINDLES, ]) # New or changed disk parameters may have different semantics diff --git a/lib/constants.py b/lib/constants.py index d4022b2..c17261a 100644 --- a/lib/constants.py +++ b/lib/constants.py @@ -1326,6 +1326,7 @@ NICS_PARAMETERS = frozenset(NICS_PARAMETER_TYPES.keys()) # IDISK_* constants are used in opcodes, to create/change disks IDISK_SIZE = "size" +IDISK_SPINDLES = "spindles" IDISK_MODE = "mode" IDISK_ADOPT = "adopt" IDISK_VG = "vg" @@ -1334,6 +1335,7 @@ IDISK_PROVIDER = "provider" IDISK_NAME = "name" IDISK_PARAMS_TYPES = { IDISK_SIZE: VTYPE_SIZE, + IDISK_SPINDLES: VTYPE_INT, IDISK_MODE: VTYPE_STRING, IDISK_ADOPT: VTYPE_STRING, IDISK_VG: VTYPE_STRING, diff --git a/man/gnt-instance.rst b/man/gnt-instance.rst index 793b664..0942c0b 100644 --- a/man/gnt-instance.rst +++ b/man/gnt-instance.rst @@ -28,7 +28,7 @@ ADD | **add** | {-t|\--disk-template {diskless \| file \| plain \| drbd \| rbd}} -| {\--disk=*N*: {size=*VAL* \| adopt=*LV*}[,options...] +| {\--disk=*N*: {size=*VAL*[,spindles=*VAL*] \| adopt=*LV*}[,options...] | \| {size=*VAL*,provider=*PROVIDER*}[,param=*value*... ][,options...] | \| {-s|\--os-size} *SIZE*} | [\--no-ip-check] [\--no-name-check] [\--no-conflicts-check] @@ -57,6 +57,9 @@ given) in mebibytes. You can also use one of the suffixes *m*, *g* or mebibytes, gibibytes and tebibytes. Each disk can also take these parameters (all optional): +spindles + How many spindles (physical disks on the node) the disk should span. + mode The access mode. Either ``ro`` (read-only) or the default ``rw`` (read-write). @@ -1103,15 +1106,15 @@ by ballooning it up or down to the new value. The ``--disk add:size=*SIZE*,[options..]`` option adds a disk to the instance, and ``--disk *N*:add:size=*SIZE*,[options..]`` will add a disk to the the instance at a specific index. The available options are the -same as in the **add** command(``mode``, ``name``, ``vg``, ``metavg``). -When adding an ExtStorage disk the ``provider=*PROVIDER*`` option is -also mandatory and specifies the ExtStorage provider. Also, for -ExtStorage disks arbitrary parameters can be passed as additional comma -separated options, same as in the **add** command. -The ``--disk remove`` -option will remove the last disk of the instance. Use -``--disk `` *ID*``:remove`` to remove a disk by its identifier. *ID* -can be the index of the disk, the disks's name or the disks's UUID. The -``--disk *ID*:modify[,options...]`` will change the options of the disk. +same as in the **add** command(``spindles``, ``mode``, ``name``, ``vg``, +``metavg``). When adding an ExtStorage disk the ``provider=*PROVIDER*`` +option is also mandatory and specifies the ExtStorage provider. Also, +for ExtStorage disks arbitrary parameters can be passed as additional +comma separated options, same as in the **add** command. -The ``--disk +remove`` option will remove the last disk of the instance. Use ``--disk +`` *ID*``:remove`` to remove a disk by its identifier. *ID* can be the +index of the disk, the disks's name or the disks's UUID. The ``--disk +*ID*:modify[,options...]`` will change the options of the disk. Available options are: mode @@ -1616,7 +1619,7 @@ RECREATE-DISKS | **recreate-disks** [\--submit] | [{-n node1:[node2] \| {-I\|\--iallocator *name*}}] -| [\--disk=*N*[:[size=*VAL*][,mode=*ro\|rw*]]] {*instance*} +| [\--disk=*N*[:[size=*VAL*][,spindles=*VAL*][,mode=*ro\|rw*]]] {*instance*} Recreates all or a subset of disks of the given instance. @@ -1627,10 +1630,10 @@ normal operation and as such the impact of this is low. If only a subset should be recreated, any number of ``disk`` options can be specified. It expects a disk index and an optional list of disk -parameters to change. Only ``size`` and ``mode`` can be changed while -recreating disks. To recreate all disks while changing parameters on -a subset only, a ``--disk`` option must be given for every disk of the -instance. +parameters to change. Only ``size``, ``spindles``, and ``mode`` can be +changed while recreating disks. To recreate all disks while changing +parameters on a subset only, a ``--disk`` option must be given for every +disk of the instance. Optionally the instance's disks can be recreated on different nodes. This can be useful if, for example, the original nodes of the