Skip to content
Snippets Groups Projects
Commit 07edaa6d authored by Moe Jette's avatar Moe Jette
Browse files

log topology.conf configurations in which nodes appear on multiple leaf switches.

  possibly a configuration error.
parent 9bc0b618
No related branches found
No related tags found
No related merge requests found
...@@ -141,7 +141,9 @@ static void _validate_switches(void) ...@@ -141,7 +141,9 @@ static void _validate_switches(void)
struct switch_record *switch_ptr; struct switch_record *switch_ptr;
hostlist_t hl; hostlist_t hl;
char *child; char *child;
bitstr_t *switches_bitmap = NULL; bitstr_t *multi_homed_bitmap = NULL; /* nodes on >1 leaf switch */
bitstr_t *switches_bitmap = NULL; /* nodes on any leaf switch */
bitstr_t *tmp_bitmap = NULL;
_free_switch_record_table(); _free_switch_record_table();
...@@ -154,6 +156,7 @@ static void _validate_switches(void) ...@@ -154,6 +156,7 @@ static void _validate_switches(void)
switch_record_table = xmalloc(sizeof(struct switch_record) * switch_record_table = xmalloc(sizeof(struct switch_record) *
switch_record_cnt); switch_record_cnt);
multi_homed_bitmap = bit_alloc(node_record_count);
switch_ptr = switch_record_table; switch_ptr = switch_record_table;
for (i=0; i<switch_record_cnt; i++, switch_ptr++) { for (i=0; i<switch_record_cnt; i++, switch_ptr++) {
ptr = ptr_array[i]; ptr = ptr_array[i];
...@@ -168,6 +171,17 @@ static void _validate_switches(void) ...@@ -168,6 +171,17 @@ static void _validate_switches(void)
"config (%s)", "config (%s)",
ptr->nodes, ptr->switch_name); ptr->nodes, ptr->switch_name);
} }
if (switches_bitmap) {
tmp_bitmap = bit_copy(switch_ptr->node_bitmap);
bit_and(tmp_bitmap, switches_bitmap);
bit_or(multi_homed_bitmap, tmp_bitmap);
bit_free(tmp_bitmap);
bit_or(switches_bitmap,
switch_ptr->node_bitmap);
} else {
switches_bitmap = bit_copy(switch_ptr->
node_bitmap);
}
} else if (ptr->switches) { } else if (ptr->switches) {
switch_ptr->level = -1; /* determine later */ switch_ptr->level = -1; /* determine later */
switch_ptr->switches = xstrdup(ptr->switches); switch_ptr->switches = xstrdup(ptr->switches);
...@@ -227,21 +241,15 @@ static void _validate_switches(void) ...@@ -227,21 +241,15 @@ static void _validate_switches(void)
switch_ptr = switch_record_table; switch_ptr = switch_record_table;
for (i=0; i<switch_record_cnt; i++, switch_ptr++) { for (i=0; i<switch_record_cnt; i++, switch_ptr++) {
if (switch_ptr->node_bitmap == NULL) { if (switch_ptr->node_bitmap == NULL)
error("switch %s has no nodes", switch_ptr->name); error("switch %s has no nodes", switch_ptr->name);
continue;
}
if (switches_bitmap)
bit_or(switches_bitmap, switch_ptr->node_bitmap);
else
switches_bitmap = bit_copy(switch_ptr->node_bitmap);
} }
if (switches_bitmap) { if (switches_bitmap) {
bit_not(switches_bitmap); bit_not(switches_bitmap);
i = bit_set_count(switches_bitmap); i = bit_set_count(switches_bitmap);
if (i > 0) { if (i > 0) {
child = bitmap2node_name(switches_bitmap); child = bitmap2node_name(switches_bitmap);
error("switches lack access to %d nodes: %s", error("WARNING: switches lack access to %d nodes: %s",
i, child); i, child);
xfree(child); xfree(child);
} }
...@@ -249,6 +257,17 @@ static void _validate_switches(void) ...@@ -249,6 +257,17 @@ static void _validate_switches(void)
} else } else
fatal("switches contain no nodes"); fatal("switches contain no nodes");
/* Report nodes on multiple leaf switches,
* possibly due to bad configuration file */
i = bit_set_count(multi_homed_bitmap);
if (i > 0) {
child = bitmap2node_name(multi_homed_bitmap);
error("WARNING: Multiple leaf switches contain nodes: %s",
child);
xfree(child);
}
bit_free(multi_homed_bitmap);
s_p_hashtbl_destroy(conf_hashtbl); s_p_hashtbl_destroy(conf_hashtbl);
_log_switches(); _log_switches();
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment