The option is parsed but ignored, for the moment.

Signed-off-by: Bernardo Dal Seno <[email protected]>
---
 lib/cli.py                     |  3 +++
 lib/cmdlib/instance_storage.py |  1 +
 lib/constants.py               |  2 ++
 man/gnt-instance.rst           | 13 +++++++++----
 4 files changed, 15 insertions(+), 4 deletions(-)

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 f6561e3..76fc529 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..5e7cb25 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,7 +1106,8 @@ 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``).
+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
@@ -1616,7 +1620,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,7 +1631,8 @@ 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
+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.
-- 
1.8.2.1

Reply via email to