diff --git a/src/api/federation_info.c b/src/api/federation_info.c index 2931de8e527cd8ebdd7bf0f238b0adfaaf3e3b44..0d765b64e3513c831bb6b46975505b2a42f8f22b 100644 --- a/src/api/federation_info.c +++ b/src/api/federation_info.c @@ -99,7 +99,7 @@ extern void slurm_print_federation(void *ptr) ListIterator itr; slurmdb_cluster_rec_t *cluster; int left_col_size; - char *conn_status[] = {"Disconnected", "Connected", "Self"}; + char *conn_status[] = {"Disconnected", "Connected"}; char *cluster_name = slurm_get_cluster_name(); slurmdb_federation_rec_t *fed = (slurmdb_federation_rec_t *)ptr; @@ -113,12 +113,30 @@ extern void slurm_print_federation(void *ptr) printf("%-*s %s\n", left_col_size, "Federation:", fed->name); list_sort(fed->cluster_list, (ListCmpF)_sort_clusters_by_name); itr = list_iterator_create(fed->cluster_list); + + /* Display local Cluster*/ + while ((cluster = list_next(itr))) { + if (!xstrcmp(cluster->name, cluster_name)) { + char *tmp_str = + slurmdb_cluster_fed_states_str( + cluster->fed.state); + printf("%-*s %s:%s:%d ID:%d FedState:%s Weight:%d\n", + left_col_size, "Self:", cluster->name, + cluster->control_host, cluster->control_port, + cluster->fed.id, (tmp_str ? tmp_str : ""), + cluster->fed.weight); + } + } + + /* Display siblings */ + list_iterator_reset(itr); while ((cluster = list_next(itr))) { char *tmp_str = NULL; int conn_type = 0; if (!xstrcmp(cluster->name, cluster_name)) - conn_type = 2; - else if (cluster->sockfd != -1) + continue; + + if (cluster->sockfd != -1) conn_type = 1; tmp_str = slurmdb_cluster_fed_states_str(cluster->fed.state); @@ -129,5 +147,7 @@ extern void slurm_print_federation(void *ptr) cluster->fed.id, (tmp_str ? tmp_str : ""), cluster->fed.weight, conn_status[conn_type]); } + + list_iterator_destroy(itr); xfree(cluster_name); } diff --git a/testsuite/expect/test37.3 b/testsuite/expect/test37.3 index b83f967b3405f895af98ef47bff585fa8d2e9fab..f7bcf73463fd6438fab496c823db59e95be5e226 100755 --- a/testsuite/expect/test37.3 +++ b/testsuite/expect/test37.3 @@ -106,6 +106,19 @@ proc test_fed_status {cname cluster_list} { if {[regexp "Federation: $fed_name" $line match]} { send_user "matched: $match\n" incr matches + } elseif {[regexp {Self:\s+(\S+):(\S+):(\d+) ID:(\d+) FedState:(\S*) Weight:(\d+)} \ + $line match name host port id state weight]} { + send_user "matched: $match\n" + if {$expected_matches && + ![string compare [dict get $clusters($name) host] $host] && + ![string compare [dict get $clusters($name) state] $state] && + ![string compare [dict get $clusters($name) conn] Self] && + [dict get $clusters($name) port] == $port && + [dict get $clusters($name) id] == $id && + [dict get $clusters($name) weight] == $weight} { + send_user "matched self: $name\n" + incr matches + } } elseif {[regexp {Sibling:\s+(\S+):(\S+):(\d+) ID:(\d+) FedState:(\S*) Weight:(\d+) PersistConn:(\S+)} \ $line match name host port id state weight conn]} { send_user "matched: $match\n" @@ -116,7 +129,7 @@ proc test_fed_status {cname cluster_list} { [dict get $clusters($name) port] == $port && [dict get $clusters($name) id] == $id && [dict get $clusters($name) weight] == $weight} { - send_user "matched: $name\n" + send_user "matched sibling: $name\n" incr matches } }