FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Cluster Development

 
 
LinkBack Thread Tools
 
Old 01-07-2008, 04:52 AM
 
Default cluster ./configure ccs/ccs_tool/editconf.c cc ...

CVSROOT: /cvs/cluster
Module name: cluster
Changes by: fabbione@sourceware.org 2008-01-07 05:52:29

Modified files:
. : configure
ccs/ccs_tool : editconf.c update.c
ccs/daemon : ccsd.c cluster_mgr.c cnx_mgr.c globals.h
ccs/lib : libccs.c
cman/daemon : cmanccs.c
cman/init.d : Makefile
fence/agents/xvm: options.c simple_auth.h
fence/fenced : main.c
make : defines.mk.input
rgmanager/init.d: Makefile
rgmanager/src/daemons: rg_locks.c
rgmanager/src/resources: Makefile
Added files:
cman/init.d : cman.in
rgmanager/init.d: rgmanager.in
rgmanager/src/resources/utils: config-utils.sh.in
Removed files:
cman/init.d : cman
rgmanager/init.d: rgmanager
rgmanager/src/resources/utils: config-utils.sh

Log message:
makes it possible to change the default configuration file by setting
--confdir (default to /etc/cluster) and --conffile (cluster.conf).

NOTE: manpages with hardencoded /etc/cluster/cluster.conf are not updated.
If you dare to change these defaults you know what you are doing.

NOTE to developers: you will need to re-run ./configure to set the new vars.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/configure.diff?cvsroot=cluster&r1=1.45&r2=1.46
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/ccs/ccs_tool/editconf.c.diff?cvsroot=cluster&r1=1.12&r2=1.13
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/ccs/ccs_tool/update.c.diff?cvsroot=cluster&r1=1.13&r2=1.14
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/ccs/daemon/ccsd.c.diff?cvsroot=cluster&r1=1.29&r2=1.30
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/ccs/daemon/cluster_mgr.c.diff?cvsroot=cluster&r1=1.26&r2=1.27
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/ccs/daemon/cnx_mgr.c.diff?cvsroot=cluster&r1=1.44&r2=1.45
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/ccs/daemon/globals.h.diff?cvsroot=cluster&r1=1.5&r2=1.6
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/ccs/lib/libccs.c.diff?cvsroot=cluster&r1=1.13&r2=1.14
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cman/daemon/cmanccs.c.diff?cvsroot=cluster&r1=1.39&r2=1.40
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cman/init.d/cman.in.diff?cvsroot=cluster&r1=NONE&r2=1.1
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cman/init.d/Makefile.diff?cvsroot=cluster&r1=1.8&r2=1.9
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cman/init.d/cman.diff?cvsroot=cluster&r1=1.34&r2=NONE
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/xvm/options.c.diff?cvsroot=cluster&r1=1.5&r2=1.6
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/xvm/simple_auth.h.diff?cvsroot=cluster&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/fenced/main.c.diff?cvsroot=cluster&r1=1.45&r2=1.46
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/make/defines.mk.input.diff?cvsroot=cluster&r1=1.9&r2=1. 10
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/init.d/rgmanager.in.diff?cvsroot=cluster&r1=NONE&r2=1.1
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/init.d/Makefile.diff?cvsroot=cluster&r1=1.7&r2=1.8
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/init.d/rgmanager.diff?cvsroot=cluster&r1=1.7&r2=NONE
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/rg_locks.c.diff?cvsroot=cluster&r1=1.9&r2=1.10
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/resources/Makefile.diff?cvsroot=cluster&r1=1.25&r2=1.26
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/resources/utils/config-utils.sh.in.diff?cvsroot=cluster&r1=NONE&r2=1.1
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/resources/utils/config-utils.sh.diff?cvsroot=cluster&r1=1.6&r2=NONE

--- cluster/configure 2007/12/21 07:28:37 1.45
+++ cluster/configure 2008/01/07 05:52:26 1.46
@@ -75,6 +75,8 @@
prefix => $prefix,
sbindir => $sbindir,
sharedir => $sharedir,
+ confdir => $confdir,
+ conffile => $conffile,
fence_agents => $fence_agents,
enable_xen => $enable_xen,
release_major => $release_major,
@@ -137,6 +139,8 @@
'prefix=s',
'sbindir=s',
'sharedir=s',
+ 'confdir=s',
+ 'conffile=s',
'release_major=s',
'release_minor=s',
'fence_agents=s',
@@ -169,6 +173,8 @@
print "--libdir= the base directory for libraries. (Default: {prefix}/lib)
";
print "--libexecdir= the base directory for executable components. (Default: {prefix}/libexec)
";
print "--sharedir= the base directory for misc cluster files. (Default: {prefix}/share/cluster)
";
+ print "--confdir= the cluster config directory. (Default: /etc/cluster)
";
+ print "--conffile= the cluster config file. (Default: cluster.conf)
";
print "--mandir= the base directory for man pages. (Default: {prefix}/share/man)
";
print "--module_dir= the base directory for kernel modules. (Default: /lib/modules/`uname -r`/kernel
";
print "
build flags:
";
@@ -473,6 +479,12 @@
if (!$sharedir) {
$sharedir="${prefix}/share/cluster";
}
+if (!$confdir) {
+ $confdir="/etc/cluster";
+}
+if (!$conffile) {
+ $conffile="cluster.conf";
+}
if (!$fence_agents) {
$fence_agents="all";
}
@@ -584,6 +596,8 @@
$_ =~ s/@MANDIR@/$mandir/;
$_ =~ s/@SBINDIR@/$sbindir/;
$_ =~ s/@SHAREDIR@/$sharedir/;
+ $_ =~ s/@CONFDIR@/$confdir/;
+ $_ =~ s/@CONFFILE@/$conffile/;
$_ =~ s/@FENCE_AGENTS@/$fence_agents/;
$_ =~ s/@ENABLE_XEN@/$enable_xen/;
$_ =~ s/@DISABLE_CCS@/$without_ccs/;
--- cluster/ccs/ccs_tool/editconf.c 2007/12/13 10:38:42 1.12
+++ cluster/ccs/ccs_tool/editconf.c 2008/01/07 05:52:27 1.13
@@ -26,7 +26,7 @@
#include "update.h"

#define MAX_NODES 256
-#define DEFAULT_CONFIG_FILE "/etc/cluster/cluster.conf"
+
char *prog_name = "ccs_tool";

#define die(fmt, args...)
@@ -54,7 +54,7 @@

static void config_usage(int rw)
{
- fprintf(stderr, " -c --configfile Name of configuration file (/etc/cluster/cluster.conf)
");
+ fprintf(stderr, " -c --configfile Name of configuration file (" DEFAULT_CONFIG_DIR "/" DEFAULT_CONFIG_FILE ")
");
if (rw)
{
fprintf(stderr, " -o --outputfile Name of output file (defaults to same as --configfile)
");
@@ -543,14 +543,14 @@
LIBXML_TEST_VERSION;

if (!ninfo->configfile)
- ninfo->configfile = DEFAULT_CONFIG_FILE;
+ ninfo->configfile = DEFAULT_CONFIG_DIR "/" DEFAULT_CONFIG_FILE;
if (!ninfo->outputfile)
ninfo->outputfile = ninfo->configfile;

/* Load XML document */
doc = xmlParseFile(ninfo->configfile);
if (doc == NULL)
- die("Error: unable to parse cluster.conf file
");
+ die("Error: unable to parse requested configuration file
");

return doc;

@@ -1036,7 +1036,7 @@
}
}
if (!ninfo.outputfile)
- ninfo.outputfile = DEFAULT_CONFIG_FILE;
+ ninfo.outputfile = DEFAULT_CONFIG_DIR "/" DEFAULT_CONFIG_FILE;
ninfo.configfile = "-";

if (argc - optind < 1)
--- cluster/ccs/ccs_tool/update.c 2007/06/19 18:08:01 1.13
+++ cluster/ccs/ccs_tool/update.c 2008/01/07 05:52:27 1.14
@@ -379,7 +379,7 @@
" Old config version :: %d
"
" Proposed config version :: %d
"
" Winning config version :: %d

"
- "Check /etc/cluster/cluster.conf to ensure it contains the desired contents.
", v1, v2, v3);
+ "Check " DEFAULT_CONFIG_DIR "/" DEFAULT_CONFIG_FILE " to ensure it contains the desired contents.
", v1, v2, v3);
return -EAGAIN;
}

--- cluster/ccs/daemon/ccsd.c 2007/08/30 21:31:41 1.29
+++ cluster/ccs/daemon/ccsd.c 2008/01/07 05:52:27 1.30
@@ -271,7 +271,7 @@
" -t <ttl> Multicast threshold (aka Time to Live) value.
"
" -P [bcf]:# Specify various port numbers.
"
" -V Print version information.
"
- " -X No cluster manager, just read local cluster.conf.
"
+ " -X No cluster manager, just read local " DEFAULT_CONFIG_DIR "/" DEFAULT_CONFIG_FILE ".
"
);
EXIT("print_usage");
}
@@ -319,7 +319,7 @@

ENTER("parse_cli_args");

- config_file_location = strdup(DEFAULT_CONFIG_LOCATION);
+ config_file_location = strdup(DEFAULT_CONFIG_DIR "/" DEFAULT_CONFIG_FILE);
lockfile_location = strdup(DEFAULT_CCSD_LOCKFILE);

if(!config_file_location || !lockfile_location){
@@ -530,7 +530,7 @@
} else {
/* no cluster.conf file. This is fine, just need to get it from the network */
if(no_manager_opt){
- log_err("
No local cluster.conf found: %s
", config_file_location);
+ log_err("
No local config file found: %s
", config_file_location);
return -1;
}
}
--- cluster/ccs/daemon/cluster_mgr.c 2007/05/02 12:42:43 1.26
+++ cluster/ccs/daemon/cluster_mgr.c 2008/01/07 05:52:27 1.27
@@ -194,18 +194,18 @@

old_mode = umask(026);

- fp = fopen("/etc/cluster/cluster.conf-update", "w");
+ fp = fopen(DEFAULT_CONFIG_DIR "/" DEFAULT_CONFIG_FILE "-update", "w");

umask(old_mode);

if (!fp) {
- log_sys_err("Unable to open /etc/cluster/cluster.conf-update");
+ log_sys_err("Unable to open " DEFAULT_CONFIG_DIR "/" DEFAULT_CONFIG_FILE "-update");
error = -errno;
goto fail;
}

if (xmlDocDump(fp, tmp_doc) < 0) {
- log_sys_err("Unable to write /etc/cluster/cluster.conf-update");
+ log_sys_err("Unable to write " DEFAULT_CONFIG_DIR "/" DEFAULT_CONFIG_FILE "-update");
goto fail;
}

@@ -248,7 +248,7 @@

log_dbg("Got lock 1
");

- tmp_doc = xmlParseFile("/etc/cluster/cluster.conf-update");
+ tmp_doc = xmlParseFile(DEFAULT_CONFIG_DIR "/" DEFAULT_CONFIG_FILE "-update");

if (!tmp_doc) {
log_err("Unable to parse updated config file.
");
@@ -263,22 +263,22 @@

old_mode = umask(026);

- fp = fopen("/etc/cluster/.cluster.conf", "w");
+ fp = fopen(DEFAULT_CONFIG_DIR "/." DEFAULT_CONFIG_FILE, "w");

umask(old_mode);

if (!fp) {
- log_sys_err("Unable to open /etc/cluster/.cluster.conf");
+ log_sys_err("Unable to open " DEFAULT_CONFIG_DIR "/." DEFAULT_CONFIG_FILE);
error = -errno;
goto fail;
}

if (xmlDocDump(fp, tmp_doc) < 0) {
- log_sys_err("Unable to write /etc/cluster/.cluster.conf");
+ log_sys_err("Unable to write " DEFAULT_CONFIG_DIR "/." DEFAULT_CONFIG_FILE);
goto fail;
}

- rename("/etc/cluster/cluster.conf-update", "/etc/cluster/cluster.conf");
+ rename(DEFAULT_CONFIG_DIR "/" DEFAULT_CONFIG_FILE "-update", DEFAULT_CONFIG_DIR "/" DEFAULT_CONFIG_FILE);

update_required = 1;
ch.comm_flags = COMM_UPDATE_COMMIT_ACK;
--- cluster/ccs/daemon/cnx_mgr.c 2007/12/11 20:58:00 1.44
+++ cluster/ccs/daemon/cnx_mgr.c 2008/01/07 05:52:27 1.45
@@ -83,13 +83,13 @@
error = -EINVAL;
goto fail;
} else if((v2 = get_doc_version(tmp_doc)) < 0){
- log_err("Unable to get config_version from cluster.conf.
");
+ log_err("Unable to get config_version from %s.
", location);
error = v2;
goto fail;
} else if(master_doc && master_doc->od_doc){
v1 = get_doc_version(master_doc->od_doc);
if(v1 >= v2){
- log_err("cluster.conf on-disk version is <= to in-memory version.
");
+ log_err("%s on-disk version is <= to in-memory version.
", location);
log_err(" On-disk version : %d
", v2);
log_err(" In-memory version : %d
", v1);
error = -EPERM;
@@ -118,7 +118,7 @@
master_doc = tmp_odoc;
}

- log_msg("Update of cluster.conf complete (version %d -> %d).
", v1, v2);
+ log_msg("Update of "DEFAULT_CONFIG_DIR "/" DEFAULT_CONFIG_FILE " complete (version %d -> %d).
", v1, v2);
fail:
if(tmp_odoc != master_doc){
free(tmp_odoc);
@@ -140,7 +140,7 @@
/* If update_required is set, it means that there is still a pending **
** update. We need to pull this one in before doing anything else. */
if(update_required){
- error = _update_config("/etc/cluster/.cluster.conf");
+ error = _update_config(DEFAULT_CONFIG_DIR "/." DEFAULT_CONFIG_FILE);
update_required = 0;
if(error){
log_err("Previous update could not be completed.
");
@@ -348,7 +348,7 @@
tmp_doc = xmlParseMemory(bdoc+sizeof(comm_header_t),
ch->comm_payload_size);
if(!tmp_doc){
- log_err("Unable to parse remote cluster.conf.
");
+ log_err("Unable to parse remote configuration.
");
free(bdoc); bdoc = NULL;
goto reset_timer;
}
@@ -357,12 +357,12 @@
log_dbg(" Given cluster name = %s
", cluster_name);
log_dbg(" Remote cluster name= %s
", tmp_name);
if(!tmp_name){
- log_err("Unable to find cluster name in remote cluster.conf.
");
+ log_err("Unable to find cluster name in remote configuration.
");
free(bdoc); bdoc = NULL;
xmlFreeDoc(tmp_doc); tmp_doc = NULL;
goto reset_timer;
} else if(cluster_name && strcmp(cluster_name, tmp_name)){
- log_dbg("Remote and local cluster.conf have different cluster names.
");
+ log_dbg("Remote and local configuration have different cluster names.
");
log_dbg("Skipping...
");
free(tmp_name); tmp_name = NULL;
free(bdoc); bdoc = NULL;
@@ -372,7 +372,7 @@
free(tmp_name); tmp_name = NULL;
if(!master_doc->od_doc){
if((v2 = get_doc_version(tmp_doc)) >= 0){
- log_msg("Remote copy of cluster.conf (version = %d) found.
", v2);
+ log_msg("Remote configuration copy (version = %d) found.
", v2);
master_doc->od_doc = tmp_doc;
tmp_doc = NULL;
write_to_disk = 1;
@@ -381,7 +381,7 @@
if(((v1 = get_doc_version(master_doc->od_doc)) >= 0) &&
((v2 = get_doc_version(tmp_doc)) >= 0)){
if(ch->comm_flags & COMM_BROADCAST_FROM_QUORATE){
- log_msg("Remote copy of cluster.conf is from quorate node.
");
+ log_msg("Remote configuration copy is from quorate node.
");
log_msg(" Local version # : %d
", v1);
log_msg(" Remote version #: %d
", v2);
if(v1 != v2){
@@ -404,7 +404,7 @@
write_to_disk = 1;
goto out;
} else if(v2 > v1){
- log_msg("Remote copy of cluster.conf is newer than local copy.
");
+ log_msg("Remote configuration copy is newer than local copy.
");
log_msg(" Local version # : %d
", v1);
log_msg(" Remote version #: %d
", v2);
if(master_doc->od_refs){
@@ -451,23 +451,23 @@

/* ATTENTION -- its bad if we fail here, because we have an in-memory version **
** but it has not been written to disk....................................... */
- if(stat("/etc/cluster", &stat_buf)){
- if(mkdir("/etc/cluster", S_IRWXU | S_IRWXG)){
- log_sys_err("Unable to create directory /etc/cluster");
+ if(stat(DEFAULT_CONFIG_DIR, &stat_buf)){
+ if(mkdir(DEFAULT_CONFIG_DIR, S_IRWXU | S_IRWXG)){
+ log_sys_err("Unable to create directory " DEFAULT_CONFIG_DIR);
error = -errno;
goto fail;
}
} else if(!S_ISDIR(stat_buf.st_mode)){
- log_err("/etc/cluster is not a directory.
");
+ log_err(DEFAULT_CONFIG_DIR " is not a directory.
");
error = -ENOTDIR;
goto fail;
}

old_mode = umask(026);
- f = fopen("/etc/cluster/cluster.conf", "w");
+ f = fopen(DEFAULT_CONFIG_DIR "/" DEFAULT_CONFIG_FILE, "w");
umask(old_mode);
if(!f){
- log_sys_err("Unable to open /etc/cluster/cluster.conf");
+ log_sys_err("Unable to open " DEFAULT_CONFIG_DIR "/" DEFAULT_CONFIG_FILE);
error = -errno;
goto fail;
}
@@ -535,28 +535,28 @@
}

if(!master_doc->od_doc){
- master_doc->od_doc = xmlParseFile("/etc/cluster/cluster.conf");
+ master_doc->od_doc = xmlParseFile(DEFAULT_CONFIG_DIR "/" DEFAULT_CONFIG_FILE);
if(!master_doc->od_doc){
- log_msg("Unable to parse %s
", "/etc/cluster/cluster.conf");
+ log_msg("Unable to parse " DEFAULT_CONFIG_DIR "/" DEFAULT_CONFIG_FILE "
");
log_msg("Searching cluster for valid copy.
");
} else if((error = get_doc_version(master_doc->od_doc)) < 0){
- log_err("Unable to get config_version from cluster.conf.
");
+ log_err("Unable to get config_version from " DEFAULT_CONFIG_DIR "/" DEFAULT_CONFIG_FILE ".
");
log_err("Discarding data and searching for valid copy.
");
xmlFreeDoc(master_doc->od_doc);
master_doc->od_doc = NULL;
} else if(!(tmp_name = get_cluster_name(master_doc->od_doc))){
- log_err("Unable to get cluster name from cluster.conf.
");
+ log_err("Unable to get cluster name from " DEFAULT_CONFIG_DIR "/" DEFAULT_CONFIG_FILE ".
");
log_err("Discarding data and searching for valid copy.
");
xmlFreeDoc(master_doc->od_doc);
master_doc->od_doc = NULL;
} else if(cluster_name && strcmp(cluster_name, tmp_name)){
- log_err("Given cluster name does not match local cluster.conf.
");
+ log_err("Given cluster name does not match local " DEFAULT_CONFIG_DIR "/" DEFAULT_CONFIG_FILE ".
");
log_err("Discarding data and searching for matching copy.
");
xmlFreeDoc(master_doc->od_doc);
master_doc->od_doc = NULL;
free(tmp_name); tmp_name = NULL;
} else { /* Either the names match, or a name wasn't specified. */
- log_msg("cluster.conf (cluster name = %s, version = %d) found.
",
+ log_msg(DEFAULT_CONFIG_DIR "/" DEFAULT_CONFIG_FILE " (cluster name = %s, version = %d) found.
",
tmp_name, error);
/* We must check with the others to make sure this is valid. */
}
@@ -570,8 +570,8 @@
** for the config of the name specified............................... */

if(cluster_name && strcmp(cluster_name, tmp_name)){
- log_err("Request for cluster.conf with cluster name, %s
", cluster_name);
- log_err(" However, a cluster.conf with cluster name, %s, is already loaded.
",
+ log_err("Request for configuration with cluster name, %s
", cluster_name);
+ log_err(" However, a configuration with cluster name, %s, is already loaded.
",
tmp_name);
error = -EINVAL;
goto fail;
@@ -1326,11 +1326,11 @@
goto fail;
}
memset(master_doc, 0, sizeof(open_doc_t));
- master_doc->od_doc = xmlParseFile("/etc/cluster/cluster.conf");
+ master_doc->od_doc = xmlParseFile(DEFAULT_CONFIG_DIR "/" DEFAULT_CONFIG_FILE);
if(!master_doc->od_doc){
free(master_doc);
master_doc = NULL;
- log_err("Unable to parse %s.
", "/etc/cluster/cluster.conf");
+ log_err("Unable to parse " DEFAULT_CONFIG_DIR "/" DEFAULT_CONFIG_FILE ".
");
error = -ENODATA;
goto fail;
}
@@ -1370,7 +1370,7 @@
swab_header(ch); /* Swab back to dip into ch for payload_size */
memcpy(buffer+sizeof(comm_header_t), payload, ch->comm_payload_size);

- log_dbg("Sending cluster.conf (version %d)...
", get_doc_version(master_doc->od_doc));
+ log_dbg("Sending configuration (version %d)...
", get_doc_version(master_doc->od_doc));
sendlen = ch->comm_payload_size + sizeof(comm_header_t);
if(sendto(sfd, buffer, sendlen, 0,
(struct sockaddr *)&addr, (socklen_t)len) < 0){
--- cluster/ccs/daemon/globals.h 2006/01/11 16:00:55 1.5
+++ cluster/ccs/daemon/globals.h 2008/01/07 05:52:28 1.6
@@ -12,7 +12,6 @@
#ifndef __GLOBALS_H__
#define __GLOBALS_H__

-#define DEFAULT_CONFIG_LOCATION "/etc/cluster/cluster.conf"
#define DEFAULT_CCSD_LOCKFILE "/var/run/cluster/ccsd.pid"

#define EXIT_MAGMA_PLUGINS 2 /* Magma plugins are not available */
--- cluster/ccs/lib/libccs.c 2007/10/26 19:18:10 1.13
+++ cluster/ccs/lib/libccs.c 2008/01/07 05:52:28 1.14
@@ -376,10 +376,11 @@
*
* This function will only allow a connection even if the node is not
* part of a quorate cluster. It will use the configuration file
- * located in /etc/cluster/cluster.conf. If that file does not exist,
- * a copy of the file will be broadcasted for. If blocking is specified,
- * the broadcasts will be retried until a config file is located. Otherwise,
- * the fuction will return an error if the initial broadcast is not successful.
+ * as specified at build time (default: /etc/cluster/cluster.conf). If that
+ * file does not exist, a copy of the file will be broadcasted for. If
+ * blocking is specified, the broadcasts will be retried until a config file
+ * is located. Otherwise, the fuction will return an error if the initial
+ * broadcast is not successful.
*
* Returns: ccs_desc on success, < 0 on failure
*/
--- cluster/cman/daemon/cmanccs.c 2008/01/02 16:35:44 1.39
+++ cluster/cman/daemon/cmanccs.c 2008/01/07 05:52:28 1.40
@@ -35,7 +35,7 @@

#define DEFAULT_PORT 5405
#define DEFAULT_CLUSTER_NAME "RHCluster"
-#define NOCCS_KEY_FILENAME "/etc/cluster/cman_authkey"
+#define NOCCS_KEY_FILENAME DEFAULT_CONFIG_DIR "/cman_authkey"

#define CONFIG_VERSION_PATH "/cluster/@config_version"
#define CLUSTER_NAME_PATH "/cluster/@name"
@@ -588,9 +588,9 @@
/* Find our nodename in cluster.conf */
error = verify_nodename(cd, nodename);
if (error) {
- log_printf(LOG_ERR, "local node name "%s" not found in cluster.conf",
+ log_printf(LOG_ERR, "local node name "%s" not found in the configuration",
nodename);
- write_cman_pipe("Can't find local node name in cluster.conf");
+ write_cman_pipe("Can't find local node name in the configuration");
error = -ENOENT;
goto out;
}
@@ -707,7 +707,7 @@
}

if (!nodeid) {
- log_printf(LOG_ERR, "No nodeid specified in cluster.conf");
+ log_printf(LOG_ERR, "No nodeid specified in configuration file");
write_cman_pipe("CCS does not have a nodeid for this node, run 'ccs_tool addnodeids' to fix");
return -EINVAL;
}
/cvs/cluster/cluster/cman/init.d/cman.in,v --> standard output
revision 1.1
--- cluster/cman/init.d/cman.in
+++ - 2008-01-07 05:52:30.853759000 +0000
@@ -0,0 +1,554 @@
+#!/bin/bash
+#
+# chkconfig: 345 21 79
+# description: Starts and stops cman
+#
+#
+### BEGIN INIT INFO
+# Provides:
+### END INIT INFO
+. /etc/init.d/functions
+
+[ -f /etc/sysconfig/cman ] && . /etc/sysconfig/cman
+[ -z "$CCSD_OPTS" ] && CCSD_OPTS=
+
+# CMAN_CLUSTER_TIMEOUT -- amount of time to wait for joinging a cluster
+# before giving up. If CMAN_CLUSTER_TIMEOUT is positive, then we will
+# wait CMAN_CLUSTER_TIMEOUT seconds before giving up and failing when
+# a cluster is not joined. If CMAN_CLUSTER_TIMEOUT is zero, then
+# wait indefinately for a cluster join. If CMAN_CLUSTER_TIMEOUT is
+# negative, do not check to see that the cluster has been joined
+[ -z "$CMAN_CLUSTER_TIMEOUT" ] && CMAN_CLUSTER_TIMEOUT=120
+
+# CMAN_QUORUM_TIMEOUT -- amount of time to wait for a quorate cluster on
+# startup quorum is needed by many other applications, so we may as
+# well wait here. If CMAN_QUORUM_TIMEOUT is less than 1, quorum will
+# be ignored.
+#CMAN_QUORUM_TIMEOUT=300
+[ -z "$CMAN_QUORUM_TIMEOUT" ] && CMAN_QUORUM_TIMEOUT=0
+
+# CMAN_SHUTDOWN_TIMEOUT -- amount of time to wait for cman to become a
+# cluster member before calling cman_tool leave during shutdown.
+# default is 60 seconds
+[ -z "$CMAN_SHUTDOWN_TIMEOUT" ] && CMAN_SHUTDOWN_TIMEOUT=60
+
+# FENCED_START_TIMEOUT -- amount of time to wait for starting fenced
+# before giving up. If FENCED_START_TIMEOUT is positive, then we will
+# wait FENCED_START_TIMEOUT seconds before giving up and failing when
+# fenced does not start. If FENCED_START_TIMEOUT is zero, then
+# wait indefinately for fenced to start.
+[ -z "$FENCED_START_TIMEOUT" ] && FENCED_START_TIMEOUT=300
+
+# NET_RMEM_DEFAULT -- minimum value for rmem_default. If this is set
+# higher elsewhere it will not be reduced here.
+# These two values are only really needed for the DLM when using sctp
+# but do no harm.
+[ -z "$NET_RMEM_DEFAULT" ] && NET_RMEM_DEFAULT=4194304
+
+# NET_RMEM_MAX -- minimum value for rmem_max. If this is set
+# higher elsewhere it will not be reduced here.
+[ -z "$NET_RMEM_MAX" ] && NET_RMEM_MAX=4194304
+
+[ -z "$LOCK_FILE" ] && LOCK_FILE="/var/lock/subsys/cman"
+
+[ -n "$CLUSTERNAME" ] && cman_join_opts="-c $CLUSTERNAME"
+
+load_modules()
+{
+ errmsg=$( /sbin/modprobe configfs 2>&1 ) || return 1
+ errmsg=$( /sbin/modprobe dlm 2>&1 ) || return 1
+ errmsg=$( /sbin/modprobe lock_dlm 2>&1 ) || return 1
+ return 0
+}
+
+start_configfs()
+{
+ # configfs
+ awk '{ print $2 }' /etc/mtab | grep "/sys/kernel/config" &> /dev/null
+ && awk '{ print $3 }' /etc/mtab | grep "configfs" &> /dev/null
+ if [ $? -ne 0 ]
+ then
+ errmsg=$( /bin/mount -t configfs none /sys/kernel/config 2>&1 )
+ return $?
+ fi
+ return 0
+}
+
+start_ccsd()
+{
+ # ccsd
+ status ccsd &> /dev/null
+ if [ $? -ne 0 ]
+ then
+ errmsg=$(/sbin/ccsd $CCSD_OPTS 2>&1)
+ rtrn=$?
+ return $rtrn
+ fi
+ return 0
+}
+
+start_cman()
+{
+ # cman
+ /usr/sbin/cman_tool status &> /dev/null
+ if [ $? -ne 0 ]
+ then
+ errmsg=$( /usr/sbin/cman_tool -t $CMAN_CLUSTER_TIMEOUT -w join
+ $cman_join_opts 2>&1 ) || return 1
+
+ if [ $CMAN_QUORUM_TIMEOUT -gt 0 ]
+ then
+ errmsg=$( /usr/sbin/cman_tool -t $CMAN_QUORUM_TIMEOUT
+ -q wait 2>&1 ) || return 1
+ fi
+ fi
+ return 0
+}
+
+start_daemons()
+{
+ status groupd &> /dev/null
+ if [ $? -ne 0 ]; then
+ errmsg=$( /sbin/groupd 2>&1 ) || return 1
+ fi
+ status fenced &> /dev/null
+ if [ $? -ne 0 ]; then
+ errmsg=$( /sbin/fenced 2>&1 ) || return 1
+ fi
+ status dlm_controld &> /dev/null
+ if [ $? -ne 0 ]; then
+ errmsg=$( /sbin/dlm_controld 2>&1 ) || return 1
+ fi
+ status gfs_controld &> /dev/null
+ if [ $? -ne 0 ]; then
+ errmsg=$( /sbin/gfs_controld 2>&1 ) || return 1
+ fi
+ return 0
+}
+
+start_fence()
+{
+ errmsg=$( /sbin/fence_tool -w -t $FENCED_START_TIMEOUT join
+ > /dev/null 2>&1 ) || return 1
+ return 0
+}
+
+start_fence_xvmd()
+{
+ status fence_xvmd &> /dev/null
+ if [ $? -ne 0 ]; then
+ errmsg=$( /sbin/fence_xvmd $FENCE_XVMD_OPTS 2>&1 ) || return 1
+ fi
+ return 0
+}
+
+xend_bridged_net_enabled() {
+ # Not a xen kernel
+ test -d /proc/xen || return 1
+
+ current_runlevel=$(/sbin/runlevel 2>/dev/null | awk '{ print $2 }' 2>/dev/null)
+ if [ -z "$current_runlevel" ]; then
+ errmsg='Unable to determine the current runlevel'
+ return 1
+ fi
+
+ /sbin/chkconfig --levels "$current_runlevel" xend 2>/dev/null
+ if [ $? -ne 0 ]; then
+ # xend doesn't start at this runlevel.
+ return 1
+ fi
+
+ if [ ! -f /etc/xen/xend-config.sxp ]; then
+ # xend isn't configured to use bridged networking.
+ return 1
+ fi
+
+ egrep "^[[:blank:]]*([[:blank:]]*network-script[[:blank:]]+(')*[[:blank:]]*network-bridge([[:blank:]]*)|[[:blank:]]+)" /etc/xen/xend-config.sxp >&/dev/null
+ if [ $? -ne 0 ]; then
+ # xend isn't configured to use bridged networking.
+ return 1
+ fi
+ return 0
+}
+
+xend_bridged_net_start() {
+ if [ ! -x /etc/xen/scripts/network-bridge ]; then
+ if [ -f /etc/xen/scripts/network-bridge ]; then
+ errmsg='The xend bridged network script cannot be run'
+ else
+ errmsg='The xend bridged network script is missing'
+ fi
+ return 1
+ fi
+
+ /sbin/modprobe netbk >& /dev/null
+ /sbin/modprobe netloop >& /dev/null
+ errmsg=$(/etc/xen/scripts/network-bridge start 2>&1) || return 1
+ return 0
+}
+
+fence_xvmd_enabled()
+{
+ #
+ # Check for the 'xm' binary. If it's not here, we are not
+ # running on a machine capable of running xvmd.
+ #
+ which xm &> /dev/null || return 1
+
+ #
+ # Check for presence of Domain-0; if it's not there, we can't
+ # run xvmd.
+ #
+ xm list --long 2> /dev/null | grep -q "Domain-0" || return 1
+
+ #
+ # Check for presence of /cluster/fence_xvmd in cluster.conf
+ # (If -X is specified, it doesn't matter if it's in cluster.conf;
+ # we'll start it anyway since ccsd is not required)
+ #
+ if [ "$FENCE_XVMD_OPTS" = "${FENCE_XVMD_OPTS/-X/}" ]; then
+ xmllint --shell @CONFDIR@/@CONFFILE@ 2> /dev/null
+ < <(echo ls cluster) | grep -q fence_xvmd || return 1
+ fi
+
+ return 0
+}
+
+set_networking_params()
+{
+ if [ ! -f /proc/sys/net/core/rmem_default ]
+ then
+ return 0;
+ fi
+
+ value="$(cat /proc/sys/net/core/rmem_default)"
+ if [ $value -le $NET_RMEM_DEFAULT ]
+ then
+ echo $NET_RMEM_DEFAULT > /proc/sys/net/core/rmem_default
+ fi
+
+ value="$(cat /proc/sys/net/core/rmem_max)"
+ if [ $value -le $NET_RMEM_MAX ]
+ then
+ echo $NET_RMEM_MAX > /proc/sys/net/core/rmem_max
+ fi
+}
+
+start()
+{
+ echo "Starting cluster: "
+
+ xend_bridged_net_enabled
+ if [ $? -eq 0 ]
+ then
+ echo -n " Enabling workaround for Xend bridged networking... "
+ xend_bridged_net_start
+ if [ $? -eq 0 ]
+ then
+ echo "done"
+ else
+ echo "failed: $errmsg"
+ return 1
+ fi
+ fi
+ echo -n " Loading modules... "
+ ulimit -c unlimited
+ load_modules
+ if [ $? -eq 0 ]
+ then
+ echo "done"
+ else
+ echo "failed"
+ return 1
+ fi
+ echo -n " Mounting configfs... "
+ start_configfs
+ if [ $? -eq 0 ]
+ then
+ echo "done"
+ else
+ echo "failed"
+ return 1
+ fi
+ echo -n " Setting network parameters... "
+ set_networking_params
+ if [ $? -eq 0 ]
+ then
+ echo "done"
+ else
+ echo "failed"
+ return 1
+ fi
+ echo -n " Starting ccsd... "
+ start_ccsd
+ if [ $? -eq 0 ]
+ then
+ echo "done"
+ else
+ echo "failed"
+ return 1
+ fi
+ echo -n " Starting cman... "
+ start_cman
+ if [ $? -eq 0 ]
+ then
+ echo "done"
+ else
+ echo "failed"
+ return 1
+ fi
+ echo -n " Starting daemons... "
+ start_daemons
+ if [ $? -eq 0 ]
+ then
+ echo "done"
+ else
+ echo "failed"
+ return 1
+ fi
+ echo -n " Starting fencing... "
+ start_fence
+ if [ $? -eq 0 ]
+ then
+ echo "done"
+ else
+ echo "failed"
+ return 1
+ fi
+
+ if fence_xvmd_enabled; then
+ echo -n " Starting virtual machine fencing host... "
+ start_fence_xvmd
+ if [ $? -eq 0 ]
+ then
+ echo "done"
+ else
+ echo "failed"
+ return 1
+ fi
+ fi
+
+ return 0
+}
+
+stop_configfs()
+{
+ awk '{ print $2 }' /etc/mtab | grep "/sys/kernel/config" &> /dev/null
+ && awk '{ print $3 }' /etc/mtab | grep "configfs" &> /dev/null
+ if [ $? -eq 0 ]
+ then
+ errmsg=$( /bin/umount /sys/kernel/config 2>&1 )
+ if [ $? -ne 0 ]
+ then
+ echo -n $errmsg " "
+ fi
+ fi
+ return 0
+}
+
+stop_ccsd()
+{
+ for sec in $(seq 1 10)
+ do
+ if /sbin/pidof ccsd &> /dev/null
+ then
+ # get the pid of ccsd from /var/run/cluster/ccsd.pid
+ # and break if the file is not there
+ [ -r /var/run/cluster/ccsd.pid ] || break
+
+ pid=$(cat /var/run/cluster/ccsd.pid)
+ /usr/bin/kill $pid &> /dev/null || break
+
+ sleep 1
+ else
+ return 0
+ fi
+ done
+ return 1
+}
+
+stop_cman()
+{
+ /usr/sbin/cman_tool status &> /dev/null
+ if [ $? -eq 0 ]
+ then
+ errmsg=$( /usr/sbin/cman_tool -t $CMAN_SHUTDOWN_TIMEOUT
+ -w leave $1 2>&1 ) || return 1
+ fi
+ return 0 # all ok
+}
+
+stop_daemons()
+{
+ if pid=$(/sbin/pidof gfs_controld 2>&1); then
+ errmsg=$(/usr/bin/kill $pid 2>&1) || return 1
+ fi
+ if pid=$(/sbin/pidof dlm_controld 2>&1); then
+ errmsg=$(/usr/bin/kill $pid 2>&1) || return 1
+ fi
+ if pid=$(/sbin/pidof fenced 2>&1); then
+ errmsg=$(/usr/bin/kill $pid 2>&1) || return 1
+ fi
+ if pid=$(/sbin/pidof groupd 2>&1); then
+ errmsg=$(/usr/bin/kill $pid 2>&1) || return 1
+ fi
+ return 0 # all ok
+}
+
+stop_fence()
+{
+ if /sbin/pidof fenced &> /dev/null
+ then
+ /sbin/fence_tool -w leave > /dev/null 2>&1
+ rtrn=$?
+ sleep 1 # A bit of time for fenced to exit
+ return $rtrn
+ fi
+ return 0 # all ok
+}
+
+stop_fence_xvmd()
+{
+ if /sbin/pidof fence_xvmd &> /dev/null
+ then
+ pkill -TERM fence_xvmd
+ sleep 1 # A bit of time for fenced to exit
+ fi
+
+ [ -z "`pidof fence_xvmd`" ]
+ return $?
+}
+
+stop()
+{
+ echo "Stopping cluster: "
+ if fence_xvmd_enabled; then
+ echo -n " Stopping virtual machine fencing host... "
+ stop_fence_xvmd
+ if [ $? -eq 0 ]
+ then
+ echo "done"
+ else
+ echo "failed"
+ return 1
+ fi
+ fi
+ echo -n " Stopping fencing... "
+ stop_fence
+ if [ $? -eq 0 ]
+ then
+ echo "done"
+ else
+ echo "failed"
+ return 1
+ fi
+ echo -n " Stopping cman... "
+ if [ $1 ]; then
+ stop_cman $1
+ else
+ stop_cman
+ fi
+ if [ $? -eq 0 ]
+ then
+ echo "done"
+ else
+ echo "failed"
+ return 1
+ fi
+# stop_daemons
+# [ $? -ne 0 ] && return 1
+ echo -n " Stopping ccsd... "
+ stop_ccsd
+ if [ $? -eq 0 ]
+ then
+ echo "done"
+ else
+ echo "failed"
+ return 1
+ fi
+ echo -n " Unmounting configfs... "
+ stop_configfs
+ if [ $? -eq 0 ]
+ then
+ echo "done"
+ else
+ echo "failed"
+ return 1
+ fi
+
+ return 0
+}
+
+cmanstatus()
+{
+ errmsg=$( status ccsd 2>&1) || return 1
+ errmsg=$( status groupd 2>&1) || return 1
+ errmsg=$( status fenced 2>&1) || return 1
+ errmsg=$( status dlm_controld 2>&1) || return 1
+ errmsg=$( status gfs_controld 2>&1) || return 1
+
+ fence_xvmd_enabled || return 0
+ errmsg=$( status fence_xvmd 2>&1) || return 1
+
+ return 0
+}
+
+rtrn=1
+
+# See how we were called.
+case "$1" in
+ start)
+ start
+ rtrn=$?
+ [ $rtrn = 0 ] && touch $LOCK_FILE
+ if [ $rtrn -ne 0 ]
+ then
+ echo $errmsg
+ failure "failed to start cman"
+ echo
+ else
+ success "start"
+ echo
+ fi
+ ;;
+ stop)
+ if [ $2 ]; then
+ stop
+ else
+ stop remove
+ fi
+ rtrn=$?
+ [ $rtrn = 0 ] && rm -f $LOCK_FILE
+ if [ $rtrn -ne 0 ]
+ then
+ echo $errmsg
+ failure "failed to stop cman"
+ echo
+ else
+ success "shutdown"
+ echo
+ fi
+ ;;
+
+ restart)
+ $0 stop restart
+ $0 start
+ rtrn=$?
+ ;;
+
+ status)
+ cmanstatus
+ rtrn=$?
+ if [ $rtrn -ne 0 ] ; then
+ echo $errmsg
+ else
+ echo "cman is running."
+ fi
+ ;;
+
+ *)
+ echo $"Usage: $0 {start|stop|restart|status}"
+ ;;
+esac
+
+exit $rtrn
--- cluster/cman/init.d/Makefile 2007/12/22 13:36:50 1.8
+++ cluster/cman/init.d/Makefile 2008/01/07 05:52:28 1.9
@@ -10,15 +10,22 @@
################################################## #############################
################################################## #############################

-TARGETS= cman qdiskd
+TARGET=cman

-INITDT=$(TARGETS)
+INITDT=$(TARGET1) qdiskd

-all:
+all: $(TARGET)

include ../../make/defines.mk
+include $(OBJDIR)/make/clean.mk
include $(OBJDIR)/make/install.mk
include $(OBJDIR)/make/uninstall.mk

+$(TARGET):
+ cat $(TARGET).in | sed
+ -e 's#@CONFDIR@#${CONFDIR}#g'
+ -e 's#@CONFFILE@#${CONFFILE}#g'
+ > $(TARGET)
+ chmod 755 $(TARGET)

-clean:
+clean: generalclean
--- cluster/fence/agents/xvm/options.c 2007/06/26 17:23:41 1.5
+++ cluster/fence/agents/xvm/options.c 2008/01/07 05:52:28 1.6
@@ -303,7 +303,7 @@
assign_auth },

{ 'k', "-k <file>", "key_file",
- "Shared key file (default=/etc/cluster/fence_xvm.key)",
+ "Shared key file (default=" DEFAULT_CONFIG_DIR "/fence_xvm.key)",
assign_key },

{ 'o', "-o <operation>", "option",
--- cluster/fence/agents/xvm/simple_auth.h 2006/10/05 16:11:36 1.1
+++ cluster/fence/agents/xvm/simple_auth.h 2008/01/07 05:52:28 1.2
@@ -22,7 +22,7 @@
#include <sys/types.h>

/* 2-way challenge/response simple auth */
-#define DEFAULT_KEY_FILE "/etc/cluster/fence_xvm.key"
+#define DEFAULT_KEY_FILE DEFAULT_CONFIG_DIR "/fence_xvm.key"

int read_key_file(char *, char *, size_t);
int tcp_challenge(int, fence_auth_type_t, void *, size_t, int);
--- cluster/fence/fenced/main.c 2007/10/26 19:33:47 1.45
+++ cluster/fence/fenced/main.c 2008/01/07 05:52:28 1.46
@@ -97,7 +97,7 @@

error = ccs_get(cd, path, &str);
if (error)
- die1("local cman node name "%s" not found in cluster.conf",
+ die1("local cman node name "%s" not found in the configuration",
our_name);


@@ -528,7 +528,7 @@
printf(" -h Print this help, then exit
");
printf(" -V Print program version information, then exit
");
printf("
");
- printf("Command line values override those in cluster.conf.
");
+ printf("Command line values override those in " DEFAULT_CONFIG_DIR "/" DEFAULT_CONFIG_FILE ".
");
printf("For an unbounded delay use <secs> value of -1.
");
printf("
");
}
--- cluster/make/defines.mk.input 2007/12/20 22:10:04 1.9
+++ cluster/make/defines.mk.input 2008/01/07 05:52:28 1.10
@@ -27,7 +27,8 @@
AR = ar
RANLIB = ranlib

-CFLAGS += @CFLAGS@ -I@SRCDIR@/config
+CFLAGS += @CFLAGS@ -I@SRCDIR@/config
+CFLAGS += -DDEFAULT_CONFIG_DIR="@CONFDIR@" -DDEFAULT_CONFIG_FILE="@CONFFILE@"
LDFLAGS += @LDFLAGS@

SRCDIR = @SRCDIR@
@@ -80,6 +81,9 @@
THISDIR = $(shell echo $(CURDIR) | sed -e 's|$(OBJDIR)/||g')
S=$(SRCDIR)/$(THISDIR)

+CONFDIR=@CONFDIR@
+CONFFILE=@CONFFILE@
+
UNINSTALL = @SRCDIR@/scripts/uninstall.pl
DEF2VAR = @SRCDIR@/scripts/define2var

/cvs/cluster/cluster/rgmanager/init.d/rgmanager.in,v --> standard output
revision 1.1
--- cluster/rgmanager/init.d/rgmanager.in
+++ - 2008-01-07 05:52:31.808705000 +0000
@@ -0,0 +1,151 @@
+#!/bin/sh
+#
+# Copyright (C) 2003 Red Hat, Inc.
+#
+# This program is Free Software. You may modify and/or redistribute it under
+# the terms of the GNU General Public License version 2, or (at your option)
+# any later version.
+#
+# description: Starts and stops Red Hat Service (resource group) Manager
+# chkconfig: 2345 99 01
+#
+
+# Source function library
+. /etc/init.d/functions
+
+# Grab the network config file
+. /etc/sysconfig/network
+
+# Grab cluster start config if it exists
+[ -f /etc/sysconfig/cluster ] && . /etc/sysconfig/cluster
+
+PATH=/sbin:/bin:/usr/sbin:/usr/bin
+
+export PATH
+
+ID="Cluster Service Manager"
+RGMGRD="clurgmgrd"
+CFG_FILE="@CONFDIR@/@CONFFILE@"
+
+LOG_ERR=3
+LOG_WARNING=4
+LOG_NOTICE=5
+LOG_INFO=6
+
+
+#
+# log_and_print <level> <message>
+#
+log_and_print()
+{
+ if [ -z "$1" -o -z "$2" ]; then
+ return 1;
+ fi
+
+ clulog -p $$ -n "rgmanager" -s $1 "$2"
+ echo $2
+
+ return 0;
+}
+
+
+#
+# Bring down the cluster on a node.
+#
+stop_cluster()
+{
+ kill -TERM `pidof $RGMGRD`
+
+ while [ 0 ]; do
+
+ if [ -n "`pidof $RGMGRD`" ]; then
+ echo -n $"Waiting for services to stop: "
+ while [ -n "`pidof $RGMGRD`" ]; do
+ sleep 1
+ done
+ echo_success
+ echo
+ else
+ echo $"Services are stopped."
+ fi
+
+ # Ensure all NFS rmtab daemons are dead.
+ killall $RMTABD &> /dev/null
+
+ rm -f /var/run/$RGMGRD.pid
+
+ return 0
+ done
+}
+
+
+case $1 in
+ start)
+ #
+ # If we're not configured, then don't start anything.
+ #
+ if [ "${NETWORKING}" != "yes" ]; then
+ echo "Cannot start $ID: Networking not configured"
+ exit 1
+ fi
+ [ -f "$CFG_FILE" ] || exit 0
+
+ echo -n $"Starting $ID: "
+ daemon $RGMGRD $RGMGR_OPTS
+ ret=$?
+ echo
+
+ # To be consistent...
+ if [ $ret -eq 0 ]; then
+ touch /var/lock/subsys/rgmanager
+ fi
+ exit $ret
+ ;;
+
+ restart)
+ $0 status &> /dev/null
+ if [ $? -ne 1 ]; then
+ $0 stop
+ fi
+ $0 start
+ ;;
+
+ condrestart)
+ $0 status $> /dev/null
+ if [ $? -eq 0 ]; then
+ $0 stop
+ $0 start
+ fi
+ ;;
+
+ reload)
+ clulog -p $LOG_NOTICE "Reloading Resource Configuration."
+ echo -n $"Reloading Resource Configuration: "
+ killproc $RGMGRD -HUP
+ rv=$?
+ echo
+
+ exit $rv
+ ;;
+
+ status)
+ status $RGMGRD
+ exit $?
+ ;;
+
+ stop)
+ if [ -n "`pidof $RGMGRD`" ]; then
+ log_and_print $LOG_NOTICE "Shutting down $ID..."
+ stop_cluster
+ fi
+
+ rm -f /var/lock/subsys/rgmanager
+ log_and_print $LOG_NOTICE "$ID is stopped."
+ ;;
+ *)
+ echo "usage: $0 {start|restart|condrestart|reload|status|stop}"
+ exit 1
+ ;;
+esac
+
+exit 0
--- cluster/rgmanager/init.d/Makefile 2007/12/22 13:36:58 1.7
+++ cluster/rgmanager/init.d/Makefile 2008/01/07 05:52:29 1.8
@@ -14,13 +14,20 @@

INITDT=$(TARGET)

-all:
+all: $(TARGET)

include ../../make/defines.mk
+include $(OBJDIR)/make/clean.mk
include $(OBJDIR)/make/install.mk
include $(OBJDIR)/make/uninstall.mk

+$(TARGET):
+ cat $(TARGET).in | sed
+ -e 's#@CONFDIR@#${CONFDIR}#g'
+ -e 's#@CONFFILE@#${CONFFILE}#g'
+ > $(TARGET)
+ chmod 755 $(TARGET)

-clean:
+clean: generalclean

check:
--- cluster/rgmanager/src/daemons/rg_locks.c 2007/03/27 19:33:20 1.9
+++ cluster/rgmanager/src/daemons/rg_locks.c 2008/01/07 05:52:29 1.10
@@ -50,7 +50,7 @@

#ifdef NO_CCS
static xmlDocPtr ccs_doc = NULL;
-static char *conffile = "/etc/cluster/cluster.conf";
+static char *conffile = DEFAULT_CONFIG_DIR "/" DEFAULT_CONFIG_FILE;
#endif

int
--- cluster/rgmanager/src/resources/Makefile 2008/01/03 21:02:53 1.25
+++ cluster/rgmanager/src/resources/Makefile 2008/01/07 05:52:29 1.26
@@ -10,9 +10,12 @@
################################################## #############################
################################################## #############################

-all:
+TARGET= utils/config-utils.sh
+
+all: $(TARGET)

include ../../../make/defines.mk
+include $(OBJDIR)/make/clean.mk

RESOURCES=fs.sh service.sh ip.sh nfsclient.sh nfsexport.sh
script.sh netfs.sh clusterfs.sh smb.sh
@@ -24,20 +27,25 @@
mysql.metadata postgres-8.metadata tomcat-5.metadata
named.metadata lvm.metadata

-TARGETS=ocf-shellfuncs svclib_nfslock default_event_script.sl
+GENERAL_TARGETS=ocf-shellfuncs svclib_nfslock default_event_script.sl

UTIL_TARGETS=
utils/config-utils.sh utils/ra-skelet.sh utils/messages.sh
utils/httpd-parse-config.pl utils/tomcat-parse-config.pl
utils/member_util.sh

+$(TARGET):
+ cat $(TARGET).in | sed
+ -e 's#@CONFDIR@#${CONFDIR}#g'
+ -e 's#@CONFFILE@#${CONFFILE}#g'
+ > $(TARGET)

install: all
install -d ${sharedir}/utils
for i in $(RESOURCES); do
install $(S)/$$i ${sharedir};
done
- for i in $(TARGETS) $(METADATA); do
+ for i in $(GENERAL_TARGETS) $(METADATA); do
install -m 644 $(S)/$$i ${sharedir};
done
for i in $(UTIL_TARGETS); do
@@ -45,9 +53,9 @@
done

uninstall:
- ${UNINSTALL} ${RESOURCES} ${TARGETS} ${METADATA} ${UTIL_TARGETS} ${sharedir}
+ ${UNINSTALL} ${RESOURCES} ${GENERAL_TARGETS} ${METADATA} ${UTIL_TARGETS} ${sharedir}

-clean:
+clean: generalclean

check: $(RESOURCES) ra-api-1-modified.dtd
@echo Validating resource agent meta-data
/cvs/cluster/cluster/rgmanager/src/resources/utils/config-utils.sh.in,v --> standard output
revision 1.1
--- cluster/rgmanager/src/resources/utils/config-utils.sh.in
+++ - 2008-01-07 05:52:32.308593000 +0000
@@ -0,0 +1,299 @@
+#!/bin/bash
+
+#
+# Copyright Red Hat, Inc. 2006
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 2, or (at your option) any
+# later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; see the file COPYING. If not, write to the
+# Free Software Foundation, Inc., 675 Mass Ave, Cambridge,
+# MA 02139, USA.
+#
+
+declare RA_COMMON_pid_dir=/var/run/cluster
+declare RA_COMMON_conf_dir=@CONFDIR@
+
+declare -i FAIL=-1
+declare -a ip_keys
+
+generate_configTemplate()
+{
+ cat > $1 << EOT
+#
+# "$1" was created from the "$2"
+#
+# This template configuration was automatically generated, and will be
+# automatically regenerated if removed. Once this file has been altered,
+# automatic re-generation will stop. Remember to copy this file to all
+# other cluster members after making changes, or your service will not
+# operate correctly.
+#
+EOT
+}
+
+sha1_addToFile()
+{
+ declare sha1line="# rgmanager-sha1 $(sha1sum "$1")"
+ echo $sha1line >> "$1"
+}
+
+sha1_verify()
+{
+ declare sha1_new sha1_old
+ declare oldFile=$1
+
+ ocf_log debug "Checking: SHA1 checksum of config file $oldFile"
+
+ sha1_new=`cat $oldFile | grep -v "# rgmanager-sha1" | sha1sum | sed 's/^([a-z0-9]+) .*$/1/'`
+ sha1_old=`tail -n 1 $oldFile | sed 's/^# rgmanager-sha1 (.*)$/1/' | sed 's/^([a-z0-9]+) .*$/1/'`
+
+ if [ $sha1_new = $sha1_old ]; then
+ ocf_log debug "Checking: SHA1 checksum > succeed"
+ return 0;
+ else
+ ocf_log debug "Checking: SHA1 checksum > failed - file changed"
+ return 1;
+ fi
+}
+
+#
+# Usage: ccs_connect
+# Returns: $FAIL on failure, or a connection descriptor on success
+#
+ccs_connect()
+{
+ declare outp
+
+ outp=$(ccs_test connect 2>&1)
+ if [ $? -ne 0 ]; then
+ ocf_log err "$outp"
+ return $FAIL
+ fi
+
+ outp=${outp/*= /}
+ if [ -n "$outp" ]; then
+ echo $outp
+ return 0
+ fi
+
+ return 1
+}
+
+#
+# Usage: ccs_disconnect descriptor
+#
+ccs_disconnect()
+{
+ declare outp
+
+ [ -n "$1" ] || return $FAIL
+ outp=$(ccs_test disconnect $1 2>&1)
+ if [ $? -ne 0 ]; then
+ ocf_log warn "Disconnect CCS desc $1 failed: $outp"
+ return 1
+ fi
+ return 0
+}
+
+#
+# Usage: ccs_get desc key
+#
+ccs_get()
+{
+ declare outp
+ declare ccsfd=$1
+ declare key
+
+ [ -n "$1" ] || return $FAIL
+ [ -n "$2" ] || return $FAIL
+
+ shift
+ key="$*"
+
+ outp=$(ccs_test get $ccsfd "$key" 2>&1)
+ if [ $? -ne 0 ]; then
+ if [ "$outp" = "${outp/No data available/}" ]; then
+ ocf_log err "$outp ($key)"
+ return $FAIL
+ fi
+
+ # no real error, just no data available
+ return 0
+ fi
+
+ outp=${outp/*</}
+ outp=${outp/>*/}
+
+ echo $outp
+
+ return 0
+}
+
+#
+# Build a list of service IP keys; traverse refs if necessary
+# Usage: get_service_ip_keys desc serviceName
+#
+get_service_ip_keys()
+{
+ declare ccsfd=$1
+ declare svc=$2
+ declare -i x y=0
+ declare outp
+ declare key
+
+ if [ $ccsfd -eq $FAIL ]; then
+ ocf_log err "Can not talk to ccsd: invalid descriptor $ccsfd"
+ return 1
+ fi
+
+ #
+ # Find service-local IP keys
+ #
+ x=1
+ while : ; do
+ key="/cluster/rm/service[@name="$svc"]/ip[$x]"
+
+ #
+ # Try direct method
+ #
+ outp=$(ccs_get $ccsfd "$key/@address")
+ if [ $? -ne 0 ]; then
+ return 1
+ fi
+
+ #
+ # Try by reference
+ #
+ if [ -z "$outp" ]; then
+ outp=$(ccs_get $ccsfd "$key/@ref")
+ if [ $? -ne 0 ]; then
+ return 1
+ fi
+ key="/cluster/rm/resources/ip[@address="$outp"]"
+ fi
+
+ if [ -z "$outp" ]; then
+ break
+ fi
+
+ #ocf_log debug "IP $outp found @ $key"
+
+ ip_keys[$y]="$key"
+
+ ((y++))
+ ((x++))
+ done
+
+ ocf_log debug "$y IP addresses found for $svc/$OCF_RESKEY_name"
+
+ return 0
+}
+
+build_ip_list()
+{
+ declare -i ccsfd=$1
+ declare ipaddrs ipaddr
+ declare -i x=0
+
+ while [ -n "${ip_keys[$x]}" ]; do
+ ipaddr=$(ccs_get $ccsfd "${ip_keys[$x]}/@address")
+ if [ -z "$ipaddr" ]; then
+ break
+ fi
+
+ ipaddrs="$ipaddrs $ipaddr"
+ ((x++))
+ done
+
+ echo $ipaddrs
+}
+
+generate_name_for_pid_file()
+{
+ declare filename=$(basename $0)
+
+ echo "$RA_COMMON_pid_dir/$(basename $0 | sed 's/^(.*)..*/1/')/$OCF_RESOURCE_INSTANCE.pid"
+
+ return 0;
+}
+
+generate_name_for_pid_dir()
+{
+ declare filename=$(basename $0)
+
+ echo "$RA_COMMON_pid_dir/$(basename $0 | sed 's/^(.*)..*/1/')/$OCF_RESOURCE_INSTANCE"
+
+ return 0;
+}
+
+generate_name_for_conf_dir()
+{
+ declare filename=$(basename $0)
+
+ echo "$RA_COMMON_conf_dir/$(basename $0 | sed 's/^(.*)..*/1/')/$OCF_RESOURCE_INSTANCE"
+
+ return 0;
+}
+
+create_pid_directory()
+{
+ declare program_name="$(basename $0 | sed 's/^(.*)..*/1/')"
+ declare dirname="$RA_COMMON_pid_dir/$program_name"
+
+ if [ -d "$dirname" ]; then
+ return 0;
+ fi
+
+ chmod 711 "$RA_COMMON_pid_dir"
+ mkdir -p "$dirname"
+
+ if [ "$program_name" = "mysql" ]; then
+ chown mysql.root "$dirname"
+ elif [ "$program_name" = "tomcat-5" ]; then
+ chown tomcat.root "$dirname"
+ fi
+
+ return 0;
+}
+
+create_conf_directory()
+{
+ declare dirname="$1"
+
+ if [ -d "$dirname" ]; then
+ return 0;
+ fi
+
+ mkdir -p "$dirname"
+
+ return 0;
+}
+
+check_pid_file() {
+ declare pid_file="$1"
+
+ if [ -z "$pid_file" ]; then
+ return 1;
+ fi
+
+ if [ ! -e "$pid_file" ]; then
+ return 0;
+ fi
+
+ if [ ! -d /proc/`cat "$pid_file"` ]; then
+ rm "$pid_file"
+ ocf_log debug "PID File "$pid_file" Was Removed - PID Does Not Exist";
+ return 0;
+ fi
+
+ return 1;
+}
 

Thread Tools




All times are GMT. The time now is 05:40 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org