From mboxrd@z Thu Jan 1 00:00:00 1970 From: rmccabe@sourceware.org Date: 28 Sep 2007 04:47:57 -0000 Subject: [Cluster-devel] conga/ricci/modules/cluster ClusterModule.cpp ... Message-ID: <20070928044757.23560.qmail@sourceware.org> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit CVSROOT: /cvs/cluster Module name: conga Changes by: rmccabe at sourceware.org 2007-09-28 04:47:56 Modified files: ricci/modules/cluster: ClusterModule.cpp ClusterStatus.cpp ClusterStatus.h Log message: add parameters for start_node and stop_node that allow whether cluster services will be respectively enabled or disabled at boot. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/ClusterModule.cpp.diff?cvsroot=cluster&r1=1.9&r2=1.10 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/ClusterStatus.cpp.diff?cvsroot=cluster&r1=1.22&r2=1.23 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/modules/cluster/ClusterStatus.h.diff?cvsroot=cluster&r1=1.7&r2=1.8 --- conga/ricci/modules/cluster/ClusterModule.cpp 2007/09/18 20:17:16 1.9 +++ conga/ricci/modules/cluster/ClusterModule.cpp 2007/09/28 04:47:56 1.10 @@ -333,16 +333,21 @@ start_node(const VarMap& args) { bool cluster_startup = false; + bool enable_services = true; try { VarMap::const_iterator iter = args.find("cluster_startup"); if (iter != args.end()) cluster_startup = iter->second.get_bool(); - } catch ( String e ) { - throw APIerror(e); + + iter = args.find("enable_services"); + if (iter != args.end()) + enable_services = iter->second.get_bool(); + } catch ( String e ) { + throw APIerror(e); } - Cluster::start_node(cluster_startup); + Cluster::start_node(cluster_startup, enable_services); VarMap ret; return ret; @@ -353,6 +358,7 @@ { bool cluster_shutdown = false; bool purge_conf = false; + bool disable_services = true; try { VarMap::const_iterator iter = args.find("cluster_shutdown"); @@ -362,11 +368,15 @@ iter = args.find("purge_conf"); if (iter != args.end()) purge_conf = iter->second.get_bool(); + + iter = args.find("disable_services"); + if (iter != args.end()) + disable_services = iter->second.get_bool(); } catch ( String e ) { throw APIerror(e); } - Cluster::stop_node(cluster_shutdown, purge_conf); + Cluster::stop_node(cluster_shutdown, purge_conf, disable_services); VarMap ret; return ret; } --- conga/ricci/modules/cluster/ClusterStatus.cpp 2007/09/18 20:17:16 1.22 +++ conga/ricci/modules/cluster/ClusterStatus.cpp 2007/09/28 04:47:56 1.23 @@ -157,7 +157,7 @@ } void -Cluster::start_node(bool cluster_startup) +Cluster::start_node(bool cluster_startup, bool enable_services) { // bail out if cluster.conf is not present XMLObject cluster_conf(ClusterConf::get()); @@ -218,25 +218,27 @@ run_initd("gfs", true, false); run_initd("rgmanager", true, true); - // enable them on boot - run_chkconfig("ccsd", true); - if (cman_cluster) { - run_chkconfig("cman", true); - run_chkconfig("fenced", true); - run_chkconfig("lock_gulmd", false); - } else { - run_chkconfig("cman", false); - run_chkconfig("fenced", false); - run_chkconfig("lock_gulmd", true); - } + if (enable_services) { + // enable them on boot + run_chkconfig("ccsd", true); + if (cman_cluster) { + run_chkconfig("cman", true); + run_chkconfig("fenced", true); + run_chkconfig("lock_gulmd", false); + } else { + run_chkconfig("cman", false); + run_chkconfig("fenced", false); + run_chkconfig("lock_gulmd", true); + } - if (use_qdisk) - run_chkconfig("qdiskd", true); - else - run_chkconfig("qdiskd", false); - run_chkconfig("clvmd", true); - run_chkconfig("gfs", true); - run_chkconfig("rgmanager", true); + if (use_qdisk) + run_chkconfig("qdiskd", true); + else + run_chkconfig("qdiskd", false); + run_chkconfig("clvmd", true); + run_chkconfig("gfs", true); + run_chkconfig("rgmanager", true); + } } else if (stat.get_attr("cluster_version") == "5") { try { run_initd("cman", true, true); @@ -265,16 +267,18 @@ run_initd("gfs2", true, false); run_initd("rgmanager", true, true); - // enable them on boot - run_chkconfig("cman", true); - if (use_qdisk) - run_chkconfig("qdiskd", true); - else - run_chkconfig("qdiskd", false); - run_chkconfig("clvmd", true); - run_chkconfig("gfs", true); - run_chkconfig("gfs2", true); - run_chkconfig("rgmanager", true); + if (enable_services) { + // enable them on boot + run_chkconfig("cman", true); + if (use_qdisk) + run_chkconfig("qdiskd", true); + else + run_chkconfig("qdiskd", false); + run_chkconfig("clvmd", true); + run_chkconfig("gfs", true); + run_chkconfig("gfs2", true); + run_chkconfig("rgmanager", true); + } } else { throw String("unsupported cluster version ") + stat.get_attr("cluster_version"); @@ -282,7 +286,9 @@ } void -Cluster::stop_node(bool cluster_shutdown, bool purge_conf) +Cluster::stop_node( bool cluster_shutdown, + bool purge_conf, + bool disable_services) { XMLObject stat = status(); @@ -316,15 +322,17 @@ gulm_leave(); run_initd("ccsd", false, false); - // disable them on boot - run_chkconfig("ccsd", false); - run_chkconfig("cman", false); - run_chkconfig("lock_gulmd", false); - run_chkconfig("qdiskd", false); - run_chkconfig("fenced", false); - run_chkconfig("clvmd", false); - run_chkconfig("gfs", false); - run_chkconfig("rgmanager", false); + if (disable_services) { + // disable them on boot + run_chkconfig("ccsd", false); + run_chkconfig("cman", false); + run_chkconfig("lock_gulmd", false); + run_chkconfig("qdiskd", false); + run_chkconfig("fenced", false); + run_chkconfig("clvmd", false); + run_chkconfig("gfs", false); + run_chkconfig("rgmanager", false); + } } else if (stat.get_attr("cluster_version") == "5") { run_initd("rgmanager", false, true); run_initd("gfs2", false, false); @@ -333,13 +341,15 @@ run_initd("qdiskd", false, false); run_initd("cman", false, true); - // disable them on boot - run_chkconfig("cman", false); - run_chkconfig("qdiskd", false); - run_chkconfig("clvmd", false); - run_chkconfig("gfs", false); - run_chkconfig("gfs2", false); - run_chkconfig("rgmanager", false); + if (disable_services) { + // disable them on boot + run_chkconfig("cman", false); + run_chkconfig("qdiskd", false); + run_chkconfig("clvmd", false); + run_chkconfig("gfs", false); + run_chkconfig("gfs2", false); + run_chkconfig("rgmanager", false); + } } else { throw String("unsupported cluster version ") + stat.get_attr("cluster_version"); --- conga/ricci/modules/cluster/ClusterStatus.h 2007/09/18 20:17:16 1.7 +++ conga/ricci/modules/cluster/ClusterStatus.h 2007/09/28 04:47:56 1.8 @@ -29,9 +29,12 @@ { public: static XMLObject status(); - static void start_node(bool cluster_startup = false); + static void start_node( bool cluster_startup = false, + bool enable_services = true); + static void stop_node( bool cluster_shutdown = false, - bool purge_conf = false); + bool purge_conf = false, + bool disable_services = true); }; #endif