Blob Blame History Raw
From f1c6270c820903dccf48b2583ee6f9453b4e3537 Mon Sep 17 00:00:00 2001
From: Kaleb S. KEITHLEY <kkeithle@redhat.com>
Date: Mon, 24 Aug 2015 02:02:25 -0400
Subject: [PATCH 297/304] common-ha: concise output for HA status

filter out unnecessary detail from HA status

backport of http://review.gluster.org/#/c/11942/
upstream https://bugzilla.redhat.com/show_bug.cgi?id=1250628

Change-Id: Ie3b8fc8fe902272c21cd1d4d342d297245ec15e7
BUG: 1235971
Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/56014
Reviewed-by: Soumya Koduri <skoduri@redhat.com>
---
 extras/ganesha/scripts/ganesha-ha.sh |   27 ++++++++++++++++++++++++++-
 1 files changed, 26 insertions(+), 1 deletions(-)

diff --git a/extras/ganesha/scripts/ganesha-ha.sh b/extras/ganesha/scripts/ganesha-ha.sh
index 9c82c09..01bd651 100644
--- a/extras/ganesha/scripts/ganesha-ha.sh
+++ b/extras/ganesha/scripts/ganesha-ha.sh
@@ -843,6 +843,29 @@ setup_state_volume()
 }
 
 
+status()
+{
+    local regex_str="^ ${1}"; shift
+    local status_file=$(mktemp)
+
+    while [[ ${1} ]]; do
+
+        regex_str="${regex_str}|^ ${1}"
+
+        shift
+    done
+
+    pcs status | egrep "^Online:" > ${status_file}
+
+    echo >> ${status_file}
+
+    pcs status | egrep "${regex_str}" | sed -e "s/\t/ /" | cut -d ' ' -f 2,4 >> ${status_file}
+
+    cat ${status_file}
+
+    rm -f ${status_file}
+}
+
 
 main()
 {
@@ -976,7 +999,9 @@ $HA_CONFDIR/ganesha-ha.conf
         ;;
 
     status | --status)
-        exec pcs status
+        determine_servers "status"
+
+        status ${HA_SERVERS}
         ;;
 
     refresh-config | --refresh-config)
-- 
1.7.1