Просмотр исходного кода

config: don't reload vquorum if reload fails

Fix an 'error: success' stype message by propogating error_string
back down the stack.

Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
Christine Caulfield 5 лет назад
Родитель
Сommit
7cb539e2e3
4 измененных файлов с 18 добавлено и 9 удалено
  1. 3 2
      exec/cfg.c
  2. 4 5
      exec/totemconfig.c
  3. 2 1
      exec/totemconfig.h
  4. 9 1
      exec/votequorum.c

+ 3 - 2
exec/cfg.c

@@ -723,8 +723,8 @@ static void message_handler_req_exec_cfg_reload_config (
 	memset(new_config.interfaces, 0, sizeof (struct totem_interface) * INTERFACE_MAX);
 	memset(new_config.interfaces, 0, sizeof (struct totem_interface) * INTERFACE_MAX);
 
 
 	/* Calculate new node and interface definitions */
 	/* Calculate new node and interface definitions */
-	if (totemconfig_configure_new_params(&new_config, temp_map) == -1) {
-		log_printf (LOGSYS_LEVEL_ERROR, "Cannot configure new interface definitons: %s\n", error_string);
+	if (totemconfig_configure_new_params(&new_config, temp_map, &error_string) == -1) {
+		log_printf (LOGSYS_LEVEL_ERROR, "Cannot configure new interface definitions: %s\n", error_string);
 		res = CS_ERR_INVALID_PARAM;
 		res = CS_ERR_INVALID_PARAM;
 		goto reload_fini;
 		goto reload_fini;
 	}
 	}
@@ -755,6 +755,7 @@ static void message_handler_req_exec_cfg_reload_config (
 
 
 reload_fini:
 reload_fini:
 	/* All done - let clients know */
 	/* All done - let clients know */
+	icmap_set_int32("config.reload_status", res);
 	icmap_set_uint8("config.totemconfig_reload_in_progress", 0);
 	icmap_set_uint8("config.totemconfig_reload_in_progress", 0);
 	icmap_set_uint8("config.reload_in_progress", 0);
 	icmap_set_uint8("config.reload_in_progress", 0);
 
 

+ 4 - 5
exec/totemconfig.c

@@ -2282,14 +2282,13 @@ static void totem_change_notify(
 
 
 int totemconfig_configure_new_params(
 int totemconfig_configure_new_params(
 	struct totem_config *totem_config,
 	struct totem_config *totem_config,
-	icmap_map_t map)
+	icmap_map_t map,
+	const char **error_string)
 {
 {
-	const char *error_string;
 	uint64_t warnings = 0LL;
 	uint64_t warnings = 0LL;
 
 
-	get_interface_params(totem_config, map, &error_string, &warnings, 1);
-	if (put_nodelist_members_to_config (totem_config, map, 1, &error_string)) {
-		log_printf (LOGSYS_LEVEL_ERROR, "%s", error_string);
+	get_interface_params(totem_config, map, error_string, &warnings, 1);
+	if (put_nodelist_members_to_config (totem_config, map, 1, error_string)) {
 		return -1;
 		return -1;
 	}
 	}
 
 

+ 2 - 1
exec/totemconfig.h

@@ -78,7 +78,8 @@ extern int totem_volatile_config_validate(
 
 
 extern int totemconfig_configure_new_params(
 extern int totemconfig_configure_new_params(
 	struct totem_config *totem_config,
 	struct totem_config *totem_config,
-	icmap_map_t map);
+	icmap_map_t map,
+	const char **error_string);
 
 
 extern void totemconfig_commit_new_params(
 extern void totemconfig_commit_new_params(
 	struct totem_config *totem_config,
 	struct totem_config *totem_config,

+ 9 - 1
exec/votequorum.c

@@ -1573,6 +1573,7 @@ static void votequorum_refresh_config(
 	int old_votes, old_expected_votes;
 	int old_votes, old_expected_votes;
 	uint8_t reloading;
 	uint8_t reloading;
 	uint8_t cancel_wfa;
 	uint8_t cancel_wfa;
+	int32_t reload_status;
 
 
 	ENTER();
 	ENTER();
 
 
@@ -1581,7 +1582,14 @@ static void votequorum_refresh_config(
 	 * can reconfigure it all atomically
 	 * can reconfigure it all atomically
 	 */
 	 */
 	if (icmap_get_uint8("config.totemconfig_reload_in_progress", &reloading) == CS_OK && reloading) {
 	if (icmap_get_uint8("config.totemconfig_reload_in_progress", &reloading) == CS_OK && reloading) {
-		return ;
+		return;
+	}
+
+	/* If a full reload failed, then don't reconfigure */
+	if ( (strcmp(key_name, "config.totemconfig_reload_in_progress") == 0) &&
+	     (icmap_get_int32("config.reload_status", &reload_status) == CS_OK) &&
+	     (reload_status != CS_OK) ) {
+		return;
 	}
 	}
 
 
 	(void)icmap_get_uint8("quorum.cancel_wait_for_all", &cancel_wfa);
 	(void)icmap_get_uint8("quorum.cancel_wait_for_all", &cancel_wfa);