From 352806f7dc06a05ca51430926c1b3fa21d2daa0d Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Sat, 21 Mar 2009 12:20:15 +0100
Subject: [PATCH] Show offline nodes in the node status list
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This patch adds a new β€˜-’ flag for the node status which denotes offline
nodes.
---
 Ganeti/HTools/Cluster.hs | 2 +-
 Ganeti/HTools/Node.hs    | 3 ++-
 hbal.1                   | 5 +++--
 hn1.1                    | 5 +++--
 4 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/Ganeti/HTools/Cluster.hs b/Ganeti/HTools/Cluster.hs
index 72ab0ffdb..ba32d4c07 100644
--- a/Ganeti/HTools/Cluster.hs
+++ b/Ganeti/HTools/Cluster.hs
@@ -640,7 +640,7 @@ printNodes ktn nl =
         m_name = maximum . (map length) . fst . unzip $ snl'
         helper = Node.list m_name
         header = printf "%2s %-*s %5s %5s %5s %5s %5s %3s %3s %7s %7s"
-                 "N1" m_name "Name" "t_mem" "f_mem" "r_mem"
+                 " F" m_name "Name" "t_mem" "f_mem" "r_mem"
                  "t_dsk" "f_dsk"
                  "pri" "sec" "p_fmem" "p_fdsk"
     in unlines $ (header:map (uncurry helper) snl')
diff --git a/Ganeti/HTools/Node.hs b/Ganeti/HTools/Node.hs
index 6b56c9d56..03bff7882 100644
--- a/Ganeti/HTools/Node.hs
+++ b/Ganeti/HTools/Node.hs
@@ -219,10 +219,11 @@ list mname n t =
         sl = slist t
         mp = p_mem t
         dp = p_dsk t
+        off = offline t
         fn = failN1 t
     in
       printf " %c %-*s %5.0f %5d %5d %5.0f %5d %3d %3d %.5f %.5f"
-                 (if fn then '*' else ' ')
+                 (if off then '-' else if fn then '*' else ' ')
                  mname n (t_mem t) (f_mem t) (r_mem t)
                  ((t_dsk t) / 1024) ((f_dsk t) `div` 1024)
                  (length pl) (length sl)
diff --git a/hbal.1 b/hbal.1
index 0cc7ed529..323bf2ec6 100644
--- a/hbal.1
+++ b/hbal.1
@@ -106,8 +106,9 @@ Prints the before and after node status, in a format designed to allow
 the user to understand the node's most important parameters.
 
 The node list will contain these informations:
-  - a character denoting the N+1 status of the node, with blank
-    meaning pass and an asterisk ('*') meaning fail
+  - a character denoting the status of the node, with '-' meaning an
+    offline node, '*' meaning N+1 failure and blank meaning a good
+    node
   - the node name
   - the total node memory
   - the free node memory
diff --git a/hn1.1 b/hn1.1
index 3aa09defc..f3920eeeb 100644
--- a/hn1.1
+++ b/hn1.1
@@ -92,8 +92,9 @@ Prints the before and after node status, in a format designed to allow
 the user to understand the node's most important parameters.
 
 The node list will contain these informations:
-  - a character denoting the N+1 status of the node, with blank
-    meaning pass and an asterisk ('*') meaning fail
+  - a character denoting the status of the node, with '-' meaning an
+    offline node, '*' meaning N+1 failure and blank meaning a good
+    node
   - the node name
   - the total node memory
   - the free node memory
-- 
GitLab