From 3d73d0ae2f97919639042852b71bc96318f57f95 Mon Sep 17 00:00:00 2001 From: Brian Christiansen <brian@schedmd.com> Date: Mon, 11 Jul 2016 13:56:58 -0600 Subject: [PATCH] Change fed cluster index to fed cluster id --- doc/man/man1/sacctmgr.1 | 6 +- slurm/slurmdb.h | 2 +- src/api/federation_info.c | 4 +- src/common/slurmdb_defs.c | 2 +- src/common/slurmdb_pack.c | 4 +- .../mysql/accounting_storage_mysql.c | 2 +- .../mysql/as_mysql_cluster.c | 82 +++++++++---------- .../mysql/as_mysql_cluster.h | 7 +- .../mysql/as_mysql_federation.c | 21 +++-- src/sacctmgr/cluster_functions.c | 4 +- src/sacctmgr/common.c | 5 -- src/sacctmgr/federation_functions.c | 8 +- src/sacctmgr/sacctmgr.h | 1 - src/slurmctld/fed_mgr.c | 2 +- testsuite/expect/globals_federation | 6 +- testsuite/expect/test37.1 | 30 +++---- testsuite/expect/test37.2 | 12 +-- testsuite/expect/test37.3 | 6 +- 18 files changed, 99 insertions(+), 105 deletions(-) diff --git a/doc/man/man1/sacctmgr.1 b/doc/man/man1/sacctmgr.1 index 991f9fafffb..91c0012124b 100644 --- a/doc/man/man1/sacctmgr.1 +++ b/doc/man/man1/sacctmgr.1 @@ -785,9 +785,9 @@ Numeric value of the name of the FedState. Attributes possessed by the cluster. .TP -\fIIndex\fP -The federation index assigned to the cluster when a member of a federation. This -index uniquely identifies the cluster and its jobs in the federation. +\fIID\fP +The ID assigned to the cluster when a member of a federation. This ID uniquely +identifies the cluster and its jobs in the federation. .TP \fINodeCount\fP diff --git a/slurm/slurmdb.h b/slurm/slurmdb.h index fc3cf47dd6e..ccb6886b3cf 100644 --- a/slurm/slurmdb.h +++ b/slurm/slurmdb.h @@ -576,7 +576,7 @@ typedef struct { typedef struct { char *name; /* Federation name */ - uint32_t index; /* index of cluster in federation */ + uint32_t id; /* id of cluster in federation */ uint32_t state; /* state of cluster in federation */ uint32_t weight; /* weight of cluster in federation */ } fed_elem_t; diff --git a/src/api/federation_info.c b/src/api/federation_info.c index 8a80c4afd75..dbc82b0d032 100644 --- a/src/api/federation_info.c +++ b/src/api/federation_info.c @@ -122,11 +122,11 @@ extern void slurm_print_federation(void *ptr) conn_type = 1; tmp_str = slurmdb_cluster_fed_states_str(cluster->fed.state); - printf("%-*s %s:%s:%d Index:%d FedState:%s Weight:%d " + printf("%-*s %s:%s:%d ID:%d FedState:%s Weight:%d " "PersistConn:%s\n", left_col_size, "Sibling:", cluster->name, cluster->control_host, cluster->control_port, - cluster->fed.index, (tmp_str ? tmp_str : ""), + cluster->fed.id, (tmp_str ? tmp_str : ""), cluster->fed.weight, conn_status[conn_type]); xfree(tmp_str); } diff --git a/src/common/slurmdb_defs.c b/src/common/slurmdb_defs.c index e872c1b0377..24fad46d2cc 100644 --- a/src/common/slurmdb_defs.c +++ b/src/common/slurmdb_defs.c @@ -3113,7 +3113,7 @@ extern void slurmdb_copy_cluster_rec(slurmdb_cluster_rec_t *out, out->dimensions = in->dimensions; xfree(out->fed.name); out->fed.name = xstrdup(in->fed.name); - out->fed.index = in->fed.index; + out->fed.id = in->fed.id; out->fed.state = in->fed.state; out->fed.weight = in->fed.weight; out->flags = in->flags; diff --git a/src/common/slurmdb_pack.c b/src/common/slurmdb_pack.c index 8ab246b1a3d..8d8d77a7476 100644 --- a/src/common/slurmdb_pack.c +++ b/src/common/slurmdb_pack.c @@ -674,7 +674,7 @@ extern void slurmdb_pack_cluster_rec(void *in, uint16_t protocol_version, pack16(object->dimensions, buffer); packstr(object->fed.name, buffer); - pack32(object->fed.index, buffer); + pack32(object->fed.id, buffer); pack32(object->fed.state, buffer); pack32(object->fed.weight, buffer); @@ -786,7 +786,7 @@ extern int slurmdb_unpack_cluster_rec(void **object, uint16_t protocol_version, safe_unpackstr_xmalloc(&object_ptr->fed.name, &uint32_tmp, buffer); - safe_unpack32(&object_ptr->fed.index, buffer); + safe_unpack32(&object_ptr->fed.id, buffer); safe_unpack32(&object_ptr->fed.state, buffer); safe_unpack32(&object_ptr->fed.weight, buffer); diff --git a/src/plugins/accounting_storage/mysql/accounting_storage_mysql.c b/src/plugins/accounting_storage/mysql/accounting_storage_mysql.c index 652260c8589..8866ebf044e 100644 --- a/src/plugins/accounting_storage/mysql/accounting_storage_mysql.c +++ b/src/plugins/accounting_storage/mysql/accounting_storage_mysql.c @@ -533,8 +533,8 @@ static int _as_mysql_acct_check_tables(mysql_conn_t *mysql_conn) { "plugin_id_select", "smallint unsigned default 0" }, { "flags", "int unsigned default 0" }, { "federation", "tinytext not null" }, + { "fed_id", "int unsigned default 0 not null" }, { "fed_state", "smallint unsigned not null" }, - { "fed_inx", "int unsigned default 0 not null" }, { "fed_weight", "int unsigned default 0 not null" }, { NULL, NULL} }; diff --git a/src/plugins/accounting_storage/mysql/as_mysql_cluster.c b/src/plugins/accounting_storage/mysql/as_mysql_cluster.c index 9578ca02bcf..1b91e6fa8b3 100644 --- a/src/plugins/accounting_storage/mysql/as_mysql_cluster.c +++ b/src/plugins/accounting_storage/mysql/as_mysql_cluster.c @@ -47,28 +47,28 @@ #define MAX_FED_CLUSTERS 63 -extern int as_mysql_get_fed_cluster_index(mysql_conn_t *mysql_conn, - const char *cluster, - const char *federation, - int last_index, int *ret_index) +extern int as_mysql_get_fed_cluster_id(mysql_conn_t *mysql_conn, + const char *cluster, + const char *federation, + int last_id, int *ret_id) { - /* find index for cluster in federation. + /* find id for cluster in federation. * don't do anything if cluster is already part of federation * get list of clusters that are part of the federration. - * loop through each cluster and find the first index available. + * loop through each cluster and find the first id available. * report error if all are full in 63 slots. */ - int index = 1; + int id = 1; char *query = NULL; MYSQL_ROW row; MYSQL_RES *result = NULL; xassert(cluster); xassert(federation); - xassert(ret_index); + xassert(ret_id); /* See if cluster is already part of federation */ - xstrfmtcat(query, "SELECT name, fed_inx " + xstrfmtcat(query, "SELECT name, fed_id " "FROM %s " "WHERE deleted=0 AND name='%s' AND federation='%s';", cluster_table, cluster, federation); @@ -81,21 +81,21 @@ extern int as_mysql_get_fed_cluster_index(mysql_conn_t *mysql_conn, } xfree(query); while ((row = mysql_fetch_row(result))) { - int tmp_index = slurm_atoul(row[1]); + int tmp_id = slurm_atoul(row[1]); debug2("cluster '%s' already part of federation '%s', using " - "existing index %d", cluster, federation, tmp_index); + "existing id %d", cluster, federation, tmp_id); mysql_free_result(result); - *ret_index = tmp_index; + *ret_id = tmp_id; return SLURM_SUCCESS; } mysql_free_result(result); - /* Get all other clusters in the federation and find an open index. */ - xstrfmtcat(query, "SELECT name, federation, fed_inx " + /* Get all other clusters in the federation and find an open id. */ + xstrfmtcat(query, "SELECT name, federation, fed_id " "FROM %s " "WHERE name!='%s' AND federation='%s' " - "AND fed_inx > %d ORDER BY fed_inx;", - cluster_table, cluster, federation, last_index); + "AND fed_id > %d ORDER BY fed_id;", + cluster_table, cluster, federation, last_id); if (debug_flags & DEBUG_FLAG_FEDR) DB_DEBUG(mysql_conn->conn, "query\n%s", query); if (!(result = mysql_db_query_ret(mysql_conn, query, 0))) { @@ -105,22 +105,22 @@ extern int as_mysql_get_fed_cluster_index(mysql_conn_t *mysql_conn, } xfree(query); - if (last_index >= index) - index = last_index + 1; + if (last_id >= id) + id = last_id + 1; while ((row = mysql_fetch_row(result))) { - if (index != slurm_atoul(row[2])) + if (id != slurm_atoul(row[2])) break; - index++; + id++; } mysql_free_result(result); - if (index > MAX_FED_CLUSTERS) { + if (id > MAX_FED_CLUSTERS) { error("Too many clusters in this federation."); errno = ESLURM_FED_CLUSTER_MAX_CNT; return ESLURM_FED_CLUSTER_MAX_CNT; } - *ret_index = index; + *ret_id = id; return SLURM_SUCCESS; } @@ -269,7 +269,7 @@ extern int as_mysql_add_clusters(mysql_conn_t *mysql_conn, uint32_t uid, */ list_iterator_reset(itr); while ((object = list_next(itr))) { - int fed_inx = 0; + int fed_id = 0; xstrcat(cols, "creation_time, mod_time, acct"); xstrfmtcat(vals, "%ld, %ld, 'root'", now, now); xstrfmtcat(extra, ", mod_time=%ld", now); @@ -280,12 +280,12 @@ extern int as_mysql_add_clusters(mysql_conn_t *mysql_conn, uint32_t uid, if (object->fed.name) { has_feds = 1; - rc = as_mysql_get_fed_cluster_index(mysql_conn, - object->name, - object->fed.name, - -1, &fed_inx); + rc = as_mysql_get_fed_cluster_id(mysql_conn, + object->name, + object->fed.name, -1, + &fed_id); if (rc) { - error("failed to get cluster index for " + error("failed to get cluster id for " "federation"); xfree(extra); xfree(cols); @@ -297,18 +297,18 @@ extern int as_mysql_add_clusters(mysql_conn_t *mysql_conn, uint32_t uid, xstrfmtcat(query, "insert into %s (creation_time, mod_time, " - "name, classification, federation, fed_inx) " + "name, classification, federation, fed_id) " "values (%ld, %ld, '%s', %u, '%s', %d) " "on duplicate key update deleted=0, mod_time=%ld, " "control_host='', control_port=0, " "classification=%u, flags=0, federation='%s', " - "fed_inx=%d", + "fed_id=%d", cluster_table, now, now, object->name, object->classification, (object->fed.name) ? object->fed.name : "", - fed_inx, now, object->classification, + fed_id, now, object->classification, (object->fed.name) ? object->fed.name : "", - fed_inx); + fed_id); if (debug_flags & DEBUG_FLAG_DB_ASSOC) DB_DEBUG(mysql_conn->conn, "query\n%s", query); rc = mysql_db_query(mysql_conn, query); @@ -564,12 +564,12 @@ extern List as_mysql_modify_clusters(mysql_conn_t *mysql_conn, uint32_t uid, object = xstrdup(row[0]); if (cluster->fed.name) { - int index; - rc = as_mysql_get_fed_cluster_index(mysql_conn, object, - cluster->fed.name, -1, - &index); + int id; + rc = as_mysql_get_fed_cluster_id(mysql_conn, object, + cluster->fed.name, -1, + &id); if (rc) { - error("failed to get cluster index for " + error("failed to get cluster id for " "federation"); xfree(tmp_vals); FREE_NULL_LIST(ret_list); @@ -577,7 +577,7 @@ extern List as_mysql_modify_clusters(mysql_conn_t *mysql_conn, uint32_t uid, goto end_it; } - xstrfmtcat(tmp_vals, ", fed_inx=%d", index); + xstrfmtcat(tmp_vals, ", fed_id=%d", id); } list_append(ret_list, object); @@ -795,7 +795,7 @@ extern List as_mysql_get_clusters(mysql_conn_t *mysql_conn, uid_t uid, "control_host", "control_port", "federation", - "fed_inx", + "fed_id", "fed_state", "fed_weight", "rpc_version", @@ -809,7 +809,7 @@ extern List as_mysql_get_clusters(mysql_conn_t *mysql_conn, uid_t uid, CLUSTER_REQ_CH, CLUSTER_REQ_CP, CLUSTER_REQ_FEDR, - CLUSTER_REQ_FEDINX, + CLUSTER_REQ_FEDID, CLUSTER_REQ_FEDSTATE, CLUSTER_REQ_FEDWEIGHT, CLUSTER_REQ_VERSION, @@ -880,7 +880,7 @@ empty: cluster->control_host = xstrdup(row[CLUSTER_REQ_CH]); cluster->control_port = slurm_atoul(row[CLUSTER_REQ_CP]); cluster->fed.name = xstrdup(row[CLUSTER_REQ_FEDR]); - cluster->fed.index = slurm_atoul(row[CLUSTER_REQ_FEDINX]); + cluster->fed.id = slurm_atoul(row[CLUSTER_REQ_FEDID]); cluster->fed.state = slurm_atoul(row[CLUSTER_REQ_FEDSTATE]); cluster->fed.weight = slurm_atoul(row[CLUSTER_REQ_FEDWEIGHT]); cluster->rpc_version = slurm_atoul(row[CLUSTER_REQ_VERSION]); diff --git a/src/plugins/accounting_storage/mysql/as_mysql_cluster.h b/src/plugins/accounting_storage/mysql/as_mysql_cluster.h index 62c6e99ad47..0fbe60db582 100644 --- a/src/plugins/accounting_storage/mysql/as_mysql_cluster.h +++ b/src/plugins/accounting_storage/mysql/as_mysql_cluster.h @@ -76,7 +76,8 @@ extern int as_mysql_cluster_tres(mysql_conn_t *mysql_conn, char *cluster_nodes, char **tres_str_in, time_t event_time); -extern int as_mysql_get_fed_cluster_index(mysql_conn_t *mysql_conn, const char - *cluster, const char *federation, - int last_index, int *ret_index); +extern int as_mysql_get_fed_cluster_id(mysql_conn_t *mysql_conn, + const char *cluster, + const char *federation, + int last_id, int *ret_id); #endif diff --git a/src/plugins/accounting_storage/mysql/as_mysql_federation.c b/src/plugins/accounting_storage/mysql/as_mysql_federation.c index 4f10406f046..47e841ce64c 100644 --- a/src/plugins/accounting_storage/mysql/as_mysql_federation.c +++ b/src/plugins/accounting_storage/mysql/as_mysql_federation.c @@ -112,7 +112,7 @@ static int _clear_federation_clusters(mysql_conn_t *mysql_conn, const char *fed) { int rc = SLURM_SUCCESS; char *query = NULL; - xstrfmtcat(query, "UPDATE %s SET federation='',fed_inx=0 " + xstrfmtcat(query, "UPDATE %s SET federation='',fed_id=0 " "WHERE deleted=0 AND federation='%s'", cluster_table, fed); if (debug_flags & DEBUG_FLAG_FEDR) @@ -131,7 +131,7 @@ static int _remove_all_clusters_from_fed(mysql_conn_t *mysql_conn, char *query = NULL; xstrfmtcat(query, "UPDATE %s " - "SET federation='', fed_inx=0 " + "SET federation='', fed_id=0 " "WHERE federation='%s' and deleted=0", cluster_table, fed); @@ -164,7 +164,7 @@ static int _remove_clusters_from_fed(mysql_conn_t *mysql_conn, List clusters) xstrfmtcat(names, "%s'%s'", names ? "," : "", name ); xstrfmtcat(query, "UPDATE %s " - "SET federation='', fed_inx=0 " + "SET federation='', fed_id=0 " "WHERE name IN (%s) and deleted=0", cluster_table, names); @@ -192,25 +192,24 @@ static int _add_clusters_to_fed(mysql_conn_t *mysql_conn, List clusters, char *names = NULL; char *indexes = NULL; ListIterator itr = NULL; - int last_index = -1; + int last_id = -1; xassert(fed); xassert(clusters); itr = list_iterator_create(clusters); while ((name = list_next(itr))) { - int index; - if ((rc = as_mysql_get_fed_cluster_index(mysql_conn, name, fed, - last_index, &index))) + int id; + if ((rc = as_mysql_get_fed_cluster_id(mysql_conn, name, fed, + last_id, &id))) goto end_it; - last_index = index; - xstrfmtcat(indexes, "WHEN name='%s' THEN %d ", - name, index); + last_id = id; + xstrfmtcat(indexes, "WHEN name='%s' THEN %d ", name, id); xstrfmtcat(names, "%s'%s'", names ? "," : "", name); } xstrfmtcat(query, "UPDATE %s " - "SET federation='%s', fed_inx = CASE %s END " + "SET federation='%s', fed_id = CASE %s END " "WHERE name IN (%s) and deleted=0", cluster_table, fed, indexes, names); diff --git a/src/sacctmgr/cluster_functions.c b/src/sacctmgr/cluster_functions.c index a105cbfcfdc..5526716a4e3 100644 --- a/src/sacctmgr/cluster_functions.c +++ b/src/sacctmgr/cluster_functions.c @@ -553,8 +553,8 @@ extern int sacctmgr_list_cluster(int argc, char *argv[]) field->print_routine(field, cluster->fed.state, (curr_inx == field_count)); break; - case PRINT_INDEX: - field->print_routine(field, cluster->fed.index, + case PRINT_ID: + field->print_routine(field, cluster->fed.id, (curr_inx == field_count)); break; case PRINT_WEIGHT: diff --git a/src/sacctmgr/common.c b/src/sacctmgr/common.c index 95af3e6b0fa..07db8b1a6cc 100644 --- a/src/sacctmgr/common.c +++ b/src/sacctmgr/common.c @@ -379,11 +379,6 @@ static print_field_t *_get_print_field(char *object) field->name = xstrdup("ID"); field->len = 6; field->print_routine = print_fields_uint; - } else if (!strncasecmp("Index", object, MAX(command_len, 3))) { - field->type = PRINT_INDEX; - field->name = xstrdup("Index"); - field->len = 6; - field->print_routine = print_fields_uint32; } else if (!strncasecmp("Info", object, MAX(command_len, 2))) { field->type = PRINT_INFO; field->name = xstrdup("Info"); diff --git a/src/sacctmgr/federation_functions.c b/src/sacctmgr/federation_functions.c index 6cae14e082d..76257db93a5 100644 --- a/src/sacctmgr/federation_functions.c +++ b/src/sacctmgr/federation_functions.c @@ -526,7 +526,7 @@ extern int sacctmgr_list_federation(int argc, char *argv[]) if (!list_count(format_list)) { slurm_addto_char_list(format_list, - "Federation,Flags%10,Cluster,Index," + "Federation,Flags%10,Cluster,ID%2," "Weight,FedState,FedStateRaw"); } @@ -562,7 +562,7 @@ extern int sacctmgr_list_federation(int argc, char *argv[]) case PRINT_CLUSTER: case PRINT_FEDSTATE: case PRINT_FEDSTATERAW: - case PRINT_INDEX: + case PRINT_ID: case PRINT_WEIGHT: print_clusters = true; break; @@ -647,12 +647,12 @@ extern int sacctmgr_list_federation(int argc, char *argv[]) field, tmp_uint32, (curr_inx == field_count)); break; - case PRINT_INDEX: + case PRINT_ID: if (!tmp_cluster) tmp_uint32 = NO_VAL; else tmp_uint32 = - tmp_cluster->fed.index; + tmp_cluster->fed.id; field->print_routine( field, tmp_uint32, (curr_inx == field_count)); diff --git a/src/sacctmgr/sacctmgr.h b/src/sacctmgr/sacctmgr.h index 4b94a860f18..9167c84ecd7 100644 --- a/src/sacctmgr/sacctmgr.h +++ b/src/sacctmgr/sacctmgr.h @@ -134,7 +134,6 @@ typedef enum { PRINT_CLASS, PRINT_FEDSTATE, PRINT_FEDSTATERAW, - PRINT_INDEX, PRINT_TRES, PRINT_NODECNT, PRINT_CLUSTER_NODES, diff --git a/src/slurmctld/fed_mgr.c b/src/slurmctld/fed_mgr.c index 6555b05a516..ea507da3b6f 100644 --- a/src/slurmctld/fed_mgr.c +++ b/src/slurmctld/fed_mgr.c @@ -606,7 +606,7 @@ extern bool fed_mgr_is_active() */ extern uint32_t fed_mgr_get_job_id(uint32_t orig) { - return orig + (fed_mgr_fed_info.index << FED_MGR_CLUSTER_ID_BEGIN); + return orig + (fed_mgr_fed_info.id << FED_MGR_CLUSTER_ID_BEGIN); } /* diff --git a/testsuite/expect/globals_federation b/testsuite/expect/globals_federation index eb650f87a6c..40fb6ca030e 100644 --- a/testsuite/expect/globals_federation +++ b/testsuite/expect/globals_federation @@ -188,14 +188,14 @@ proc get_clusterfed_info { fed_name } { set matches 0 array set clusters {} set my_pid [spawn $sacctmgr show cluster federation=$fed_name \ - format="cluster%20,federation%20,index,controlhost,controlport,weight,fedstate"] + format="cluster%20,federation%20,id,controlhost,controlport,weight,fedstate"] expect { - -re "Cluster\\s+Federation\\s+Index\\s+ControlHost\\s+ControlPort\\s+Weight\\s+FedState $eol" { + -re "Cluster\\s+Federation\\s+ID\\s+ControlHost\\s+ControlPort\\s+Weight\\s+FedState $eol" { incr matches exp_continue } -re "\\s+(\\S+)\\s+$fed_name\\s+(\\d+)\\s+(\\S+)\\s+(\\d+)\\s+(\\d+)\\s+(\\S*) $eol" { - set clusters($expect_out(1,string)) [dict create index $expect_out(2,string) \ + set clusters($expect_out(1,string)) [dict create id $expect_out(2,string) \ host $expect_out(3,string) \ port $expect_out(4,string) \ weight $expect_out(5,string) \ diff --git a/testsuite/expect/test37.1 b/testsuite/expect/test37.1 index dc936868db3..4f77c50e175 100644 --- a/testsuite/expect/test37.1 +++ b/testsuite/expect/test37.1 @@ -544,9 +544,9 @@ if {$exit_code || $matches != 5} { } set matches 0 -set my_pid [spawn $sacctmgr show cluster $tc1 $tc2 $tc3 format="cluster%20,federation%20,index"] +set my_pid [spawn $sacctmgr show cluster $tc1 $tc2 $tc3 format="cluster%20,federation%20,id"] expect { - -re "Cluster\\s+Federation\\s+Index $eol" { + -re "Cluster\\s+Federation\\s+ID $eol" { incr matches exp_continue } @@ -984,8 +984,8 @@ if {$exit_code || $matches != 3} { } ##################################### -# TEST: mod cluster to federation -- check indexes -# create hole in fed2 indexes +# TEST: mod cluster to federation -- check ids +# create hole in fed2 ids ##################################### set matches 0 set my_pid [spawn $sacctmgr -i modify cluster $tc2 set federation=$fed1] @@ -1021,9 +1021,9 @@ if {$exit_code || $matches != 4} { } set matches 0 -set my_pid [spawn $sacctmgr show cluster $tc1 $tc2 $tc3 format="cluster%20,federation%20,index"] +set my_pid [spawn $sacctmgr show cluster $tc1 $tc2 $tc3 format="cluster%20,federation%20,id"] expect { - -re "Cluster\\s+Federation\\s+Index $eol" { + -re "Cluster\\s+Federation\\s+ID $eol" { incr matches exp_continue } @@ -1088,9 +1088,9 @@ if {$exit_code || $matches != 4} { } set matches 0 -set my_pid [spawn $sacctmgr show cluster $tc1 $tc2 $tc3 format="cluster%20,federation%20,index"] +set my_pid [spawn $sacctmgr show cluster $tc1 $tc2 $tc3 format="cluster%20,federation%20,id"] expect { - -re "Cluster\\s+Federation\\s+Index $eol" { + -re "Cluster\\s+Federation\\s+ID $eol" { incr matches exp_continue } @@ -1120,7 +1120,7 @@ if {$exit_code || $matches != 4} { end_it 1 } -# move tc2 back to fed2 and get new index -- 3. +# move tc2 back to fed2 and get new id -- 3. set matches 0 set my_pid [spawn $sacctmgr -i modify cluster $tc2 set federation=$fed2] expect { @@ -1155,9 +1155,9 @@ if {$exit_code || $matches != 4} { } set matches 0 -set my_pid [spawn $sacctmgr show cluster $tc1 $tc2 $tc3 format="cluster%20,federation%20,index"] +set my_pid [spawn $sacctmgr show cluster $tc1 $tc2 $tc3 format="cluster%20,federation%20,id"] expect { - -re "Cluster\\s+Federation\\s+Index $eol" { + -re "Cluster\\s+Federation\\s+ID $eol" { incr matches exp_continue } @@ -1277,9 +1277,9 @@ if {$exit_code || $matches != 7} { } set matches 0 -set my_pid [spawn $sacctmgr show federation $fed1 $fed2 $fed3 format="federation%20,flags,cluster%20,fedstate,weight,index"] +set my_pid [spawn $sacctmgr show federation $fed1 $fed2 $fed3 format="federation%20,flags,cluster%20,fedstate,weight,id"] expect { - -re "Federation\\s+Flags\\s+Cluster\\s+FedState\\s+Weight\\s+Index $eol" { + -re "Federation\\s+Flags\\s+Cluster\\s+FedState\\s+Weight\\s+ID $eol" { incr matches exp_continue } @@ -1378,9 +1378,9 @@ if {$exit_code || $matches != 2} { # TEST: test selecting clusters by federations ##################################### set matches 0 -set my_pid [spawn $sacctmgr show cluster where fed=$fed3 format="cluster%20,federation%20,index"] +set my_pid [spawn $sacctmgr show cluster where fed=$fed3 format="cluster%20,federation%20,id"] expect { - -re "Cluster\\s+Federation\\s+Index $eol" { + -re "Cluster\\s+Federation\\s+ID $eol" { incr matches exp_continue } diff --git a/testsuite/expect/test37.2 b/testsuite/expect/test37.2 index 2ffa4fc1784..e1939c745d2 100755 --- a/testsuite/expect/test37.2 +++ b/testsuite/expect/test37.2 @@ -87,7 +87,7 @@ proc end_it { exit_code } { # job id should be cluster_id + job_id # local_id: bits 0-25 # cluster_id: bits26-31 -proc test_fed_job_id { cname cindex } { +proc test_fed_job_id { cname cid} { global fed_slurm_base number set job_id 0 set rc 0 @@ -124,9 +124,9 @@ proc test_fed_job_id { cname cindex } { set clust_id [expr $job_id >> 26] send_user "Fed JobID:$job_id Local JobID:$local_id Cluster ID:$clust_id\n" - if {$clust_id != $cindex} { + if {$clust_id != $cid} { send_user "\nFAILURE: jobid($job_id) from $cname didn't give\ - correct partition id ($part_id != $cindex)\n" + correct partition id ($part_id != $cid)\n" incr rc } @@ -200,9 +200,9 @@ if {[setup_federation $fed_name]} { array set clusters [get_clusterfed_info $fed_name] send_user "Verify federation ids are returned when cluster is part of federation\n" -if {[test_fed_job_id $fedc1 [dict get $clusters($fedc1) index]] || - [test_fed_job_id $fedc2 [dict get $clusters($fedc2) index]] || - [test_fed_job_id $fedc3 [dict get $clusters($fedc3) index]]} { +if {[test_fed_job_id $fedc1 [dict get $clusters($fedc1) id]] || + [test_fed_job_id $fedc2 [dict get $clusters($fedc2) id]] || + [test_fed_job_id $fedc3 [dict get $clusters($fedc3) id]]} { end_it 1 } diff --git a/testsuite/expect/test37.3 b/testsuite/expect/test37.3 index 0043db69d2f..b83f967b340 100755 --- a/testsuite/expect/test37.3 +++ b/testsuite/expect/test37.3 @@ -106,15 +106,15 @@ proc test_fed_status {cname cluster_list} { if {[regexp "Federation: $fed_name" $line match]} { send_user "matched: $match\n" incr matches - } elseif {[regexp {Sibling:\s+(\S+):(\S+):(\d+) Index:(\d+) FedState:(\S*) Weight:(\d+) PersistConn:(\S+)} \ - $line match name host port index state weight conn]} { + } 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" 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] $conn] && [dict get $clusters($name) port] == $port && - [dict get $clusters($name) index] == $index && + [dict get $clusters($name) id] == $id && [dict get $clusters($name) weight] == $weight} { send_user "matched: $name\n" incr matches -- GitLab