The flag is still write-only, for now.

Signed-off-by: Bernardo Dal Seno <bdals...@google.com>
---
 lib/client/gnt_cluster.py |    6 ++++--
 lib/cmdlib.py             |    3 +++
 lib/opcodes.py            |    5 +++++
 man/gnt-cluster.rst       |   13 ++++++++++---
 4 files changed, 22 insertions(+), 5 deletions(-)

diff --git a/lib/client/gnt_cluster.py b/lib/client/gnt_cluster.py
index 14d2e18..301fc20 100644
--- a/lib/client/gnt_cluster.py
+++ b/lib/client/gnt_cluster.py
@@ -971,7 +971,8 @@ def SetClusterParams(opts, args):
           opts.ispecs_nic_count or
           opts.ipolicy_disk_templates is not None or
           opts.ipolicy_vcpu_ratio is not None or
-          opts.ipolicy_spindle_ratio is not None):
+          opts.ipolicy_spindle_ratio is not None or
+          opts.exclusive_storage is not None):
     ToStderr("Please give at least one of the parameters.")
     return 1
 
@@ -1085,6 +1086,7 @@ def SetClusterParams(opts, args):
                                   use_external_mip_script=ext_ip_script,
                                   hv_state=hv_state,
                                   disk_state=disk_state,
+                                  exclusive_storage=opts.exclusive_storage,
                                   )
   SubmitOrSend(op, opts)
   return 0
@@ -1568,7 +1570,7 @@ commands = {
      DRBD_HELPER_OPT, NODRBD_STORAGE_OPT, DEFAULT_IALLOCATOR_OPT,
      RESERVED_LVS_OPT, DRY_RUN_OPT, PRIORITY_OPT, PREALLOC_WIPE_DISKS_OPT,
      NODE_PARAMS_OPT, USE_EXTERNAL_MIP_SCRIPT, DISK_PARAMS_OPT, HV_STATE_OPT,
-     DISK_STATE_OPT, SUBMIT_OPT] +
+     DISK_STATE_OPT, EXCLUSIVE_STORAGE_OPT, SUBMIT_OPT] +
     INSTANCE_POLICY_OPTS,
     "[opts...]",
     "Alters the parameters of the cluster"),
diff --git a/lib/cmdlib.py b/lib/cmdlib.py
index d29631a..cb1b026 100644
--- a/lib/cmdlib.py
+++ b/lib/cmdlib.py
@@ -4397,6 +4397,9 @@ class LUClusterSetParams(LogicalUnit):
     if self.op.use_external_mip_script is not None:
       self.cluster.use_external_mip_script = self.op.use_external_mip_script
 
+    if self.op.exclusive_storage is not None:
+      self.cluster.exclusive_storage = self.op.exclusive_storage
+
     def helper_os(aname, mods, desc):
       desc += " OS list"
       lst = getattr(self.cluster, aname)
diff --git a/lib/opcodes.py b/lib/opcodes.py
index 47216cc..916a2ed 100644
--- a/lib/opcodes.py
+++ b/lib/opcodes.py
@@ -180,6 +180,10 @@ _PIAllocFromDesc = lambda desc: ("iallocator", None, 
ht.TMaybeString, desc)
 _PNetworkName = ("network_name", ht.NoDefault, ht.TNonEmptyString,
                  "Set network name")
 
+# Exclusive storage
+_PExclusiveStorage = ("exclusive_storage", None, ht.TMaybeBool,
+                      "Disks assigned exclusively to instances")
+
 #: OP_ID conversion regular expression
 _OPID_RE = re.compile("([a-z])([A-Z])")
 
@@ -930,6 +934,7 @@ class OpClusterSetParams(OpCode):
      " ``%s`` or ``%s``" % (constants.DDM_ADD, constants.DDM_REMOVE)),
     ("use_external_mip_script", None, ht.TMaybeBool,
      "Whether to use an external master IP address setup script"),
+    _PExclusiveStorage,
     ]
   OP_RESULT = ht.TNone
 
diff --git a/man/gnt-cluster.rst b/man/gnt-cluster.rst
index ee17ed3..e02bf2a 100644
--- a/man/gnt-cluster.rst
+++ b/man/gnt-cluster.rst
@@ -200,6 +200,7 @@ INIT
 | [\--ipol-disk-templates *template* [,*template*...]]
 | [\--disk-state *diskstate*]
 | [\--hypervisor-state *hvstate*]
+| [\--exclusive-storage {yes \| no}]
 | {*clustername*}
 
 This commands is only run once initially on the first node of the
@@ -515,6 +516,11 @@ comma-separated list of disk templates.
 - ``--specs-nic-count`` sets limits on the number of NICs used
 - ``--ipol-disk-templates`` limits the allowed disk templates
 
+The ``--exclusive-storage`` option specify whether physical disks in the
+storage layer are assigned exclusively to single instances or they are
+shared among instances. If not specified, it takes the value set at
+cluster level.
+
 For details about how to use ``--hypervisor-state`` and ``--disk-state``
 have a look at **ganeti**(7).
 
@@ -591,6 +597,7 @@ MODIFY
 | [\--specs-mem-size *spec-param*=*value* [,*spec-param*=*value*...]]
 | [\--specs-nic-count *spec-param*=*value* [,*spec-param*=*value*...]]
 | [\--ipol-disk-templates *template* [,*template*...]]
+| [\--exclusive-storage {yes \| no}]
 
 
 Modify the options for the cluster.
@@ -600,9 +607,9 @@ The ``--vg-name``, ``--no-lvm-storarge``, 
``--enabled-hypervisors``,
 ``-D (--disk-parameters)``, ``--nic-parameters``, ``-C
 (--candidate-pool-size)``, ``--maintain-node-health``,
 ``--prealloc-wipe-disks``, ``--uid-pool``, ``--node-parameters``,
-``--master-netdev``, ``--master-netmask`` and
-``--use-external-mip-script`` options are described in the **init**
-command.
+``--master-netdev``, ``--master-netmask``,
+``--use-external-mip-script`` and ``--exclusive-storage`` options are
+described in the **init** command.
 
 The ``--hypervisor-state`` and ``--disk-state`` options are described in
 detail in **ganeti(7)**.
-- 
1.7.7.3

Reply via email to