diff --git a/src/common/slurm_accounting_storage.c b/src/common/slurm_accounting_storage.c index f832a81efbb3d6585638d8e07f33a706df251b56..98b85f40735981b66e530fb21812c489a6c82f89 100644 --- a/src/common/slurm_accounting_storage.c +++ b/src/common/slurm_accounting_storage.c @@ -449,8 +449,8 @@ extern void destroy_acct_user_cond(void *object) destroy_acct_association_cond(acct_user->assoc_cond); if(acct_user->def_acct_list) list_destroy(acct_user->def_acct_list); - if(acct_user->user_list) - list_destroy(acct_user->user_list); + if(acct_user->qos_list) + list_destroy(acct_user->qos_list); xfree(acct_user); } } @@ -461,13 +461,13 @@ extern void destroy_acct_account_cond(void *object) (acct_account_cond_t *)object; if(acct_account) { - if(acct_account->acct_list) - list_destroy(acct_account->acct_list); destroy_acct_association_cond(acct_account->assoc_cond); if(acct_account->description_list) list_destroy(acct_account->description_list); if(acct_account->organization_list) list_destroy(acct_account->organization_list); + if(acct_account->qos_list) + list_destroy(acct_account->qos_list); xfree(acct_account); } } @@ -1222,7 +1222,6 @@ extern void pack_acct_user_cond(void *in, Buf buffer) pack_acct_association_cond(NULL, buffer); pack32(0, buffer); pack32(0, buffer); - pack32(0, buffer); pack16(0, buffer); pack16(0, buffer); pack16(0, buffer); @@ -1261,18 +1260,6 @@ extern void pack_acct_user_cond(void *in, Buf buffer) } count = 0; - if(object->user_list) - count = list_count(object->user_list); - - pack32(count, buffer); - - if(count) { - itr = list_iterator_create(object->user_list); - while((tmp_info = list_next(itr))) { - packstr(tmp_info, buffer); - } - list_iterator_destroy(itr); - } pack16((uint16_t)object->with_assocs, buffer); pack16((uint16_t)object->with_coords, buffer); pack16((uint16_t)object->with_deleted, buffer); @@ -1311,14 +1298,6 @@ extern int unpack_acct_user_cond(void **object, Buf buffer) list_append(object_ptr->qos_list, tmp_info); } } - safe_unpack32(&count, buffer); - if(count) { - object_ptr->user_list = list_create(slurm_destroy_char); - for(i=0; i<count; i++) { - safe_unpackstr_xmalloc(&tmp_info, &uint32_tmp, buffer); - list_append(object_ptr->user_list, tmp_info); - } - } safe_unpack16((uint16_t *)&object_ptr->with_assocs, buffer); safe_unpack16((uint16_t *)&object_ptr->with_coords, buffer); safe_unpack16((uint16_t *)&object_ptr->with_deleted, buffer); @@ -1339,7 +1318,6 @@ extern void pack_acct_account_cond(void *in, Buf buffer) uint32_t count = 0; if(!object) { - pack32(0, buffer); pack_acct_association_cond(NULL, buffer); pack32(0, buffer); pack32(0, buffer); @@ -1349,19 +1327,6 @@ extern void pack_acct_account_cond(void *in, Buf buffer) pack16(0, buffer); return; } - if(object->acct_list) - count = list_count(object->acct_list); - - pack32(count, buffer); - - if(count) { - itr = list_iterator_create(object->acct_list); - while((tmp_info = list_next(itr))) { - packstr(tmp_info, buffer); - } - list_iterator_destroy(itr); - } - pack_acct_association_cond(object->assoc_cond, buffer); count = 0; @@ -1421,15 +1386,6 @@ extern int unpack_acct_account_cond(void **object, Buf buffer) char *tmp_info = NULL; *object = object_ptr; - safe_unpack32(&count, buffer); - if(count) { - object_ptr->acct_list = list_create(slurm_destroy_char); - for(i=0; i<count; i++) { - safe_unpackstr_xmalloc(&tmp_info, &uint32_tmp, buffer); - list_append(object_ptr->acct_list, tmp_info); - } - } - if(unpack_acct_association_cond((void **)&object_ptr->assoc_cond, buffer) == SLURM_ERROR) goto unpack_error; diff --git a/src/common/slurm_accounting_storage.h b/src/common/slurm_accounting_storage.h index b787b4fd6f7d914df8c994c40b989656906edd62..e2d6449327f2f40866255b12efbfe1928d0ad4b4 100644 --- a/src/common/slurm_accounting_storage.h +++ b/src/common/slurm_accounting_storage.h @@ -94,8 +94,8 @@ typedef struct { } acct_association_cond_t; typedef struct { - List acct_list; /* list of char * */ - acct_association_cond_t *assoc_cond; + acct_association_cond_t *assoc_cond;/* use acct_list here for + names */ List description_list; /* list of char * */ List organization_list; /* list of char * */ List qos_list; /* list of char * */ @@ -215,10 +215,10 @@ typedef struct { typedef struct { acct_admin_level_t admin_level; - acct_association_cond_t *assoc_cond; + acct_association_cond_t *assoc_cond; /* use user_list here for + names */ List def_acct_list; /* list of char * */ List qos_list; /* list of char * */ - List user_list; /* list of char * */ uint16_t with_assocs; uint16_t with_coords; uint16_t with_deleted; diff --git a/src/common/slurm_protocol_defs.c b/src/common/slurm_protocol_defs.c index 883e1cf055dbce3b4bffaa7ae006c8deb0088c9d..f54a8cf3cf1e8b8dab2d9d50576efcfb11f1c4c8 100644 --- a/src/common/slurm_protocol_defs.c +++ b/src/common/slurm_protocol_defs.c @@ -132,6 +132,8 @@ extern void slurm_addto_char_list(List char_list, char *names) } start = i; while(names[i]) { + //info("got %d - %d = %d", i, start, i-start); + if(quote && names[i] == quote_c) break; else if (names[i] == '\"' || names[i] == '\'') @@ -140,6 +142,7 @@ extern void slurm_addto_char_list(List char_list, char *names) if((i-start) > 0) { name = xmalloc((i-start+1)); memcpy(name, names+start, (i-start)); + //info("got %s %d", name, i-start); while((tmp_char = list_next(itr))) { if(!strcasecmp(tmp_char, name)) @@ -154,6 +157,12 @@ extern void slurm_addto_char_list(List char_list, char *names) } i++; start = i; + if(!names[i]) { + info("There is a problem with " + "your line. It appears you " + "have spaces inside your list."); + break; + } } i++; } diff --git a/src/plugins/accounting_storage/gold/accounting_storage_gold.c b/src/plugins/accounting_storage/gold/accounting_storage_gold.c index a2d67c075793bd3f8c876ebc497cad37366b989c..4a299f770a43585122ca0393fdbd2d380647d6a3 100644 --- a/src/plugins/accounting_storage/gold/accounting_storage_gold.c +++ b/src/plugins/accounting_storage/gold/accounting_storage_gold.c @@ -1155,9 +1155,10 @@ extern List acct_storage_p_modify_users(void *db_conn, return NULL; } - if(user_q->user_list && list_count(user_q->user_list)) { - itr = list_iterator_create(user_q->user_list); - if(list_count(user_q->user_list) > 1) + if(user_q->assoc_cond->user_list + && list_count(user_q->assoc_cond->user_list)) { + itr = list_iterator_create(user_q->assoc_cond->user_list); + if(list_count(user_q->assoc_cond->user_list) > 1) set = 2; else set = 0; @@ -1273,9 +1274,10 @@ extern List acct_storage_p_modify_user_admin_level(void *db_conn, return NULL; } - if(user_q->user_list && list_count(user_q->user_list)) { - itr = list_iterator_create(user_q->user_list); - if(list_count(user_q->user_list) > 1) + if(user_q->assoc_cond->user_list + && list_count(user_q->assoc_cond->user_list)) { + itr = list_iterator_create(user_q->assoc_cond->user_list); + if(list_count(user_q->assoc_cond->user_list) > 1) set = 2; else set = 0; @@ -1358,9 +1360,10 @@ extern List acct_storage_p_modify_accts(void *db_conn, return NULL; } - if(acct_q->acct_list && list_count(acct_q->acct_list)) { - itr = list_iterator_create(acct_q->acct_list); - if(list_count(acct_q->acct_list) > 1) + if(acct_q->assoc_cond->acct_list + && list_count(acct_q->assoc_cond->acct_list)) { + itr = list_iterator_create(acct_q->assoc_cond->acct_list); + if(list_count(acct_q->assoc_cond->acct_list) > 1) set = 2; else set = 0; @@ -1630,9 +1633,10 @@ extern List acct_storage_p_remove_users(void *db_conn, return NULL; } - if(user_q->user_list && list_count(user_q->user_list)) { - itr = list_iterator_create(user_q->user_list); - if(list_count(user_q->user_list) > 1) + if(user_q->assoc_cond->user_list + && list_count(user_q->assoc_cond->user_list)) { + itr = list_iterator_create(user_q->assoc_cond->user_list); + if(list_count(user_q->assoc_cond->user_list) > 1) set = 2; else set = 0; @@ -1716,9 +1720,10 @@ extern List acct_storage_p_remove_accts(void *db_conn, return NULL; } - if(acct_q->acct_list && list_count(acct_q->acct_list)) { - itr = list_iterator_create(acct_q->acct_list); - if(list_count(acct_q->acct_list) > 1) + if(acct_q->assoc_cond->acct_list + && list_count(acct_q->assoc_cond->acct_list)) { + itr = list_iterator_create(acct_q->assoc_cond->acct_list); + if(list_count(acct_q->assoc_cond->acct_list) > 1) set = 2; else set = 0; @@ -2100,9 +2105,10 @@ extern List acct_storage_p_get_users(void *db_conn, if(!user_q) goto empty; - if(user_q->user_list && list_count(user_q->user_list)) { - itr = list_iterator_create(user_q->user_list); - if(list_count(user_q->user_list) > 1) + if(user_q->assoc_cond->user_list + && list_count(user_q->assoc_cond->user_list)) { + itr = list_iterator_create(user_q->assoc_cond->user_list); + if(list_count(user_q->assoc_cond->user_list) > 1) set = 2; else set = 0; @@ -2191,9 +2197,10 @@ extern List acct_storage_p_get_accts(void *db_conn, if(!acct_q) goto empty; - if(acct_q->acct_list && list_count(acct_q->acct_list)) { - itr = list_iterator_create(acct_q->acct_list); - if(list_count(acct_q->acct_list) > 1) + if(acct_q->assoc_cond->acct_list + && list_count(acct_q->assoc_cond->acct_list)) { + itr = list_iterator_create(acct_q->assoc_cond->acct_list); + if(list_count(acct_q->assoc_cond->acct_list) > 1) set = 2; else set = 0; diff --git a/src/plugins/accounting_storage/mysql/accounting_storage_mysql.c b/src/plugins/accounting_storage/mysql/accounting_storage_mysql.c index 7276b58dfc0a034d311256a80310c89473df5d3e..bab20231d31a2390357a064c97173490a9a451ea 100644 --- a/src/plugins/accounting_storage/mysql/accounting_storage_mysql.c +++ b/src/plugins/accounting_storage/mysql/accounting_storage_mysql.c @@ -1761,8 +1761,9 @@ extern int acct_storage_p_add_coord(mysql_conn_t *mysql_conn, uint32_t uid, int rc = SLURM_SUCCESS; acct_user_rec_t *user_rec = NULL; - if(!user_cond || !user_cond->user_list - || !list_count(user_cond->user_list) + if(!user_cond || !user_cond->assoc_cond + || !user_cond->assoc_cond->user_list + || !list_count(user_cond->assoc_cond->user_list) || !acct_list || !list_count(acct_list)) { error("we need something to add"); return SLURM_ERROR; @@ -1775,7 +1776,7 @@ extern int acct_storage_p_add_coord(mysql_conn_t *mysql_conn, uint32_t uid, user_name = pw->pw_name; } - itr = list_iterator_create(user_cond->user_list); + itr = list_iterator_create(user_cond->assoc_cond->user_list); itr2 = list_iterator_create(acct_list); while((user = list_next(itr))) { while((acct = list_next(itr2))) { @@ -1825,7 +1826,7 @@ extern int acct_storage_p_add_coord(mysql_conn_t *mysql_conn, uint32_t uid, return rc; } /* get the update list set */ - itr = list_iterator_create(user_cond->user_list); + itr = list_iterator_create(user_cond->assoc_cond->user_list); while((user = list_next(itr))) { user_rec = xmalloc(sizeof(acct_user_rec_t)); user_rec->name = xstrdup(user); @@ -2670,10 +2671,11 @@ extern List acct_storage_p_modify_users(mysql_conn_t *mysql_conn, uint32_t uid, } xstrcat(extra, "where deleted=0"); - if(user_cond->user_list && list_count(user_cond->user_list)) { + if(user_cond->assoc_cond && user_cond->assoc_cond->user_list + && list_count(user_cond->assoc_cond->user_list)) { set = 0; xstrcat(extra, " && ("); - itr = list_iterator_create(user_cond->user_list); + itr = list_iterator_create(user_cond->assoc_cond->user_list); while((object = list_next(itr))) { if(set) xstrcat(extra, " || "); @@ -2903,10 +2905,12 @@ extern List acct_storage_p_modify_accounts( } xstrcat(extra, "where deleted=0"); - if(acct_cond->acct_list && list_count(acct_cond->acct_list)) { + if(acct_cond->assoc_cond + && acct_cond->assoc_cond->acct_list + && list_count(acct_cond->assoc_cond->acct_list)) { set = 0; xstrcat(extra, " && ("); - itr = list_iterator_create(acct_cond->acct_list); + itr = list_iterator_create(acct_cond->assoc_cond->acct_list); while((object = list_next(itr))) { if(set) xstrcat(extra, " || "); @@ -3624,10 +3628,11 @@ extern List acct_storage_p_remove_users(mysql_conn_t *mysql_conn, uint32_t uid, xstrcat(extra, "where deleted=0"); - if(user_cond->user_list && list_count(user_cond->user_list)) { + if(user_cond->assoc_cond && user_cond->assoc_cond->user_list + && list_count(user_cond->assoc_cond->user_list)) { set = 0; xstrcat(extra, " && ("); - itr = list_iterator_create(user_cond->user_list); + itr = list_iterator_create(user_cond->assoc_cond->user_list); while((object = list_next(itr))) { if(set) xstrcat(extra, " || "); @@ -3815,14 +3820,15 @@ extern List acct_storage_p_remove_coord(mysql_conn_t *mysql_conn, uint32_t uid, /* Leave it this way since we are using extra below */ - if(user_cond->user_list && list_count(user_cond->user_list)) { + if(user_cond->assoc_cond && user_cond->assoc_cond->user_list + && list_count(user_cond->assoc_cond->user_list)) { set = 0; if(extra) xstrcat(extra, " && ("); else xstrcat(extra, " ("); - itr = list_iterator_create(user_cond->user_list); + itr = list_iterator_create(user_cond->assoc_cond->user_list); while((object = list_next(itr))) { if(set) xstrcat(extra, " || "); @@ -3971,10 +3977,12 @@ extern List acct_storage_p_remove_accts(mysql_conn_t *mysql_conn, uint32_t uid, return NULL; xstrcat(extra, "where deleted=0"); - if(acct_cond->acct_list && list_count(acct_cond->acct_list)) { + if(acct_cond->assoc_cond + && acct_cond->assoc_cond->acct_list + && list_count(acct_cond->assoc_cond->acct_list)) { set = 0; xstrcat(extra, " && ("); - itr = list_iterator_create(acct_cond->acct_list); + itr = list_iterator_create(acct_cond->assoc_cond->acct_list); while((object = list_next(itr))) { if(set) xstrcat(extra, " || "); @@ -4704,10 +4712,12 @@ extern List acct_storage_p_get_users(mysql_conn_t *mysql_conn, xstrcat(extra, "where deleted=0"); - if(user_cond->user_list && list_count(user_cond->user_list)) { + if(user_cond->assoc_cond && + user_cond->assoc_cond->user_list + && list_count(user_cond->assoc_cond->user_list)) { set = 0; xstrcat(extra, " && ("); - itr = list_iterator_create(user_cond->user_list); + itr = list_iterator_create(user_cond->assoc_cond->user_list); while((object = list_next(itr))) { if(set) xstrcat(extra, " || "); @@ -4869,10 +4879,12 @@ extern List acct_storage_p_get_accts(mysql_conn_t *mysql_conn, else xstrcat(extra, "where deleted=0"); - if(acct_cond->acct_list && list_count(acct_cond->acct_list)) { + if(acct_cond->assoc_cond + && acct_cond->assoc_cond->acct_list + && list_count(acct_cond->assoc_cond->acct_list)) { set = 0; xstrcat(extra, " && ("); - itr = list_iterator_create(acct_cond->acct_list); + itr = list_iterator_create(acct_cond->assoc_cond->acct_list); while((object = list_next(itr))) { if(set) xstrcat(extra, " || "); diff --git a/src/sacctmgr/account_functions.c b/src/sacctmgr/account_functions.c index 665554ba507bfc19d2dea739720eeb927ae139a2..5864e674f36e2cae11d1c0a052b54931fe91d8c7 100644 --- a/src/sacctmgr/account_functions.c +++ b/src/sacctmgr/account_functions.c @@ -77,16 +77,12 @@ static int _set_cond(int *start, int argc, char *argv[], } else if(!end || !strncasecmp (argv[i], "Names", 1) || !strncasecmp (argv[i], "Accouts", 1)) { - if(!acct_cond->acct_list) { - acct_cond->acct_list = - list_create(slurm_destroy_char); + if(!acct_cond->assoc_cond->acct_list) { acct_cond->assoc_cond->acct_list = list_create(slurm_destroy_char); } - slurm_addto_char_list(acct_cond->acct_list, - argv[i]+end); slurm_addto_char_list(acct_cond->assoc_cond->acct_list, - argv[i]+end); + argv[i]+end); u_set = 1; } else if (!strncasecmp (argv[i], "Clusters", 1)) { if(!acct_cond->assoc_cond->cluster_list) { @@ -337,9 +333,12 @@ extern int sacctmgr_add_account(int argc, char *argv[]) return SLURM_SUCCESS; } else { acct_account_cond_t account_cond; + acct_association_cond_t assoc_cond; memset(&account_cond, 0, sizeof(acct_account_cond_t)); - account_cond.acct_list = name_list; + memset(&assoc_cond, 0, sizeof(acct_association_cond_t)); + assoc_cond.acct_list = name_list; + account_cond.assoc_cond = &assoc_cond; local_account_list = acct_storage_g_get_accounts( db_conn, &account_cond); diff --git a/src/sacctmgr/common.c b/src/sacctmgr/common.c index 27c25c7405dc47a3d953c0761e59292ebeb39da8..f1f269456c3af672d372dff2cf1357fed4df94e6 100644 --- a/src/sacctmgr/common.c +++ b/src/sacctmgr/common.c @@ -302,18 +302,21 @@ extern acct_user_rec_t *sacctmgr_find_user(char *name) { acct_user_rec_t *user = NULL; acct_user_cond_t user_cond; + acct_association_cond_t assoc_cond; List user_list = NULL; if(!name) return NULL; memset(&user_cond, 0, sizeof(acct_user_cond_t)); - user_cond.user_list = list_create(NULL); - list_append(user_cond.user_list, name); + memset(&assoc_cond, 0, sizeof(acct_association_cond_t)); + assoc_cond.user_list = list_create(NULL); + list_append(assoc_cond.user_list, name); + user_cond.assoc_cond = &assoc_cond; user_list = acct_storage_g_get_users(db_conn, &user_cond); - list_destroy(user_cond.user_list); + list_destroy(assoc_cond.user_list); if(user_list) user = list_pop(user_list); @@ -327,18 +330,21 @@ extern acct_account_rec_t *sacctmgr_find_account(char *name) { acct_account_rec_t *account = NULL; acct_account_cond_t account_cond; + acct_association_cond_t assoc_cond; List account_list = NULL; if(!name) return NULL; memset(&account_cond, 0, sizeof(acct_account_cond_t)); - account_cond.acct_list = list_create(NULL); - list_append(account_cond.acct_list, name); + memset(&assoc_cond, 0, sizeof(acct_association_cond_t)); + assoc_cond.acct_list = list_create(NULL); + list_append(assoc_cond.acct_list, name); + account_cond.assoc_cond = &assoc_cond; account_list = acct_storage_g_get_accounts(db_conn, &account_cond); - list_destroy(account_cond.acct_list); + list_destroy(assoc_cond.acct_list); if(account_list) account = list_pop(account_list); diff --git a/src/sacctmgr/file_functions.c b/src/sacctmgr/file_functions.c index a2fac5ebe16fc279989b8ae66483b5ade288507c..7142d1392344e9f6c6bc687f17bb46fc394a062d 100644 --- a/src/sacctmgr/file_functions.c +++ b/src/sacctmgr/file_functions.c @@ -661,9 +661,11 @@ static int _mod_acct(sacctmgr_file_opts_t *file_opts, char *desc = NULL, *org = NULL; acct_account_rec_t mod_acct; acct_account_cond_t acct_cond; + acct_association_cond_t assoc_cond; memset(&mod_acct, 0, sizeof(acct_account_rec_t)); memset(&acct_cond, 0, sizeof(acct_account_cond_t)); + memset(&assoc_cond, 0, sizeof(acct_association_cond_t)); if(file_opts->desc) desc = xstrdup(file_opts->desc); @@ -745,18 +747,18 @@ static int _mod_acct(sacctmgr_file_opts_t *file_opts, if(changed) { List ret_list = NULL; - acct_cond.acct_list = - list_create(NULL); - - list_push(acct_cond.acct_list, - acct->name); - + assoc_cond.acct_list = list_create(NULL); + list_append(assoc_cond.acct_list, acct->name); + acct_cond.assoc_cond = &assoc_cond; + notice_thread_init(); ret_list = acct_storage_g_modify_accounts(db_conn, my_uid, &acct_cond, &mod_acct); notice_thread_fini(); + list_destroy(assoc_cond.acct_list); + if(mod_acct.qos_list) list_destroy(mod_acct.qos_list); @@ -790,12 +792,15 @@ static int _mod_user(sacctmgr_file_opts_t *file_opts, acct_user_rec_t mod_user; acct_user_cond_t user_cond; List ret_list = NULL; + acct_association_cond_t assoc_cond; memset(&mod_user, 0, sizeof(acct_user_rec_t)); memset(&user_cond, 0, sizeof(acct_user_cond_t)); + memset(&assoc_cond, 0, sizeof(acct_association_cond_t)); - user_cond.user_list = list_create(NULL); - list_push(user_cond.user_list, user->name); + assoc_cond.user_list = list_create(NULL); + list_append(assoc_cond.user_list, user->name); + user_cond.assoc_cond = &assoc_cond; if(file_opts->def_acct) def_acct = xstrdup(file_opts->def_acct); @@ -975,7 +980,7 @@ static int _mod_user(sacctmgr_file_opts_t *file_opts, } list_destroy(add_list); } - list_destroy(user_cond.user_list); + list_destroy(assoc_cond.user_list); return set; } @@ -1673,17 +1678,20 @@ extern void load_sacctmgr_cfg_file (int argc, char *argv[]) if(file_opts->coord_list) { acct_user_cond_t user_cond; + acct_association_cond_t assoc_cond; ListIterator coord_itr = NULL; char *temp_char = NULL; acct_coord_rec_t *coord = NULL; memset(&user_cond, 0, sizeof(acct_user_cond_t)); - user_cond.user_list = - list_create(NULL); - - list_push(user_cond.user_list, - user->name); + memset(&assoc_cond, 0, + sizeof(acct_association_cond_t)); + assoc_cond.user_list = + list_create(NULL); + list_append(assoc_cond.user_list, + user->name); + user_cond.assoc_cond = &assoc_cond; notice_thread_init(); rc = acct_storage_g_add_coord( @@ -1691,7 +1699,7 @@ extern void load_sacctmgr_cfg_file (int argc, char *argv[]) file_opts->coord_list, &user_cond); notice_thread_fini(); - list_destroy(user_cond.user_list); + list_destroy(assoc_cond.user_list); user->coord_accts = list_create( destroy_acct_coord_rec); coord_itr = list_iterator_create( diff --git a/src/sacctmgr/user_functions.c b/src/sacctmgr/user_functions.c index 86e1c76a9042c5914e0b7ae6fa86e3528066d28d..37160a77f5bffd11fbe211291045653d159980ec 100644 --- a/src/sacctmgr/user_functions.c +++ b/src/sacctmgr/user_functions.c @@ -77,14 +77,10 @@ static int _set_cond(int *start, int argc, char *argv[], } else if(!end || !strncasecmp (argv[i], "Names", 1) || !strncasecmp (argv[i], "Users", 1)) { - if(!user_cond->user_list) { - user_cond->user_list = - list_create(slurm_destroy_char); + if(!user_cond->assoc_cond->user_list) { user_cond->assoc_cond->user_list = list_create(slurm_destroy_char); } - slurm_addto_char_list(user_cond->user_list, - argv[i]+end); slurm_addto_char_list(user_cond->assoc_cond->user_list, argv[i]+end); u_set = 1; @@ -376,8 +372,8 @@ extern int sacctmgr_add_user(int argc, char *argv[]) acct_user_cond_t user_cond; memset(&user_cond, 0, sizeof(acct_user_cond_t)); - user_cond.user_list = assoc_cond->user_list; - + user_cond.assoc_cond = assoc_cond; + local_user_list = acct_storage_g_get_users( db_conn, &user_cond); @@ -398,7 +394,7 @@ extern int sacctmgr_add_user(int argc, char *argv[]) acct_account_cond_t account_cond; memset(&account_cond, 0, sizeof(acct_account_cond_t)); - account_cond.acct_list = assoc_cond->acct_list; + account_cond.assoc_cond = assoc_cond; local_acct_list = acct_storage_g_get_accounts( db_conn, &account_cond); @@ -729,7 +725,7 @@ extern int sacctmgr_add_coord(int argc, char *argv[]) return SLURM_ERROR; } - itr = list_iterator_create(user_cond->user_list); + itr = list_iterator_create(user_cond->assoc_cond->user_list); while((name = list_next(itr))) { xstrfmtcat(user_str, " %s\n", name); @@ -1385,7 +1381,7 @@ extern int sacctmgr_delete_coord(int argc, char *argv[]) return SLURM_ERROR; } - itr = list_iterator_create(user_cond->user_list); + itr = list_iterator_create(user_cond->assoc_cond->user_list); while((name = list_next(itr))) { xstrfmtcat(user_str, " %s\n", name); diff --git a/src/sreport/user_reports.c b/src/sreport/user_reports.c index 8b9bacc2266a6d1a3f740301ca00380a081a8ae5..a87fa89d9f3e9618b1b9e330ebd4f17ecb778ff8 100644 --- a/src/sreport/user_reports.c +++ b/src/sreport/user_reports.c @@ -155,10 +155,11 @@ static int _set_cond(int *start, int argc, char *argv[], group_accts = 1; } else if(!end || !strncasecmp (argv[i], "Users", 1)) { - if(!user_cond->user_list) - user_cond->user_list = + if(!assoc_cond->user_list) + assoc_cond->user_list = list_create(slurm_destroy_char); - slurm_addto_char_list(user_cond->user_list, argv[i]); + slurm_addto_char_list(assoc_cond->user_list, + argv[i]); set = 1; } else if (!strncasecmp (argv[i], "Accounts", 2)) { if(!assoc_cond->acct_list)