Skip to contentSkip to conversation

cluster ./configure ccs/ccs_tool/editconf.c cc ...

Cluster-devel [email protected] 1 participant 1 message Jan 7, 2008

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/cluster
Module name: cluster
Changes by: fabbione at 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

configure +14 -0
@@ -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=\tthe base directory for libraries.  (Default: {prefix}/lib)\n";
   print "--libexecdir=\tthe base directory for executable components.  (Default: {prefix}/libexec)\n";
   print "--sharedir=\tthe base directory for misc cluster files.  (Default: {prefix}/share/cluster)\n";
+  print "--confdir=\tthe cluster config directory.  (Default: /etc/cluster)\n";
+  print "--conffile=\tthe cluster config file.  (Default: cluster.conf)\n";
   print "--mandir=\tthe base directory for man pages.  (Default: {prefix}/share/man)\n";
   print "--module_dir=\tthe base directory for kernel modules.  (Default:  /lib/modules/`uname -r`/kernel\n";
   print "\nbuild flags:\n";
@@ -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/;
ccs/ccs_tool/editconf.c +5 -5
@@ -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)\n");
+	fprintf(stderr, " -c --configfile    Name of configuration file (" DEFAULT_CONFIG_DIR "/" DEFAULT_CONFIG_FILE ")\n");
 	if (rw)
 	{
 		fprintf(stderr, " -o --outputfile    Name of output file (defaults to same as --configfile)\n");
@@ -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\n");
+		die("Error: unable to parse requested configuration file\n");
 
 	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)
ccs/ccs_tool/update.c +1 -1
@@ -379,7 +379,7 @@
 	    "  Old config version :: %d\n"
 	    "  Proposed config version :: %d\n"
 	    "  Winning config version  :: %d\n\n"
-	    "Check /etc/cluster/cluster.conf to ensure it contains the desired contents.\n", v1, v2, v3);
+	    "Check " DEFAULT_CONFIG_DIR "/" DEFAULT_CONFIG_FILE " to ensure it contains the desired contents.\n", v1, v2, v3);
     return -EAGAIN;
   }
 
ccs/daemon/ccsd.c +3 -3
@@ -271,7 +271,7 @@
 	  " -t <ttl>      Multicast threshold (aka Time to Live) value.\n"
 	  " -P [bcf]:#    Specify various port numbers.\n"
 	  " -V            Print version information.\n"
-	  " -X            No cluster manager, just read local cluster.conf.\n"
+	  " -X            No cluster manager, just read local " DEFAULT_CONFIG_DIR "/" DEFAULT_CONFIG_FILE ".\n"
 	  );
   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("\nNo local cluster.conf found: %s\n", config_file_location);
+      log_err("\nNo local config file found: %s\n", config_file_location);
       return -1;
     }
   }
ccs/daemon/cluster_mgr.c +8 -8
@@ -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\n");
 
-    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.\n");
@@ -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;
ccs/daemon/cnx_mgr.c +27 -27

171 lines not on this page · raw message

ccs/daemon/globals.h +0 -1
@@ -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 */
ccs/lib/libccs.c +5 -4
@@ -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@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
  */
cman/daemon/cmanccs.c +4 -4
@@ -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

- renamed from cman/init.d/cman.in +554 -0

554 lines not on this page · raw message

cman/init.d/Makefile +11 -4
@@ -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
fence/agents/xvm/options.c +1 -1
@@ -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",
fence/agents/xvm/simple_auth.h +1 -1
@@ -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);
fence/fenced/main.c +2 -2
@@ -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\n");
 	printf("  -V	       Print program version information, then exit\n");
 	printf("\n");
-	printf("Command line values override those in cluster.conf.\n");
+	printf("Command line values override those in " DEFAULT_CONFIG_DIR "/" DEFAULT_CONFIG_FILE ".\n");
 	printf("For an unbounded delay use <secs> value of -1.\n");
 	printf("\n");
 }
make/defines.mk.input +5 -1
@@ -27,7 +27,8 @@
 AR = ar
 RANLIB = ranlib
 
-CFLAGS += @CFLAGS@ -I at SRCDIR@/config
+CFLAGS += @CFLAGS@ -I at 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

- renamed from rgmanager/init.d/rgmanager.in +151 -0

151 lines not on this page · raw message

rgmanager/init.d/Makefile +9 -2
@@ -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:
rgmanager/src/daemons/rg_locks.c +1 -1
@@ -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
rgmanager/src/resources/Makefile +13 -5
@@ -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

- renamed from rgmanager/src/resources/utils/config-utils.sh.in +299 -0

299 lines not on this page · raw message