This is the mail archive of the
cluster-cvs@sourceware.org
mailing list for the cluster.
cluster: STABLE3 - cman: Add a single compatibilty switch
- From: Christine Caulfield <chrissie at fedoraproject dot org>
- To: cluster-cvs-relay at redhat dot com
- Date: Thu, 13 Aug 2009 07:04:30 +0000 (UTC)
- Subject: cluster: STABLE3 - cman: Add a single compatibilty switch
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=99b2899ede7e9b0b4b7429de58397f55786bac4a
Commit: 99b2899ede7e9b0b4b7429de58397f55786bac4a
Parent: b8a5fd9d99b933f95d80bbe9577371fa5e94bf82
Author: Christine Caulfield <ccaulfie@redhat.com>
AuthorDate: Thu Aug 13 08:02:23 2009 +0100
Committer: Christine Caulfield <ccaulfie@redhat.com>
CommitterDate: Thu Aug 13 08:02:23 2009 +0100
cman: Add a single compatibilty switch
Adding the key <cluster upgrading="on"/> to cluster.conf will also
enable the following:
<cluster>
<group groupd_compat="1"/>
<clvmd interface="cman"/>
<cman disallowed="1"/>
</cluster>
<totem>
crypto_accept="old"/>
</totem>
Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
---
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.