the patch makes it possible to change the default configuration file by
setting DEFAULT_CONFIG_DIR (default to /etc/cluster) and
DEFAULT_CONFIG_FILE (cluster.conf).
I need to address two small issues before I can commit it (hence the RFC).
and a bunch of manpages hard encoded file name and path.
Fixing those is easy but to do it clean, I would have to rename them to
something .in and that would kill the RCS history and I don't like that.
The other solution would be to place some sed magic at install: time that
is a bit more "dirty" but IMHO good enough for a temporary solution while
we wait for a proper RCS to appear. Suggestion? Ideas?
This patch can wait.. it really lands in the category of "nice to have".
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;
}
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;
}
update_required = 1;
ch.comm_flags = COMM_UPDATE_COMMIT_ACK;
Index: ccs/daemon/cnx_mgr.c
================================================== =================
RCS file: /cvs/cluster/cluster/ccs/daemon/cnx_mgr.c,v
retrieving revision 1.44
diff -u -r1.44 cnx_mgr.c
--- ccs/daemon/cnx_mgr.c 11 Dec 2007 20:58:00 -0000 1.44
+++ ccs/daemon/cnx_mgr.c 2 Jan 2008 11:01:50 -0000
@@ -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);
#define EXIT_MAGMA_PLUGINS 2 /* Magma plugins are not available */
Index: ccs/lib/libccs.c
================================================== =================
RCS file: /cvs/cluster/cluster/ccs/lib/libccs.c,v
retrieving revision 1.13
diff -u -r1.13 libccs.c
--- ccs/lib/libccs.c 26 Oct 2007 19:18:10 -0000 1.13
+++ ccs/lib/libccs.c 2 Jan 2008 11:01:50 -0000
@@ -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
*/
Index: cman/daemon/cmanccs.c
================================================== =================
RCS file: /cvs/cluster/cluster/cman/daemon/cmanccs.c,v
retrieving revision 1.38
diff -u -r1.38 cmanccs.c
--- cman/daemon/cmanccs.c 29 Nov 2007 11:19:12 -0000 1.38
+++ cman/daemon/cmanccs.c 2 Jan 2008 11:01:50 -0000
@@ -35,7 +35,7 @@
#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;
}
Index: fence/agents/xvm/options.c
================================================== =================
RCS file: /cvs/cluster/cluster/fence/agents/xvm/options.c,v
retrieving revision 1.5
diff -u -r1.5 options.c
--- fence/agents/xvm/options.c 26 Jun 2007 17:23:41 -0000 1.5
+++ fence/agents/xvm/options.c 2 Jan 2008 11:01:50 -0000
@@ -303,7 +303,7 @@
assign_auth },
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("
");
}
Index: make/defines.mk.input
================================================== =================
RCS file: /cvs/cluster/cluster/make/defines.mk.input,v
retrieving revision 1.9
diff -u -r1.9 defines.mk.input
--- make/defines.mk.input 20 Dec 2007 22:10:04 -0000 1.9
+++ make/defines.mk.input 2 Jan 2008 11:01:50 -0000
@@ -27,7 +27,8 @@
AR = ar
RANLIB = ranlib
--
I'm going to make him an offer he can't refuse.
01-02-2008, 11:33 AM
"Fabio M. Di Nitto"
make /etc/cluster/cluster.conf configurable
On Wed, 2 Jan 2008, Patrick Caulfeld wrote:
Fabio M. Di Nitto wrote:
Hi guys,
the patch makes it possible to change the default configuration file by
setting DEFAULT_CONFIG_DIR (default to /etc/cluster) and
DEFAULT_CONFIG_FILE (cluster.conf).
I need to address two small issues before I can commit it (hence the RFC).
and a bunch of manpages hard encoded file name and path.
Fixing those is easy but to do it clean, I would have to rename them to
something .in and that would kill the RCS history and I don't like that.
The other solution would be to place some sed magic at install: time
that is a bit more "dirty" but IMHO good enough for a temporary solution
while we wait for a proper RCS to appear. Suggestion? Ideas?
This patch can wait.. it really lands in the category of "nice to have".
I would be inclined to leave the man pages as they are, but add a
comment in them to the effect that the file might be moved if the
packages were built by hand (or something).
That's about 18 man pages to modify to add a comment. I would generally
agree with you but I think it's easier to just sed them at build time.
Anyone who changes the file location either
1) knows what they are doing or
right.
2) is packaging, and has to take responsibility for that themselves.
(yes I know ...)
agreed.. but well it will make delta's across distros closer to 0 if we
can provide the feature for them.
Fabio
--
I'm going to make him an offer he can't refuse.