Add "spindles" option to instance disk creation commands
authorBernardo Dal Seno <bdalseno@google.com>
Mon, 6 May 2013 10:51:26 +0000 (12:51 +0200)
committerBernardo Dal Seno <bdalseno@google.com>
Thu, 23 May 2013 11:03:53 +0000 (13:03 +0200)
The option is parsed but ignored, for the moment.

Signed-off-by: Bernardo Dal Seno <bdalseno@google.com>
Reviewed-by: Thomas Thrainer <thomasth@google.com>

lib/cli.py
lib/cmdlib/instance_storage.py
lib/constants.py
man/gnt-instance.rst

index 32ef069..0bddf43 100644 (file)
@@ -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:
           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)
         if mode == constants.INSTANCE_IMPORT:
           raise errors.OpPrereqError("Disk adoption not allowed for instance"
                                      " import", errors.ECODE_INVAL)
index cc64a70..bf1b8ad 100644 (file)
@@ -526,6 +526,7 @@ class LUInstanceRecreateDisks(LogicalUnit):
   _MODIFYABLE = compat.UniqueFrozenset([
     constants.IDISK_SIZE,
     constants.IDISK_MODE,
   _MODIFYABLE = compat.UniqueFrozenset([
     constants.IDISK_SIZE,
     constants.IDISK_MODE,
+    constants.IDISK_SPINDLES,
     ])
 
   # New or changed disk parameters may have different semantics
     ])
 
   # New or changed disk parameters may have different semantics
index d4022b2..c17261a 100644 (file)
@@ -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_* constants are used in opcodes, to create/change disks
 IDISK_SIZE = "size"
+IDISK_SPINDLES = "spindles"
 IDISK_MODE = "mode"
 IDISK_ADOPT = "adopt"
 IDISK_VG = "vg"
 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_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,
   IDISK_MODE: VTYPE_STRING,
   IDISK_ADOPT: VTYPE_STRING,
   IDISK_VG: VTYPE_STRING,
index 793b664..0942c0b 100644 (file)
@@ -28,7 +28,7 @@ ADD
 
 | **add**
 | {-t|\--disk-template {diskless \| file \| plain \| drbd \| rbd}}
 
 | **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]
 |  \| {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):
 
 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).
 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
 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
 Available options are:
 
 mode
@@ -1616,7 +1619,7 @@ RECREATE-DISKS
 
 | **recreate-disks** [\--submit]
 | [{-n node1:[node2] \| {-I\|\--iallocator *name*}}]
 
 | **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.
 
 
 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
 
 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
 
 Optionally the instance's disks can be recreated on different
 nodes. This can be useful if, for example, the original nodes of the