Jelajahi Sumber

totemconfig: Check for things that cannot be changed on the fly

There are a few things in the interface that cannot be changed on the
fly. Warn about them and tell the user that these things need to be done
in two steps and why.

Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
Christine Caulfield 7 tahun lalu
induk
melakukan
429209f4aa
1 mengubah file dengan 37 tambahan dan 0 penghapusan
  1. 37 0
      exec/totemconfig.c

+ 37 - 0
exec/totemconfig.c

@@ -1071,6 +1071,41 @@ static void reconfigure_links(struct totem_config *totem_config)
 	}
 }
 
+/* Check for differences in config that can't be done on-the-fly and print an error */
+static void check_things_have_not_changed(struct totem_config *totem_config)
+{
+	int i,j;
+	const char *ip_str;
+	char addr_buf[INET6_ADDRSTRLEN];
+	int changed = 0;
+
+	for (i = 0; i<INTERFACE_MAX; i++) {
+		if (totem_config->interfaces[i].configured) {
+			if (totem_config->interfaces[i].knet_transport !=
+			    totem_config->orig_interfaces[i].knet_transport) {
+				log_printf(LOGSYS_LEVEL_ERROR, "New config has different knet transport for link %d. Internal value was NOT changed.\n", i);
+				changed = 1;
+			}
+			for (j=0; j<totem_config->interfaces[i].member_count; j++) {
+				if (memcmp(&totem_config->interfaces[i].member_list[j],
+					   &totem_config->orig_interfaces[i].member_list[j],
+					   sizeof(struct totem_ip_address))) {
+
+					ip_str = totemip_print(&totem_config->orig_interfaces[i].member_list[j]);
+					strcpy(addr_buf, ip_str);
+					log_printf(LOGSYS_LEVEL_ERROR, "new config has different address for link %d (addr changed from %s to %s). Internal value was NOT changed.\n", i, addr_buf, totemip_print(&totem_config->interfaces[i].member_list[j]));
+					changed = 1;
+				}
+			}
+		}
+	}
+
+	if (changed) {
+		log_printf(LOGSYS_LEVEL_ERROR, "To reconfigure and interface it must be deleted and recreated. A working interface needs to be available to corosync at all times");
+	}
+}
+
+
 static void put_nodelist_members_to_config(struct totem_config *totem_config, int reload)
 {
 	icmap_iter_t iter, iter2;
@@ -1153,6 +1188,8 @@ static void put_nodelist_members_to_config(struct totem_config *totem_config, in
 
 		memcpy(new_interfaces, totem_config->interfaces, sizeof (struct totem_interface) * INTERFACE_MAX);
 
+		check_things_have_not_changed(totem_config);
+
 		compute_interfaces_diff(totem_config->orig_interfaces, new_interfaces);
 
 		free(new_interfaces);