From: rmccabe@sourceware.org <rmccabe@sourceware.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] conga/ricci/modules/cluster/clumon/src/common ...
Date: 10 Oct 2007 18:19:30 -0000 [thread overview]
Message-ID: <20071010181930.6581.qmail@sourceware.org> (raw)
CVSROOT: /cvs/cluster
Module name: conga
Branch: RHEL4
Changes by: rmccabe at sourceware.org 2007-10-10 18:19:30
Modified files:
ricci/modules/cluster/clumon/src/common: Cluster.cpp
Log message:
Rest of fix for 326571
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/clumon/src/common/Cluster.cpp.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.6.4.1&r2=1.6.4.2
--- conga/ricci/modules/cluster/clumon/src/common/Cluster.cpp 2007/10/10 18:10:37 1.6.4.1
+++ conga/ricci/modules/cluster/clumon/src/common/Cluster.cpp 2007/10/10 18:19:30 1.6.4.2
@@ -69,36 +69,20 @@
unsigned int
Cluster::votes()
{
- cman_handle_t ch = cman_init(NULL);
- if (ch != NULL) {
- cman_node_t this_node;
- int ret;
+ FILE *fp;
- ret = cman_get_node(ch, CMAN_NODEID_US, &this_node);
- cman_finish(ch);
- if (ret == 0) {
- FILE *fp = fopen("/proc/cluster/nodes", "r");
- if (fp != NULL) {
- char buf[4096];
- while (fgets(buf, sizeof(buf), fp) != NULL) {
- int nodeid = -1;
- int votes = -1;
-
- if (!strncmp("Node", buf, 4)) {
- /* header */
- continue;
- }
- ret = sscanf(buf, "%d %d %*d %*c %*s\n", &nodeid, &votes);
- if (ret != 2)
- continue;
- if (nodeid == this_node.cn_nodeid) {
- fclose(fp);
- return (votes);
- }
- }
+ fp = fopen("/proc/cluster/status", "r");
+ if (fp != NULL) {
+ char buf[4096];
+ int votes = -1;
+
+ while (fgets(buf, sizeof(buf), fp) != NULL) {
+ if (sscanf(buf, "Total_votes: %d\n", &votes) == 1) {
fclose(fp);
+ return (votes);
}
}
+ fclose(fp);
}
unsigned int votes = 0;
next reply other threads:[~2007-10-10 18:19 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-10 18:19 rmccabe [this message]
-- strict thread matches above, loose matches on Subject: below --
2008-07-03 14:55 [Cluster-devel] conga/ricci/modules/cluster/clumon/src/common rmccabe
2008-07-03 14:58 rmccabe
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=20071010181930.6581.qmail@sourceware.org \
--to=rmccabe@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.