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