summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xqpid/cpp/etc/qpidd-primary.in2
-rw-r--r--qpid/cpp/src/qpid/ha/types.cpp5
-rwxr-xr-xqpid/tools/src/py/qpid-ha7
3 files changed, 12 insertions, 2 deletions
diff --git a/qpid/cpp/etc/qpidd-primary.in b/qpid/cpp/etc/qpidd-primary.in
index 39700bead3..da0c0c2771 100755
--- a/qpid/cpp/etc/qpidd-primary.in
+++ b/qpid/cpp/etc/qpidd-primary.in
@@ -57,7 +57,7 @@ if [[ !(-x $QPID_HA) ]]; then
fi
status() {
- if $QPID_HA -b localhost:$QPID_PORT status --expect=primary ; then
+ if $QPID_HA -b localhost:$QPID_PORT status --is-primary ; then
echo "qpidd is primary"
else
echo "qpidd is not primary"
diff --git a/qpid/cpp/src/qpid/ha/types.cpp b/qpid/cpp/src/qpid/ha/types.cpp
index 4010ec03a8..bb4bf83574 100644
--- a/qpid/cpp/src/qpid/ha/types.cpp
+++ b/qpid/cpp/src/qpid/ha/types.cpp
@@ -56,6 +56,11 @@ template <> const char* Enum<ReplicateLevel>::NAMES[] = { "none", "configuration
template <> const size_t Enum<ReplicateLevel>::N = 3;
template <> const char* Enum<BrokerStatus>::NAME = "HA broker status";
+
+// NOTE: Changing status names will have an impact on qpid-ha and
+// the qpidd-primary init script.
+// Don't change them unless you are going to update all dependent code.
+//
template <> const char* Enum<BrokerStatus>::NAMES[] = {
"joining", "catchup", "ready", "recovering", "active", "standalone"
};
diff --git a/qpid/tools/src/py/qpid-ha b/qpid/tools/src/py/qpid-ha
index 4414623855..3d56f24fb8 100755
--- a/qpid/tools/src/py/qpid-ha
+++ b/qpid/tools/src/py/qpid-ha
@@ -88,8 +88,13 @@ class StatusCmd(Command):
Command.__init__(self, "status", "Print HA status")
self.op.add_option(
"--expect", type="string", metavar="<status>",
- help="Don't print status but return 0 if it matches <status>, 1 otherwise")
+ help="Don't print status. Return 0 if it matches <status>, 1 otherwise")
+ self.op.add_option(
+ "--is-primary", action="store_true", default=False,
+ help="Don't print status. Return 0 if the broker is primary, 1 otherwise")
def do_execute(self, qmf_broker, ha_broker, opts, args):
+ if opts.is_primary:
+ if not ha_broker.status in ["active", "recovering"]: raise ExitStatus(1)
if opts.expect:
if opts.expect != ha_broker.status: raise ExitStatus(1)
else: