cb8e9e
From f1c6270c820903dccf48b2583ee6f9453b4e3537 Mon Sep 17 00:00:00 2001
cb8e9e
From: Kaleb S. KEITHLEY <kkeithle@redhat.com>
cb8e9e
Date: Mon, 24 Aug 2015 02:02:25 -0400
cb8e9e
Subject: [PATCH 297/304] common-ha: concise output for HA status
cb8e9e
cb8e9e
filter out unnecessary detail from HA status
cb8e9e
cb8e9e
backport of http://review.gluster.org/#/c/11942/
cb8e9e
upstream https://bugzilla.redhat.com/show_bug.cgi?id=1250628
cb8e9e
cb8e9e
Change-Id: Ie3b8fc8fe902272c21cd1d4d342d297245ec15e7
cb8e9e
BUG: 1235971
cb8e9e
Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com>
cb8e9e
Reviewed-on: https://code.engineering.redhat.com/gerrit/56014
cb8e9e
Reviewed-by: Soumya Koduri <skoduri@redhat.com>
cb8e9e
---
cb8e9e
 extras/ganesha/scripts/ganesha-ha.sh |   27 ++++++++++++++++++++++++++-
cb8e9e
 1 files changed, 26 insertions(+), 1 deletions(-)
cb8e9e
cb8e9e
diff --git a/extras/ganesha/scripts/ganesha-ha.sh b/extras/ganesha/scripts/ganesha-ha.sh
cb8e9e
index 9c82c09..01bd651 100644
cb8e9e
--- a/extras/ganesha/scripts/ganesha-ha.sh
cb8e9e
+++ b/extras/ganesha/scripts/ganesha-ha.sh
cb8e9e
@@ -843,6 +843,29 @@ setup_state_volume()
cb8e9e
 }
cb8e9e
 
cb8e9e
 
cb8e9e
+status()
cb8e9e
+{
cb8e9e
+    local regex_str="^ ${1}"; shift
cb8e9e
+    local status_file=$(mktemp)
cb8e9e
+
cb8e9e
+    while [[ ${1} ]]; do
cb8e9e
+
cb8e9e
+        regex_str="${regex_str}|^ ${1}"
cb8e9e
+
cb8e9e
+        shift
cb8e9e
+    done
cb8e9e
+
cb8e9e
+    pcs status | egrep "^Online:" > ${status_file}
cb8e9e
+
cb8e9e
+    echo >> ${status_file}
cb8e9e
+
cb8e9e
+    pcs status | egrep "${regex_str}" | sed -e "s/\t/ /" | cut -d ' ' -f 2,4 >> ${status_file}
cb8e9e
+
cb8e9e
+    cat ${status_file}
cb8e9e
+
cb8e9e
+    rm -f ${status_file}
cb8e9e
+}
cb8e9e
+
cb8e9e
 
cb8e9e
 main()
cb8e9e
 {
cb8e9e
@@ -976,7 +999,9 @@ $HA_CONFDIR/ganesha-ha.conf
cb8e9e
         ;;
cb8e9e
 
cb8e9e
     status | --status)
cb8e9e
-        exec pcs status
cb8e9e
+        determine_servers "status"
cb8e9e
+
cb8e9e
+        status ${HA_SERVERS}
cb8e9e
         ;;
cb8e9e
 
cb8e9e
     refresh-config | --refresh-config)
cb8e9e
-- 
cb8e9e
1.7.1
cb8e9e