From afc3c26056d52f125dcacfd0792738e640e94525 Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Wed, 26 Jan 2011 14:39:39 +0100
Subject: [PATCH] Show hidden/blacklisted OSes in cluster info
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Since we can blacklist/hide non-existing OSes (for preseeding), we
cannot query easily the OSes themselves for this status. Hence we
export the entire lists in cluster info (which should be cheaper than
gnt-os diagnose).

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: RenΓ© Nussbaumer <rn@google.com>
---
 lib/client/gnt_cluster.py | 5 ++++-
 lib/cmdlib.py             | 2 ++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/lib/client/gnt_cluster.py b/lib/client/gnt_cluster.py
index 99fc31ef2..d430d48ed 100644
--- a/lib/client/gnt_cluster.py
+++ b/lib/client/gnt_cluster.py
@@ -1,7 +1,7 @@
 #
 #
 
-# Copyright (C) 2006, 2007, 2010 Google Inc.
+# Copyright (C) 2006, 2007, 2010, 2011 Google Inc.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -321,6 +321,9 @@ def ShowClusterConfig(opts, args):
   ToStdout("OS parameters:")
   _PrintGroupedParams(result["osparams"])
 
+  ToStdout("Hidden OSes: %s", utils.CommaJoin(result["hidden_os"]))
+  ToStdout("Blacklisted OSes: %s", utils.CommaJoin(result["blacklisted_os"]))
+
   ToStdout("Cluster parameters:")
   ToStdout("  - candidate pool size: %s",
             compat.TryToRoman(result["candidate_pool_size"],
diff --git a/lib/cmdlib.py b/lib/cmdlib.py
index a39c8f8d4..51e94ff29 100644
--- a/lib/cmdlib.py
+++ b/lib/cmdlib.py
@@ -4604,6 +4604,8 @@ class LUClusterQuery(NoHooksLU):
       "reserved_lvs": cluster.reserved_lvs,
       "primary_ip_version": primary_ip_version,
       "prealloc_wipe_disks": cluster.prealloc_wipe_disks,
+      "hidden_os": cluster.hidden_os,
+      "blacklisted_os": cluster.blacklisted_os,
       }
 
     return result
-- 
GitLab