From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11054 invoked by alias); 29 Jul 2008 09:41:34 -0000 Received: (qmail 11023 invoked by uid 9452); 29 Jul 2008 09:41:33 -0000 Date: Tue, 29 Jul 2008 09:41:00 -0000 Message-ID: <20080729094132.11006.qmail@sourceware.org> From: ccaulfield@sourceware.org To: cluster-cvs@sources.redhat.com, cluster-devel@redhat.com Subject: Cluster Project branch, master, updated. cluster-2.99.06-81-gbfbc64a X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: a87f95fa74fc4376915fb661b8c681ccd5641145 X-Git-Newrev: bfbc64af2cfbd2061f0bfbbf732261226ef76672 Mailing-List: contact cluster-cvs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: cluster-cvs-owner@sourceware.org X-SW-Source: 2008-q3/txt/msg00162.txt.bz2 This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Cluster Project". http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=bfbc64af2cfbd2061f0bfbbf732261226ef76672 The branch, master has been updated via bfbc64af2cfbd2061f0bfbbf732261226ef76672 (commit) from a87f95fa74fc4376915fb661b8c681ccd5641145 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit bfbc64af2cfbd2061f0bfbbf732261226ef76672 Author: Christine Caulfield Date: Tue Jul 29 10:38:42 2008 +0100 [CMAN] pass COROSYNC_ env variables to the daemon cman_tool makes its own environment for the aisexec daemon to use but some newer config modules like to have configuring environment variables. So now cman_tool passes down all environment variables starting with COROSYNC_ down. To make this work, I've also changed the plugins that currently take environment variables to name them COROSYNC_. Yes, I know we're not using corosync yet, but this is just one less thing we;ll need to remember to change next week or whenever. Signed-off-by: Christine Caulfield ----------------------------------------------------------------------- Summary of changes: cman/cman_tool/cman_tool.h | 2 +- cman/cman_tool/join.c | 19 +++++++++++++++---- cman/cman_tool/main.c | 6 +++--- config/plugins/ldap/configldap.c | 10 +++++----- config/plugins/xml/config.c | 4 ++-- 5 files changed, 26 insertions(+), 15 deletions(-) diff --git a/cman/cman_tool/cman_tool.h b/cman/cman_tool/cman_tool.h index cb6dfa9..fa55edb 100644 --- a/cman/cman_tool/cman_tool.h +++ b/cman/cman_tool/cman_tool.h @@ -93,7 +93,7 @@ struct commandline }; typedef struct commandline commandline_t; -int join(commandline_t *comline); +int join(commandline_t *comline, char *envp[]); char *cman_error(int err); #endif /* __CMAN_TOOL_DOT_H__ */ diff --git a/cman/cman_tool/join.c b/cman/cman_tool/join.c index cd0f8ab..1da36bd 100644 --- a/cman/cman_tool/join.c +++ b/cman/cman_tool/join.c @@ -5,8 +5,10 @@ #include "libcman.h" #include "cman_tool.h" -static char *argv[128]; -static char *envp[128]; +#define MAX_ARGS 128 + +static char *argv[MAX_ARGS]; +static char *envp[MAX_ARGS]; static void be_daemon(int close_stderr) { @@ -37,7 +39,7 @@ static void be_daemon(int close_stderr) setsid(); } -int join(commandline_t *comline) +int join(commandline_t *comline, char *main_envp[]) { int i, err; int envptr = 0; @@ -105,8 +107,17 @@ int join(commandline_t *comline) envp[envptr++] = strdup(scratch); } + /* Copy any COROSYNC_* env variables to the new daemon */ + i=0; + while (i < MAX_ARGS && main_envp[i]) { + if (strncmp(main_envp[i], "COROSYNC_", 9) == 0) + envp[envptr++] = main_envp[i]; + i++; + } + + /* Create a pipe to monitor cman startup progress */ - if(pipe(p) < 0) + if (pipe(p) < 0) die("unable to create pipe: %s", strerror(errno)); fcntl(p[1], F_SETFD, 0); /* Don't close on exec */ snprintf(scratch, sizeof(scratch), "CMAN_PIPE=%d", p[1]); diff --git a/cman/cman_tool/main.c b/cman/cman_tool/main.c index c028751..5b905ea 100644 --- a/cman/cman_tool/main.c +++ b/cman/cman_tool/main.c @@ -971,7 +971,7 @@ static void check_arguments(commandline_t *comline) die("timeout is only appropriate with wait"); } -int main(int argc, char *argv[]) +int main(int argc, char *argv[], char *envp[]) { commandline_t comline; int ret; @@ -991,12 +991,12 @@ int main(int argc, char *argv[]) alarm(comline.timeout); } - join(&comline); + join(&comline, envp); if (comline.wait_opt || comline.wait_quorate_opt) { do { ret = cluster_wait(&comline); if (ret == ENOTCONN) - join(&comline); + join(&comline, envp); } while (ret == ENOTCONN); } diff --git a/config/plugins/ldap/configldap.c b/config/plugins/ldap/configldap.c index d378fbf..4ad8001 100644 --- a/config/plugins/ldap/configldap.c +++ b/config/plugins/ldap/configldap.c @@ -265,10 +265,10 @@ static int init_config(struct objdb_iface_ver0 *objdb) LDAP *ld; int version, rc; - if (getenv("LDAP_URL")) - ldap_url = getenv("LDAP_URL"); - if (getenv("LDAP_BASEDN")) - ldap_basedn = getenv("LDAP_BASEDN"); + if (getenv("COROSYNC_LDAP_URL")) + ldap_url = getenv("COROSYNC_LDAP_URL"); + if (getenv("COROSYNC_LDAP_BASEDN")) + ldap_basedn = getenv("COROSYNC_LDAP_BASEDN"); /* Connect to the LDAP server */ if (ldap_initialize(&ld, ldap_url)) { @@ -281,7 +281,7 @@ static int init_config(struct objdb_iface_ver0 *objdb) /* * CC: Do I need to use sasl ?! */ - rc = ldap_simple_bind_s(ld, getenv("LDAP_BINDDN"), getenv("LDAP_BINDPWD")); + rc = ldap_simple_bind_s(ld, getenv("COROSYNC_LDAP_BINDDN"), getenv("COROSYNC_LDAP_BINDPWD")); if (rc != LDAP_SUCCESS) { sprintf(error_reason, "ldap_simple_bind failed: %s\n", ldap_err2string(rc)); return -1; diff --git a/config/plugins/xml/config.c b/config/plugins/xml/config.c index 1328bca..f8d2898 100644 --- a/config/plugins/xml/config.c +++ b/config/plugins/xml/config.c @@ -245,8 +245,8 @@ static int xml_readconfig(struct objdb_iface_ver0 *objdb, char **error_string) /* We need to set this up to internal defaults too early */ openlog("openais", LOG_CONS|LOG_PID, SYSLOGFACILITY); - if(getenv("CLUSTER_CONFIG_FILE")) - configfile = getenv("CLUSTER_CONFIG_FILE"); + if(getenv("COROSYNC_CLUSTER_CONFIG_FILE")) + configfile = getenv("COROSYNC_CLUSTER_CONFIG_FILE"); /* Read low-level totem/aisexec etc config from cluster.conf */ if ( !(ret = init_config(objdb, configfile, error_reason)) ) hooks/post-receive -- Cluster Project