On Thu, Dec 5, 2013 at 1:49 PM, Thomas Thrainer <[email protected]> wrote:
> It would be possible to make the code generic without dropping the checks by
> introducing a constant which holds the disk templates which support the
> access parameter. This way, we wouldn't have to change the file any more
> neither.

These checks are (for now) effectively no-ops, but here we go:

diff --git a/lib/cmdlib/common.py b/lib/cmdlib/common.py
index 8669669..8dc09d1 100644
--- a/lib/cmdlib/common.py
+++ b/lib/cmdlib/common.py
@@ -1174,6 +1174,9 @@ def CheckDiskAccessModeConsistency(parameters,
cfg, group=None)
     access = parameters[disk_template].get(constants.LDP_ACCESS,
                                            constants.DISK_KERNELSPACE)

+    if dt not in constants.DTS_HAVE_ACCESS
+      continue
+
     #Check the combination of instance hypervisor, disk template and access
     #protocol is sane.
     inst_uuids = cfg.GetNodeGroupInstances(group) if group else \
diff --git a/lib/config.py b/lib/config.py
index 4a9e7cb..c1fa5df 100644
--- a/lib/config.py
+++ b/lib/config.py
@@ -679,6 +679,9 @@ class ConfigWriter(object):
     _helper_ipolicy("cluster", cluster.ipolicy, True)

     for disk_template in cluster.diskparams:
+      if disk_template not in constants.DTS_HAVE_ACCESS:
+        continue
+
       access = cluster.diskparams[disk_template].get(constants.LDP_ACCESS,

constants.DISK_KERNELSPACE)
       if access not in constants.DISK_VALID_ACCESS_MODES:
diff --git a/src/Ganeti/Constants.hs b/src/Ganeti/Constants.hs
index fc5c357..5a2ce25 100644
--- a/src/Ganeti/Constants.hs
+++ b/src/Ganeti/Constants.hs
@@ -899,6 +899,11 @@ dtsBlock =
 dtsLvm :: FrozenSet String
 dtsLvm = diskTemplates `ConstantUtils.difference` dtsNotLvm

+-- | The set of lvm-based disk templates
+dtsHaveAccess :: FrozenSet String
+dtsHaveAccess = ConstantUtils.mkSet $
+  map Types.diskTemplateToRaw [DTRbd, DTGluster]
+
 -- * Drbd

 drbdHmacAlg :: String

-- 
Raffa Santi
Google Germany GmbH
Dienerstr. 12
80331 München


Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg
Geschäftsführer: Graham Law, Christine Elizabeth Flores

Reply via email to