From 18dee70d90657834e1afc2af1e541597ea18abf6 Mon Sep 17 00:00:00 2001 From: Alan Conway Date: Wed, 19 Nov 2008 13:52:51 +0000 Subject: Fix --cluster-cman option to enable cman integration. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@718961 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/qpid/cluster/Quorum_cman.cpp | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) (limited to 'cpp/src/qpid/cluster/Quorum_cman.cpp') diff --git a/cpp/src/qpid/cluster/Quorum_cman.cpp b/cpp/src/qpid/cluster/Quorum_cman.cpp index 0d4656b536..d5df758b40 100644 --- a/cpp/src/qpid/cluster/Quorum_cman.cpp +++ b/cpp/src/qpid/cluster/Quorum_cman.cpp @@ -18,7 +18,7 @@ * under the License. * */ -#include "Quorum.h" +#include "Quorum_cman.h" #include "qpid/log/Statement.h" #include "qpid/Options.h" #include "qpid/sys/Time.h" @@ -30,24 +30,20 @@ Quorum::Quorum() : enable(false), cman(0) {} Quorum::~Quorum() { if (cman) cman_finish(cman); } -void Quorum::addOption(Options& opts) { - opts.addOptions()("cluster-cman", optValue(enable), "Enable integration with CMAN Cluster Manager"); -} - void Quorum::init() { - if (enable) { - cman = cman_init(0); - if (cman == 0) throw ErrnoException("Can't connect to cman service"); - // FIXME aconway 2008-11-13: configure max wait. - for (int retry = 0; !cman_is_quorate(cman) && retry < 30; retry++) { - QPID_LOG(notice, "Waiting for cluster quorum: " << sys::strError(errno)); - sys::sleep(1); - } - if (!cman_is_quorate(cman)) - throw ErrnoException("Timed out waiting for cluster quorum"); + QPID_LOG(info, "Waiting for cluster quorum"); + enable = true; + cman = cman_init(0); + if (cman == 0) throw ErrnoException("Can't connect to cman service"); + // FIXME aconway 2008-11-13: configure max wait. + for (int retry = 0; !cman_is_quorate(cman) && retry < 30; retry++) { + QPID_LOG(info, "Waiting for cluster quorum: " << sys::strError(errno)); + sys::sleep(1); } + if (!cman_is_quorate(cman)) + throw ErrnoException("Timed out waiting for cluster quorum."); } -bool Quorum::isQuorate() { return cman_is_quorate(cman); } +bool Quorum::isQuorate() { return enable ? cman_is_quorate(cman) : true; } }} // namespace qpid::cluster -- cgit v1.2.1