From: kupcevic@sourceware.org <kupcevic@sourceware.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] conga/ricci/modules/storage LVM.cpp
Date: 1 Nov 2006 21:27:06 -0000 [thread overview]
Message-ID: <20061101212706.12779.qmail@sourceware.org> (raw)
CVSROOT: /cvs/cluster
Module name: conga
Changes by: kupcevic at sourceware.org 2006-11-01 21:27:05
Modified files:
ricci/modules/storage: LVM.cpp
Log message:
storage module: properly probe cluster quorum if LVM locking is marked as clustered
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/storage/LVM.cpp.diff?cvsroot=cluster&r1=1.7&r2=1.8
--- conga/ricci/modules/storage/LVM.cpp 2006/10/06 03:10:13 1.7
+++ conga/ricci/modules/storage/LVM.cpp 2006/11/01 21:27:04 1.8
@@ -78,6 +78,9 @@
static const map<String, PV_data>
probe_pvs();
+static bool
+cluster_quorate();
+
// pvs
@@ -644,11 +647,15 @@
return get_locking_type() == "2";
}
-void
-LVM::check_locking()
+bool
+cluster_quorate()
{
- if (get_locking_type() == "2") {
- // check if quorate
+ bool use_magma = true;
+ if (access("/sbin/magma_tool", X_OK))
+ use_magma = false;
+
+ if (use_magma) {
+ // use magma_tool
String out, err;
int status;
vector<String> args;
@@ -657,11 +664,63 @@
throw command_not_found_error_msg("magma_tool");
if (status)
throw String("cluster tools: magma_tool errored");
- if (out.find("Quorate") == out.npos)
+ if (out.find("Quorate") != out.npos)
+ return true;
+ else
+ return false;
+ } else {
+ // use cman_tool
+ String cman_tool_path = "/sbin/cman_tool";
+ if (access(cman_tool_path.c_str(), X_OK))
+ cman_tool_path = "/usr/sbin/cman_tool";
+
+ String out, err;
+ int status;
+ vector<String> args;
+ args.push_back("status");
+ if (utils::execute(cman_tool_path, args, out, err, status))
+ throw command_not_found_error_msg("cman_tool");
+ if (status)
+ throw String("cluster tools: cman_tool errored");
+
+ long long quorum = -1;
+ long long votes = -1;
+ vector<String> lines = utils::split(utils::strip(out), "\n");
+ for (vector<String>::const_iterator iter = lines.begin();
+ iter != lines.end();
+ iter++) {
+ vector<String> words = utils::split(*iter);
+ if (words.size() < 2)
+ continue;
+ if (words[0] == "Quorum:")
+ quorum = utils::to_long(words[1]);
+ if (words[0] == "Total_votes:")
+ votes = utils::to_long(words[1]);
+ if (words.size() < 3)
+ continue;
+ if (words[0] == "Total" &&
+ words[1] == "votes:")
+ votes = utils::to_long(words[2]);
+ }
+
+ if (quorum <= 0 ||
+ votes < 0)
+ throw String("Unable to retrieve cluster quorum info");
+ return votes >= quorum;
+ }
+}
+
+void
+LVM::check_locking()
+{
+ if (get_locking_type() == "2") {
+ if (!cluster_quorate())
throw ClusterNotQuorateError();
// try to start clvmd, if not running
- args.clear();
+ String out, err;
+ int status;
+ vector<String> args;
args.push_back("clvmd");
args.push_back("start");
if (utils::execute("/sbin/service", args, out, err, status))
next reply other threads:[~2006-11-01 21:27 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-11-01 21:27 kupcevic [this message]
-- strict thread matches above, loose matches on Subject: below --
2007-01-17 14:41 [Cluster-devel] conga/ricci/modules/storage LVM.cpp kupcevic
2007-01-16 17:05 kupcevic
2006-11-29 16:39 rmccabe
2006-08-21 15:44 kupcevic
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20061101212706.12779.qmail@sourceware.org \
--to=kupcevic@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).