From c190e817e1bf1b62d5a84f62c820913ebe69d61f Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Tue, 26 Oct 2010 17:59:10 +0200
Subject: [PATCH] Export the capability flags in query, rapi, ialloc

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
---
 lib/cmdlib.py     |  5 ++++-
 lib/rapi/rlib2.py |  1 +
 man/gnt-node.sgml | 12 ++++++++++++
 scripts/gnt-node  |  6 ++++--
 4 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/lib/cmdlib.py b/lib/cmdlib.py
index be4ccddae..d1aa37c74 100644
--- a/lib/cmdlib.py
+++ b/lib/cmdlib.py
@@ -3197,7 +3197,8 @@ class LUQueryNodes(NoHooksLU):
   REQ_BGL = False
 
   _SIMPLE_FIELDS = ["name", "serial_no", "ctime", "mtime", "uuid",
-                    "master_candidate", "offline", "drained"]
+                    "master_candidate", "offline", "drained",
+                    "master_capable", "vm_capable"]
 
   _FIELDS_DYNAMIC = utils.FieldSet(
     "dtotal", "dfree",
@@ -10244,6 +10245,8 @@ class IAllocator(object):
         "drained": ninfo.drained,
         "master_candidate": ninfo.master_candidate,
         "group": ninfo.group,
+        "master_capable": ninfo.master_capable,
+        "vm_capable": ninfo.vm_capable,
         }
 
       if not (ninfo.offline or ninfo.drained):
diff --git a/lib/rapi/rlib2.py b/lib/rapi/rlib2.py
index f15d94d7b..bdbc4fa13 100644
--- a/lib/rapi/rlib2.py
+++ b/lib/rapi/rlib2.py
@@ -69,6 +69,7 @@ N_FIELDS = ["name", "offline", "master_candidate", "drained",
             "ctotal", "cnodes", "csockets",
             "pip", "sip", "role",
             "pinst_list", "sinst_list",
+            "master_capable", "vm_capable",
             ] + _COMMON_FIELDS
 
 _NR_DRAINED = "drained"
diff --git a/man/gnt-node.sgml b/man/gnt-node.sgml
index d1cc18c17..130718dae 100644
--- a/man/gnt-node.sgml
+++ b/man/gnt-node.sgml
@@ -524,6 +524,18 @@
               </para>
             </listitem>
           </varlistentry>
+          <varlistentry>
+            <term>master_capable</term>
+            <listitem>
+              <para>whether the node can become a master candidate</para>
+            </listitem>
+          </varlistentry>
+          <varlistentry>
+            <term>vm_capable</term>
+            <listitem>
+              <para>whether the node can host instances</para>
+            </listitem>
+          </varlistentry>
         </variablelist>
       </para>
 
diff --git a/scripts/gnt-node b/scripts/gnt-node
index 92d806869..3fa5ff939 100755
--- a/scripts/gnt-node
+++ b/scripts/gnt-node
@@ -77,7 +77,8 @@ _LIST_HEADERS = {
   "master": "IsMaster",
   "offline": "Offline", "drained": "Drained",
   "role": "Role",
-  "ctime": "CTime", "mtime": "MTime", "uuid": "UUID"
+  "ctime": "CTime", "mtime": "MTime", "uuid": "UUID",
+  "master_capable": "MasterCapable", "vm_capable": "VMCapable",
   }
 
 
@@ -251,7 +252,8 @@ def ListNodes(opts, args):
       val = row[idx]
       if field in list_type_fields:
         val = ",".join(val)
-      elif field in ('master', 'master_candidate', 'offline', 'drained'):
+      elif field in ('master', 'master_candidate', 'offline', 'drained',
+                     'master_capable', 'vm_capable'):
         if val:
           val = 'Y'
         else:
-- 
GitLab