summaryrefslogtreecommitdiff
path: root/tools/src
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2012-03-08 21:47:04 +0000
committerAlan Conway <aconway@apache.org>2012-03-08 21:47:04 +0000
commita182b58af59bb455d98836940258bb40084e669c (patch)
treed6ef9197b75c82fcbdc74adface578641eacced8 /tools/src
parenta567ec9a74897ca77b75b93caa2ed3d6e3fb7223 (diff)
downloadqpid-python-a182b58af59bb455d98836940258bb40084e669c.tar.gz
QPID-3603: rgmanager integration for new HA cluster
- service start script qpid-primary, called by rgmanager to promote a broker. - example cluster.conf - minor changes to qpid-ha git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1298602 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'tools/src')
-rwxr-xr-xtools/src/py/qpid-ha27
1 files changed, 10 insertions, 17 deletions
diff --git a/tools/src/py/qpid-ha b/tools/src/py/qpid-ha
index 5c757f3c6c..ac35e3ed2c 100755
--- a/tools/src/py/qpid-ha
+++ b/tools/src/py/qpid-ha
@@ -67,26 +67,19 @@ class PromoteCmd(Command):
qmf_broker._method("promote", {}, HA_BROKER)
PromoteCmd()
-class ReadyCmd(Command):
+class StatusCmd(Command):
def __init__(self):
- Command.__init__(self, "ready", "Test if a backup broker is ready.\nReturn 0 if broker is a ready backup, non-0 otherwise.")
+ Command.__init__(self, "status", "Print HA status")
self.op.add_option(
- "--wait", type="int", metavar="<seconds>", default=None,
- help="Wait up to <seconds> for broker to be ready. 0 means wait forever.")
+ "--expect", type="string", metavar="<status>",
+ help="Don't print status but return 0 if it matches <status>, 1 otherwise")
def do_execute(self, qmf_broker, ha_broker, opts, args):
- if (ha_broker.status == "backup"): return
- if (ha_broker.status != "catch-up"):
- raise Exception("Broker is not a backup, status is '%s'"%ha_broker.status)
- if (opts.wait is None): return 1
- delay = 0.1
- timeout = time.time() + opts.wait
- while opts.wait == 0 or time.time() < timeout:
- time.sleep(delay)
- delay = min(2*delay, 1)
- ha_broker = qmf_broker.getHaBroker()
- if (ha_broker.status == "backup"): return
- return 1
-ReadyCmd()
+ if opts.expect:
+ if opts.expect != ha_broker.status: return 1
+ else:
+ print ha_broker.status
+ return 0
+StatusCmd()
class ReplicateCmd(Command):
def __init__(self):