From 966e1580e9240a727694b56c79ba7af7d6732779 Mon Sep 17 00:00:00 2001
From: Helga Velroyen <helgav@google.com>
Date: Mon, 25 Mar 2013 17:48:34 +0100
Subject: [PATCH] gnt-cluster info: report enabled disk templates

Add reporting of the currently enabled disk templates to
'gnt-cluster info'.

Signed-off-by: Helga Velroyen <helgav@google.com>
Reviewed-by: Michele Tartara <mtarara@google.com>
---
 lib/client/gnt_cluster.py  | 10 ++++++++++
 src/Ganeti/Query/Server.hs |  4 ++++
 2 files changed, 14 insertions(+)

diff --git a/lib/client/gnt_cluster.py b/lib/client/gnt_cluster.py
index e44f83442..52f98720f 100644
--- a/lib/client/gnt_cluster.py
+++ b/lib/client/gnt_cluster.py
@@ -193,12 +193,20 @@ def InitCluster(opts, args):
 
   hv_state = dict(opts.hv_state)
 
+  # FIXME: remove enabled_storage_types when enabled_disk_templates are
+  # fully implemented.
   enabled_storage_types = opts.enabled_storage_types
   if enabled_storage_types is not None:
     enabled_storage_types = enabled_storage_types.split(",")
   else:
     enabled_storage_types = list(constants.DEFAULT_ENABLED_STORAGE_TYPES)
 
+  enabled_disk_templates = opts.enabled_disk_templates
+  if enabled_disk_templates:
+    enabled_disk_templates = enabled_disk_templates.split(",")
+  else:
+    enabled_disk_templates = list(constants.DEFAULT_ENABLED_DISK_TEMPLATES)
+
   bootstrap.InitCluster(cluster_name=args[0],
                         secondary_ip=opts.secondary_ip,
                         vg_name=vg_name,
@@ -459,6 +467,8 @@ def ShowClusterConfig(opts, args):
        utils.CommaJoin(pathutils.ES_SEARCH_PATH)),
       ("enabled storage types",
        utils.CommaJoin(result["enabled_storage_types"])),
+      ("enabled disk templates",
+       utils.CommaJoin(result["enabled_disk_templates"])),
       ]),
 
     ("Default node parameters",
diff --git a/src/Ganeti/Query/Server.hs b/src/Ganeti/Query/Server.hs
index 67298e981..8184091dc 100644
--- a/src/Ganeti/Query/Server.hs
+++ b/src/Ganeti/Query/Server.hs
@@ -88,6 +88,7 @@ handleCall cdata QueryClusterInfo =
   let cluster = configCluster cdata
       hypervisors = clusterEnabledHypervisors cluster
       storageTypes = clusterEnabledStorageTypes cluster
+      diskTemplates = clusterEnabledDiskTemplates cluster
       def_hv = case hypervisors of
                  x:_ -> showJSON x
                  [] -> JSNull
@@ -140,7 +141,10 @@ handleCall cdata QueryClusterInfo =
                showJSON $ clusterPreallocWipeDisks cluster)
             , ("hidden_os", showJSON $ clusterHiddenOs cluster)
             , ("blacklisted_os", showJSON $ clusterBlacklistedOs cluster)
+            -- FIXME: remove storage types once enabled disk templates are
+            -- fully implemented.
             , ("enabled_storage_types", showJSON storageTypes)
+            , ("enabled_disk_templates", showJSON diskTemplates)
             ]
 
   in return . Ok . J.makeObj $ obj
-- 
GitLab