cluster: STABLE3 - config: more cman_tool config reload cleanup

Fabio M. Di Nitto fabbione at fedoraproject.org
Tue Jul 27 08:11:51 UTC 2010


Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=198c4860e2c04a979c4ee7500aaf49c7f97d1efe
Commit:        198c4860e2c04a979c4ee7500aaf49c7f97d1efe
Parent:        4eb4d4067f5c3b015090a849122795064eb6ef2d
Author:        Fabio M. Di Nitto <fdinitto at redhat.com>
AuthorDate:    Tue Jul 27 10:09:13 2010 +0200
Committer:     Fabio M. Di Nitto <fdinitto at redhat.com>
CommitterDate: Tue Jul 27 10:09:13 2010 +0200

config: more cman_tool config reload cleanup

when issuing cman_tool version on the local node, and the local node
cannot read the new config, there is very little point to keep trying
loading it (since we are the issuing node).

make sure that if the local node cannot read the config, we stop immediately
and report a proper error down to cman_tool to display.

Signed-off-by: Fabio M. Di Nitto <fdinitto at redhat.com>
---
 cman/cman_tool/main.c  |   13 +++++++++++--
 cman/daemon/commands.c |   26 ++++++++++++++++----------
 2 files changed, 27 insertions(+), 12 deletions(-)

diff --git a/cman/cman_tool/main.c b/cman/cman_tool/main.c
index a731323..af1cc18 100644
--- a/cman/cman_tool/main.c
+++ b/cman/cman_tool/main.c
@@ -783,8 +783,17 @@ static void version(commandline_t *comline)
 
 	ver.cv_config = comline->config_version;
 
-	if ((result = cman_set_version(h, &ver)))
-		die("can't set version: %s", cman_error(errno));
+	result = cman_set_version(h, &ver);
+
+	switch(result) {
+		case 0:
+			if (comline->verbose)
+				printf("Configuration succesfully updated or already running\n");
+		break;
+		default:
+			die("Error loading configuration in corosync/cman");
+		break;
+	}
  out:
 	cman_finish(h);
 }
diff --git a/cman/daemon/commands.c b/cman/daemon/commands.c
index 36bb519..3bff57a 100644
--- a/cman/daemon/commands.c
+++ b/cman/daemon/commands.c
@@ -485,9 +485,7 @@ static int do_cmd_set_version(char *cmdbuf, int *retlen)
 	    version->patch != CNXMAN_PATCH_VERSION)
 		return -EINVAL;
 
-	reload_config(version->config, 1);
-
-	return 0;
+	return reload_config(version->config, 1);
 }
 
 static int do_cmd_get_extrainfo(char *cmdbuf, char **retbuf, int retsize, int *retlen, int offset)
@@ -1193,15 +1191,23 @@ static int reload_config(int new_version, int should_broadcast)
 		config_error = read_cman_nodes(corosync, &config_version, 0);
 
 	if (config_error) {
-		log_printf(LOG_ERR, "Can't get updated config version %d: %s. Activity suspended on this node\n",
+		log_printf(LOG_ERR, "Can't get updated config version %d: %s.\n",
 			   wanted_config_version, reload_err?reload_err:"version mismatch on this node");
 
-		if (!ccsd_timer_active) {
-			log_printf(LOG_ERR, "Error reloading the configuration, will retry every second\n");
-			ccsd_timer_should_broadcast = should_broadcast;
-			corosync->timer_add_duration((unsigned long long)ccsd_poll_interval*1000000, NULL,
-						     ccsd_timer_fn, &ccsd_timer);
-			ccsd_timer_active = 1;
+		if (should_broadcast) {
+			log_printf(LOG_ERR, "Continuing activity with old configuration\n");
+			config_error=0;
+			return -2;
+		} else {
+			log_printf(LOG_ERR, "Activity suspended on this node\n");
+
+			if (!ccsd_timer_active) {
+				log_printf(LOG_ERR, "Error reloading the configuration, will retry every second\n");
+				ccsd_timer_should_broadcast = should_broadcast;
+				corosync->timer_add_duration((unsigned long long)ccsd_poll_interval*1000000, NULL,
+							     ccsd_timer_fn, &ccsd_timer);
+				ccsd_timer_active = 1;
+			}
 		}
 	} else { 
 


More information about the cluster-commits mailing list