This is the mail archive of the cluster-cvs@sourceware.org mailing list for the cluster.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

master - cman: Some fixes for configless running


Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=7aa8fd8b771d1a84c30154ce1992b5fa517d40d1
Commit:        7aa8fd8b771d1a84c30154ce1992b5fa517d40d1
Parent:        4da90fcc6e0d4dde1fac90171fe7149bf145c7ab
Author:        Christine Caulfield <ccaulfie@redhat.com>
AuthorDate:    Mon Oct 27 11:06:59 2008 +0000
Committer:     Fabio M. Di Nitto <fdinitto@redhat.com>
CommitterDate: Fri Oct 31 11:13:15 2008 +0100

cman: Some fixes for configless running

Create /cluster if it doesn't exist (and don't bother trying to
copy any subkeys into CONFIG_PARENT_OBJECT).

Also don't reload keys if we are running configless.

Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
---
 cman/daemon/cman-preconfig.c |   32 ++++++++++++++++++++------------
 1 files changed, 20 insertions(+), 12 deletions(-)

diff --git a/cman/daemon/cman-preconfig.c b/cman/daemon/cman-preconfig.c
index b186811..dc20f74 100644
--- a/cman/daemon/cman-preconfig.c
+++ b/cman/daemon/cman-preconfig.c
@@ -1015,11 +1015,18 @@ static int get_cman_globals(struct objdb_iface_ver0 *objdb)
 
 static int cmanpre_reloadconfig(struct objdb_iface_ver0 *objdb, int flush, char **error_string)
 {
-	int ret = 0;
+	int ret = -1;
 	unsigned int object_handle;
 	unsigned int find_handle;
 	unsigned int cluster_parent_handle_new;
 
+	/* don't reload if we've been told to run configless */
+	if (getenv("CMAN_NOCONFIG")) {
+		sprintf(error_reason, "Config not updated because we were run with cman_tool -X");
+		ret = 0;
+		goto err;
+	}
+
 	/* find both /cluster entries */
 	objdb->object_find_create(OBJECT_PARENT_HANDLE, "cluster", strlen("cluster"), &find_handle);
 	objdb->object_find_next(find_handle, &cluster_parent_handle);
@@ -1055,7 +1062,7 @@ static int cmanpre_reloadconfig(struct objdb_iface_ver0 *objdb, int flush, char
 
 err:
 	*error_string = error_reason;
-	return -1;
+	return ret;
 }
 
 static int cmanpre_readconfig(struct objdb_iface_ver0 *objdb, char **error_string)
@@ -1071,17 +1078,18 @@ static int cmanpre_readconfig(struct objdb_iface_ver0 *objdb, char **error_strin
         objdb->object_find_next(find_handle, &cluster_parent_handle);
 	objdb->object_find_destroy(find_handle);
 	if (!cluster_parent_handle) {
-		sprintf (error_reason, "%s", "Cannot find /cluster/ key in configuration\n");
-		return -1;
+                objdb->object_create(OBJECT_PARENT_HANDLE, &cluster_parent_handle,
+				     "cluster", strlen("cluster"));
+	}
+	else {
+		/* Move these to a place where corosync expects to find them */
+		ret = copy_tree_to_root(objdb, "totem", 0);
+		ret = copy_tree_to_root(objdb, "logging", 0);
+		ret = copy_tree_to_root(objdb, "event", 0);
+		ret = copy_tree_to_root(objdb, "amf", 0);
+		ret = copy_tree_to_root(objdb, "aisexec", 0);
+		ret = copy_tree_to_root(objdb, "service", 1);
 	}
-
-	/* Move these to a place where corosync expects to find them */
-	ret = copy_tree_to_root(objdb, "totem", 0);
-	ret = copy_tree_to_root(objdb, "logging", 0);
-	ret = copy_tree_to_root(objdb, "event", 0);
-	ret = copy_tree_to_root(objdb, "amf", 0);
-	ret = copy_tree_to_root(objdb, "aisexec", 0);
-	ret = copy_tree_to_root(objdb, "service", 1);
 
 	objdb->object_find_create(cluster_parent_handle, "cman", strlen("cman"), &find_handle);
 	if (objdb->object_find_next(find_handle, &object_handle)) {


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]