From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23127 invoked by alias); 13 Aug 2009 07:04:58 -0000 Received: (qmail 23096 invoked by alias); 13 Aug 2009 07:04:57 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS X-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS X-Spam-Check-By: sourceware.org X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bastion2.fedora.phx.redhat.com Subject: cluster: STABLE3 - cman: Add a single compatibilty switch To: cluster-cvs-relay@redhat.com X-Project: Cluster Project X-Git-Module: cluster.git X-Git-Refname: refs/heads/STABLE3 X-Git-Reftype: branch X-Git-Oldrev: b8a5fd9d99b933f95d80bbe9577371fa5e94bf82 X-Git-Newrev: 99b2899ede7e9b0b4b7429de58397f55786bac4a From: Christine Caulfield Message-Id: <20090813070430.F326E1201AE@lists.fedorahosted.org> Date: Thu, 13 Aug 2009 07:04:00 -0000 X-Scanned-By: MIMEDefang 2.58 on 172.16.52.254 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: 2009-q3/txt/msg00197.txt.bz2 Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=99b2899ede7e9b0b4b7429de58397f55786bac4a Commit: 99b2899ede7e9b0b4b7429de58397f55786bac4a Parent: b8a5fd9d99b933f95d80bbe9577371fa5e94bf82 Author: Christine Caulfield AuthorDate: Thu Aug 13 08:02:23 2009 +0100 Committer: Christine Caulfield CommitterDate: Thu Aug 13 08:02:23 2009 +0100 cman: Add a single compatibilty switch Adding the key to cluster.conf will also enable the following: crypto_accept="old"/> Signed-off-by: Christine Caulfield --- cman/daemon/cman-preconfig.c | 81 ++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 81 insertions(+), 0 deletions(-) diff --git a/cman/daemon/cman-preconfig.c b/cman/daemon/cman-preconfig.c index 4cdd00d..f813ac7 100644 --- a/cman/daemon/cman-preconfig.c +++ b/cman/daemon/cman-preconfig.c @@ -1161,11 +1161,86 @@ err: return ret; } + +static hdb_handle_t find_or_create_object(struct objdb_iface_ver0 *objdb, const char *name, hdb_handle_t parent_handle) +{ + hdb_handle_t find_handle; + hdb_handle_t ret_handle = 0; + + objdb->object_find_create(parent_handle, name, strlen(name), &find_handle); + objdb->object_find_next(find_handle, &ret_handle); + objdb->object_find_destroy(find_handle); + + if (!ret_handle) { + objdb->object_create(parent_handle, &ret_handle, name, strlen(name)); + } + + return ret_handle; +} + +static const char *groupd_compat="groupd_compat"; +static const char *clvmd_interface="interface"; +static const char *cman_disallowed="disallowed"; +static const char *totem_crypto="crypto_accept"; + +/* + * Flags to set: + * - groupd: + * - clvmd + * - disallowed (on) + * - rgmanager + */ +static void setup_old_compat(struct objdb_iface_ver0 *objdb, hdb_handle_t cluster_handle) +{ + hdb_handle_t groupd_handle; + hdb_handle_t clvmd_handle; + hdb_handle_t cman_handle; + hdb_handle_t totem_handle; + char *value; + + /* Set groupd to backwards compatibility mode */ + groupd_handle = find_or_create_object(objdb, "group", cluster_handle); + if (objdb->object_key_get(groupd_handle, groupd_compat, strlen(groupd_compat), + (void *)&value, NULL) || + !value) { + objdb->object_key_create(groupd_handle, groupd_compat, strlen(groupd_compat), + "1", 2); + } + + /* Make clvmd use cman */ + clvmd_handle = find_or_create_object(objdb, "clvmd", cluster_handle); + if (objdb->object_key_get(clvmd_handle, clvmd_interface, strlen(clvmd_interface), + (void *)&value, NULL) || + !value) { + objdb->object_key_create(clvmd_handle, clvmd_interface, strlen(clvmd_interface), + "cman", 5); + } + + /* Make cman use disallowed mode */ + cman_handle = find_or_create_object(objdb, "cman", cluster_handle); + if (objdb->object_key_get(cman_handle, cman_disallowed, strlen(cman_disallowed), + (void *)&value, NULL) || + !value) { + objdb->object_key_create(cman_handle, cman_disallowed, strlen(cman_disallowed), + "1", 2); + } + + /* Make totem use the old communications method */ + totem_handle = find_or_create_object(objdb, "totem", OBJECT_PARENT_HANDLE); + if (objdb->object_key_get(totem_handle, totem_crypto, strlen(totem_crypto), + (void *)&value, NULL) || + !value) { + objdb->object_key_create(totem_handle, totem_crypto, strlen(totem_crypto), + "old", 4); + } +} + static int cmanpre_readconfig(struct objdb_iface_ver0 *objdb, const char **error_string) { int ret = 0; hdb_handle_t object_handle; hdb_handle_t find_handle; + char *str; if (getenv("CMAN_PIPE")) startup_pipe = atoi(getenv("CMAN_PIPE")); @@ -1194,6 +1269,12 @@ static int cmanpre_readconfig(struct objdb_iface_ver0 *objdb, const char **error } objdb->object_find_destroy(find_handle); + /* Set up STABLE2/RHEL5 compatibility modes */ + objdb_get_string(objdb, object_handle, "upgrading", &str); + if (str && strcasecmp(str, "on")==0) { + setup_old_compat(objdb, cluster_parent_handle); + } + /* This will create /libccs/@next_handle. * next_handle will be atomically incremented by corosync to return ccs_handle down the pipe. * We create it in cman-preconfig to avoid an "init" race in libccs.