conga/ricci/modules/cluster ClusterConf.cpp Cl ...
CVSROOT: /cvs/cluster
Module name: conga
Changes by: kupcevic at sourceware.org 2006-08-15 00:16:31
Modified files:
ricci/modules/cluster: ClusterConf.cpp ClusterStatus.cpp
Clusvcadm.cpp
Log message:
cluster module: add CS5 support
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/ClusterConf.cpp.diff?cvsroot=cluster&r1=1.4&r2=1.5
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/ClusterStatus.cpp.diff?cvsroot=cluster&r1=1.10&r2=1.11
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/Clusvcadm.cpp.diff?cvsroot=cluster&r1=1.3&r2=1.4
ricci/modules/cluster/ClusterConf.cpp +27 -15
@@ -38,7 +38,11 @@ #define CLUSTER_CONF_PATH (CLUSTER_CONF_DIR + CLUSTER_CONF_NAME) #define CCS_TOOL_PATH "/sbin/ccs_tool" -#define CMAN_TOOL_PATH "/sbin/cman_tool" + + +static void +set_CMAN_TOOL_PATH(); +static String CMAN_TOOL_PATH;
@@ -69,6 +73,8 @@ ClusterConf::set(const XMLObject& xml, bool propagate) { + set_CMAN_TOOL_PATH(); + // sanity check if (xml.tag() != "cluster") throw String("invalid cluster.conf");
@@ -110,13 +116,7 @@ if (status != 0) throw String("ccs_tool failed"); - bool cman = false; - for (list<XMLObject>::const_iterator iter = xml.children().begin(); - iter != xml.children().end(); - iter++) - if (iter->tag() == "cman") - cman = true; - if (cman) { + if (is_cman(xml)) { args.clear(); args.push_back("version"); args.push_back("-r");
@@ -143,18 +143,30 @@ bool ClusterConf::is_gulm(const XMLObject& cluster_conf) { - return !is_cman(cluster_conf); -} - -bool -ClusterConf::is_cman(const XMLObject& cluster_conf) -{ for (list<XMLObject>::const_iterator iter = cluster_conf.children().begin(); iter != cluster_conf.children().end(); iter++) - if (iter->tag() == "cman") + if (iter->tag() == "gulm") return true; return false; } +bool +ClusterConf::is_cman(const XMLObject& cluster_conf) +{ + return !is_gulm(cluster_conf); +} + + +void +set_CMAN_TOOL_PATH() +{ + static bool path_set = false; + if (!path_set) { + CMAN_TOOL_PATH = "/sbin/cman_tool"; + if (access(CMAN_TOOL_PATH.c_str(), X_OK)) + CMAN_TOOL_PATH = "/usr/sbin/cman_tool"; + path_set = true; + } +}
ricci/modules/cluster/ClusterStatus.cpp +163 -58
268 lines not on this page · raw message
ricci/modules/cluster/Clusvcadm.cpp +12 -0
@@ -201,6 +201,17 @@ String out, err; int status; vector<String> args; + + bool fast_available = false; // clustat -f ? + args.push_back("-h"); + if (utils::execute(CLUSTAT_TOOL_PATH, args, out, err, status, false)) + throw String("missing clustat"); + if (out.find("-f") != out.npos) + fast_available = true; + + args.clear(); + if (fast_available) + args.push_back("-f"); args.push_back("-x"); if (utils::execute(CLUSTAT_TOOL_PATH, args, out, err, status, false)) throw String("execute failed");
@@ -222,6 +233,7 @@ else if (iter->tag() == "quorum") quorum_xml = *iter; + // TODO: groupmember missing in CS5 if (quorum_xml.get_attr("groupmember") != "1") throw NoServiceManager();