LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File cman_config_reload_fix_part4.patch of Package cluster (Project home:sschapiro:openstack:upstream)

commit 02e5f7ae8f8f49e0facc33d202e48ae7041d5fe0
Author: Fabio M. Di Nitto <fdinitto@redhat.com>
Date:   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.
    
    Resolves: rhbz#617161, rhbz#617163
    
    Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>

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 {