diff options
author | Alan Conway <aconway@apache.org> | 2008-11-19 13:52:51 +0000 |
---|---|---|
committer | Alan Conway <aconway@apache.org> | 2008-11-19 13:52:51 +0000 |
commit | 18dee70d90657834e1afc2af1e541597ea18abf6 (patch) | |
tree | 6b4c7e6bde8f25171e88b7712ab7c7995a8556f9 /cpp/src/qpid/cluster/Quorum_cman.cpp | |
parent | 0c633b78d0c5784e4261b3ab0cefd3e016d9940d (diff) | |
download | qpid-python-18dee70d90657834e1afc2af1e541597ea18abf6.tar.gz |
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
Diffstat (limited to 'cpp/src/qpid/cluster/Quorum_cman.cpp')
-rw-r--r-- | cpp/src/qpid/cluster/Quorum_cman.cpp | 28 |
1 files changed, 12 insertions, 16 deletions
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 |