Add Gluster type to the node storage reporting set
authorDimitris Bliablias <bl.dimitris@gmail.com>
Mon, 18 May 2015 13:01:43 +0000 (15:01 +0200)
committerKlaus Aehlig <aehlig@google.com>
Mon, 18 May 2015 13:11:11 +0000 (15:11 +0200)
This patch, adds the 'gluster' storage type to the set of storage types
for which full node storage reporting is available. This set is used by
the 'LUNodeQueryStorage' logical unit for getting information on storage
units on node(s).

Signed-off-by: Dimitris Bliablias <bl.dimitris@gmail.com>
Signed-off-by: Petr Pudlak <pudlak@google.com>
Reviewed-by: Petr Pudlak <pudlak@google.com>

Cherry-picked from 7ec471851400cd878322712309ef996582df02f1

Signed-off-by: Lisa Velden <velden@google.com>
Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Klaus Aehlig <aehlig@google.com>

lib/client/gnt_node.py
lib/cmdlib/node.py
lib/storage/container.py
man/gnt-node.rst
src/Ganeti/Constants.hs

index 676f54a..4f89da0 100644 (file)
@@ -99,6 +99,7 @@ _USER_STORAGE_TYPE = {
   constants.ST_LVM_PV: "lvm-pv",
   constants.ST_LVM_VG: "lvm-vg",
   constants.ST_SHARED_FILE: "sharedfile",
+  constants.ST_GLUSTER: "gluster",
   }
 
 _STORAGE_TYPE_OPT = \
index 5b90ad3..1b13aa9 100644 (file)
@@ -1159,13 +1159,9 @@ def _GetStorageTypeArgs(cfg, storage_type):
   if storage_type == constants.ST_FILE:
     return [[cfg.GetFileStorageDir()]]
   elif storage_type == constants.ST_SHARED_FILE:
-    dts = cfg.GetClusterInfo().enabled_disk_templates
-    paths = []
-    if constants.DT_SHARED_FILE in dts:
-      paths.append(cfg.GetSharedFileStorageDir())
-    if constants.DT_GLUSTER in dts:
-      paths.append(cfg.GetGlusterStorageDir())
-    return [paths]
+    return [[cfg.GetSharedFileStorageDir()]]
+  elif storage_type == constants.ST_GLUSTER:
+    return [[cfg.GetGlusterStorageDir()]]
   else:
     return []
 
index 5d1afb4..ef825da 100644 (file)
@@ -480,6 +480,7 @@ _STORAGE_TYPES = {
   constants.ST_LVM_PV: LvmPvStorage,
   constants.ST_LVM_VG: LvmVgStorage,
   constants.ST_SHARED_FILE: FileStorage,
+  constants.ST_GLUSTER: FileStorage,
   }
 
 
index 21dade0..8b755e3 100644 (file)
@@ -451,7 +451,7 @@ parsing by scripts. In both cases, the ``--units`` option can be
 used to enforce a given output unit.
 
 The ``--storage-type`` option can be used to choose a storage unit
-type. Possible choices are lvm-pv, lvm-vg or file.
+type. Possible choices are lvm-pv, lvm-vg, file, sharedfile and gluster.
 
 The ``-o (--output)`` option takes a comma-separated list of output
 fields. The available fields and their meaning are:
index d0ae44b..7fd11c3 100644 (file)
@@ -744,7 +744,9 @@ stsReport = ConstantUtils.mkSet [stFile, stLvmPv, stLvmVg]
 -- | (as used by LUQueryNodeStorage)
 stsReportNodeStorage :: FrozenSet String
 stsReportNodeStorage = ConstantUtils.union stsReport $
-                                           ConstantUtils.mkSet [stSharedFile]
+                                           ConstantUtils.mkSet [ stSharedFile
+                                                               , stGluster
+                                                               ]
 
 -- * Storage fields
 -- ** First two are valid in LU context only, not passed to backend