diff --git a/NEWS b/NEWS index 55b64fef6a7e7abce8e51f96b70e09dd613a96f2..fe76ccdce156201dcabef5beb6ad695f1c2548c5 100644 --- a/NEWS +++ b/NEWS @@ -157,6 +157,10 @@ documents those changes that are of interest to users and admins. doesn't exist in the /etc/passwd file and the account you are trying to add them to doesn't exist it would print (null) instead of the bad account name. + -- Fix associations/qos for when adding back a previously deleted object + the object will be cleared of all old limits. + -- BLUEGENE - Added back a lock when creating dynamic blocks to be more thread + safe on larger systems with heavy load. * Changes in SLURM 2.2.3 ======================== diff --git a/src/common/pack.c b/src/common/pack.c index 795e5452c2299bdd2bc661edf7400dd70a984967..1b2f40f03c3c57ab23cc493018749cba70418395 100644 --- a/src/common/pack.c +++ b/src/common/pack.c @@ -219,9 +219,8 @@ void packdouble(double val, Buf buffer) /* The 0.5 is here to round off. We have found on systems going out * more than 15 decimals will mess things up, but this corrects it. */ - uval.d = (val * FLOAT_MULT) + 0.5; + uval.d = (val * FLOAT_MULT); nl = HTON_uint64(uval.u); - if (remaining_buf(buffer) < sizeof(nl)) { if (buffer->size > (MAX_BUF_SIZE - BUF_SIZE)) { error("packdouble: buffer size too large"); @@ -256,6 +255,7 @@ int unpackdouble(double *valp, Buf buffer) uval.u = NTOH_uint64(nl); *valp = uval.d / FLOAT_MULT; + return SLURM_SUCCESS; } diff --git a/src/plugins/accounting_storage/mysql/accounting_storage_mysql.c b/src/plugins/accounting_storage/mysql/accounting_storage_mysql.c index f9fdb2637fa3845c75f336a8ce90c10348a0ccb8..7402e309a08ce9a08d777b709c1fde5dd188f253 100644 --- a/src/plugins/accounting_storage/mysql/accounting_storage_mysql.c +++ b/src/plugins/accounting_storage/mysql/accounting_storage_mysql.c @@ -1328,20 +1328,59 @@ extern int remove_cluster_tables(mysql_conn_t *mysql_conn, char *cluster_name) extern int setup_association_limits(slurmdb_association_rec_t *assoc, char **cols, char **vals, char **extra, qos_level_t qos_level, - bool get_fs) + bool for_add) { if (!assoc) return SLURM_ERROR; - if ((int32_t)assoc->shares_raw >= 0) { - xstrcat(*cols, ", shares"); - xstrfmtcat(*vals, ", %u", assoc->shares_raw); - xstrfmtcat(*extra, ", shares=%u", assoc->shares_raw); - } else if ((assoc->shares_raw == INFINITE) || get_fs) { + if (for_add) { + /* If we are adding we should make sure we don't get + old reside sitting around from a former life. + */ + if (assoc->shares_raw == NO_VAL) + assoc->shares_raw = INFINITE; + if (assoc->grp_cpu_mins == (uint64_t)NO_VAL) + assoc->grp_cpu_mins = (uint64_t)INFINITE; + if (assoc->grp_cpu_run_mins == (uint64_t)NO_VAL) + assoc->grp_cpu_run_mins = (uint64_t)INFINITE; + if (assoc->grp_cpus == NO_VAL) + assoc->grp_cpus = INFINITE; + if (assoc->grp_jobs == NO_VAL) + assoc->grp_jobs = INFINITE; + if (assoc->grp_nodes == NO_VAL) + assoc->grp_nodes = INFINITE; + if (assoc->grp_submit_jobs == NO_VAL) + assoc->grp_submit_jobs = INFINITE; + if (assoc->grp_wall == NO_VAL) + assoc->grp_wall = INFINITE; + if (assoc->max_cpu_mins_pj == (uint64_t)NO_VAL) + assoc->max_cpu_mins_pj = (uint64_t)INFINITE; + if (assoc->max_cpu_run_mins == (uint64_t)NO_VAL) + assoc->max_cpu_run_mins = (uint64_t)INFINITE; + if (assoc->max_cpus_pj == NO_VAL) + assoc->max_cpus_pj = INFINITE; + if (assoc->max_jobs == NO_VAL) + assoc->max_jobs = INFINITE; + if (assoc->max_nodes_pj == NO_VAL) + assoc->max_nodes_pj = INFINITE; + if (assoc->max_submit_jobs == NO_VAL) + assoc->max_submit_jobs = INFINITE; + if (assoc->max_wall_pj == NO_VAL) + assoc->max_wall_pj = INFINITE; + if (assoc->def_qos_id == NO_VAL) + assoc->def_qos_id = INFINITE; + } + + if (assoc->shares_raw == INFINITE) { xstrcat(*cols, ", shares"); xstrcat(*vals, ", 1"); xstrcat(*extra, ", shares=1"); assoc->shares_raw = 1; + } else if ((assoc->shares_raw != NO_VAL) + && (int32_t)assoc->shares_raw >= 0) { + xstrcat(*cols, ", shares"); + xstrfmtcat(*vals, ", %u", assoc->shares_raw); + xstrfmtcat(*extra, ", shares=%u", assoc->shares_raw); } if (assoc->grp_cpu_mins == (uint64_t)INFINITE) { @@ -1357,6 +1396,19 @@ extern int setup_association_limits(slurmdb_association_rec_t *assoc, assoc->grp_cpu_mins); } + if (assoc->grp_cpu_run_mins == (uint64_t)INFINITE) { + xstrcat(*cols, ", grp_cpu_run_mins"); + xstrcat(*vals, ", NULL"); + xstrcat(*extra, ", grp_cpu_run_mins=NULL"); + } else if ((assoc->grp_cpu_run_mins != (uint64_t)NO_VAL) + && ((int64_t)assoc->grp_cpu_run_mins >= 0)) { + xstrcat(*cols, ", grp_cpu_run_mins"); + xstrfmtcat(*vals, ", %"PRIu64"", + assoc->grp_cpu_run_mins); + xstrfmtcat(*extra, ", grp_cpu_run_mins=%"PRIu64"", + assoc->grp_cpu_run_mins); + } + if (assoc->grp_cpus == INFINITE) { xstrcat(*cols, ", grp_cpus"); xstrcat(*vals, ", NULL"); @@ -1436,6 +1488,19 @@ extern int setup_association_limits(slurmdb_association_rec_t *assoc, assoc->max_cpu_mins_pj); } + if (assoc->max_cpu_run_mins == (uint64_t)INFINITE) { + xstrcat(*cols, ", max_cpu_run_mins"); + xstrcat(*vals, ", NULL"); + xstrcat(*extra, ", max_cpu_run_mins=NULL"); + } else if ((assoc->max_cpu_run_mins != (uint64_t)NO_VAL) + && ((int64_t)assoc->max_cpu_run_mins >= 0)) { + xstrcat(*cols, ", max_cpu_run_mins"); + xstrfmtcat(*vals, ", %"PRIu64"", + assoc->max_cpu_run_mins); + xstrfmtcat(*extra, ", max_cpu_run_mins=%"PRIu64"", + assoc->max_cpu_run_mins); + } + if (assoc->max_cpus_pj == INFINITE) { xstrcat(*cols, ", max_cpus_pj"); xstrcat(*vals, ", NULL"); diff --git a/src/plugins/accounting_storage/mysql/accounting_storage_mysql.h b/src/plugins/accounting_storage/mysql/accounting_storage_mysql.h index 09019c8724f484337a0c879185086fdfe1117c30..2b6ef9a83341fa62236ac85ff297b464ec7dcf46 100644 --- a/src/plugins/accounting_storage/mysql/accounting_storage_mysql.h +++ b/src/plugins/accounting_storage/mysql/accounting_storage_mysql.h @@ -119,7 +119,7 @@ extern int remove_cluster_tables(mysql_conn_t *mysql_conn, char *cluster_name); extern int setup_association_limits(slurmdb_association_rec_t *assoc, char **cols, char **vals, char **extra, qos_level_t qos_level, - bool get_fs); + bool for_add); extern int modify_common(mysql_conn_t *mysql_conn, uint16_t type, time_t now, diff --git a/src/plugins/accounting_storage/mysql/as_mysql_cluster.c b/src/plugins/accounting_storage/mysql/as_mysql_cluster.c index 45ca7d872b9efe15a54e18745a22b28fb5d394a2..edfdccc0cdc9be0a3afa4f1babe3ad376e5a290c 100644 --- a/src/plugins/accounting_storage/mysql/as_mysql_cluster.c +++ b/src/plugins/accounting_storage/mysql/as_mysql_cluster.c @@ -3,7 +3,7 @@ ***************************************************************************** * * Copyright (C) 2004-2007 The Regents of the University of California. - * Copyright (C) 2008-2010 Lawrence Livermore National Security. + * Copyright (C) 2008-2011 Lawrence Livermore National Security. * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). * Written by Danny Auble <da@llnl.gov> * diff --git a/src/plugins/accounting_storage/mysql/as_mysql_qos.c b/src/plugins/accounting_storage/mysql/as_mysql_qos.c index dccb0b56cf64507768b614f500810a3fce61fa98..80f3b00865a95109292fbe97cb8d0f49d7bc58ad 100644 --- a/src/plugins/accounting_storage/mysql/as_mysql_qos.c +++ b/src/plugins/accounting_storage/mysql/as_mysql_qos.c @@ -78,11 +78,56 @@ static int _preemption_loop(mysql_conn_t *mysql_conn, int begin_qosid, static int _setup_qos_limits(slurmdb_qos_rec_t *qos, char **cols, char **vals, - char **extra, char **added_preempt) + char **extra, char **added_preempt, + bool for_add) { if (!qos) return SLURM_ERROR; + if (for_add) { + /* If we are adding we should make sure we don't get + old reside sitting around from a former life. + */ + if (!qos->description) + qos->description = xstrdup(""); + if (qos->flags & QOS_FLAG_NOTSET) + qos->flags = 0; + if (qos->grp_cpu_mins == (uint64_t)NO_VAL) + qos->grp_cpu_mins = (uint64_t)INFINITE; + if (qos->grp_cpu_run_mins == (uint64_t)NO_VAL) + qos->grp_cpu_run_mins = (uint64_t)INFINITE; + if (qos->grp_cpus == NO_VAL) + qos->grp_cpus = INFINITE; + if (qos->grp_jobs == NO_VAL) + qos->grp_jobs = INFINITE; + if (qos->grp_nodes == NO_VAL) + qos->grp_nodes = INFINITE; + if (qos->grp_submit_jobs == NO_VAL) + qos->grp_submit_jobs = INFINITE; + if (qos->grp_wall == NO_VAL) + qos->grp_wall = INFINITE; + if (qos->max_cpu_mins_pj == (uint64_t)NO_VAL) + qos->max_cpu_mins_pj = (uint64_t)INFINITE; + if (qos->grp_cpu_run_mins == (uint64_t)NO_VAL) + qos->grp_cpu_run_mins = (uint64_t)INFINITE; + if (qos->max_cpus_pj == NO_VAL) + qos->max_cpus_pj = INFINITE; + if (qos->max_jobs_pu == NO_VAL) + qos->max_jobs_pu = INFINITE; + if (qos->max_nodes_pj == NO_VAL) + qos->max_nodes_pj = INFINITE; + if (qos->max_submit_jobs_pu == NO_VAL) + qos->max_submit_jobs_pu = INFINITE; + if (qos->max_wall_pj == NO_VAL) + qos->max_wall_pj = INFINITE; + if (qos->preempt_mode == (uint16_t)NO_VAL) + qos->preempt_mode = (uint16_t)INFINITE; + if (qos->usage_factor == (double)NO_VAL) + qos->usage_factor = (double)INFINITE; + if (qos->usage_thres == (double)NO_VAL) + qos->usage_thres = (double)INFINITE; + } + if (qos->description) { xstrcat(*cols, ", description"); xstrfmtcat(*vals, ", '%s'", qos->description); @@ -332,7 +377,7 @@ static int _setup_qos_limits(slurmdb_qos_rec_t *qos, xfree(preempt_val); } - if ((qos->usage_factor != (int16_t)NO_VAL) + if ((qos->preempt_mode != (uint16_t)NO_VAL) && ((int16_t)qos->preempt_mode >= 0)) { qos->preempt_mode &= (~PREEMPT_MODE_GANG); xstrcat(*cols, ", preempt_mode"); @@ -407,7 +452,8 @@ extern int as_mysql_add_qos(mysql_conn_t *mysql_conn, uint32_t uid, now, now, object->name); xstrfmtcat(extra, ", mod_time=%ld", now); - _setup_qos_limits(object, &cols, &vals, &extra, &added_preempt); + _setup_qos_limits(object, &cols, &vals, + &extra, &added_preempt, 1); if (added_preempt) { object->preempt_bitstr = bit_alloc(g_qos_count); bit_unfmt(object->preempt_bitstr, added_preempt+1); @@ -556,7 +602,8 @@ extern List as_mysql_modify_qos(mysql_conn_t *mysql_conn, uint32_t uid, xstrcat(extra, ")"); } - _setup_qos_limits(qos, &tmp_char1, &tmp_char2, &vals, &added_preempt); + _setup_qos_limits(qos, &tmp_char1, &tmp_char2, + &vals, &added_preempt, 0); if (added_preempt) { preempt_bitstr = bit_alloc(g_qos_count); bit_unfmt(preempt_bitstr, added_preempt+1); diff --git a/src/plugins/select/bluegene/bg_dynamic_block.c b/src/plugins/select/bluegene/bg_dynamic_block.c index 2e48700aaa1d9f609d59387b0feb2889261438da..38fae4ba589a89bb5ce8e0bc6bb654042457b198 100644 --- a/src/plugins/select/bluegene/bg_dynamic_block.c +++ b/src/plugins/select/bluegene/bg_dynamic_block.c @@ -77,6 +77,10 @@ extern List create_dynamic_block(List block_list, memset(&blockreq, 0, sizeof(select_ba_request_t)); memcpy(start_geo, request->geometry, sizeof(start_geo)); + /* We need to lock this just incase a blocks_overlap is called + which will in turn reset and set the system as it sees fit. + */ + slurm_mutex_lock(&block_state_mutex); if (my_block_list) { reset_ba_system(track_down_nodes); itr = list_iterator_create(my_block_list); @@ -428,6 +432,7 @@ finished: if (request->avail_mp_bitmap && (bit_ffc(request->avail_mp_bitmap) == -1)) ba_reset_all_removed_mps(); + slurm_mutex_unlock(&block_state_mutex); /* reset the ones we mucked with */ itr = list_iterator_create(my_block_list); diff --git a/src/sacctmgr/file_functions.c b/src/sacctmgr/file_functions.c index 40de864adf546f6fa892876c49f67aaf2de38521..13ccade8f8f7d06e0b0cdeba57754632af935afc 100644 --- a/src/sacctmgr/file_functions.c +++ b/src/sacctmgr/file_functions.c @@ -217,10 +217,14 @@ static void _destroy_sacctmgr_file_opts(void *object) xfree(file_opts->name); xfree(file_opts->org); xfree(file_opts->part); - if (file_opts->qos_list) + if (file_opts->qos_list) { list_destroy(file_opts->qos_list); - if (file_opts->wckey_list) + file_opts->qos_list = NULL; + } + if (file_opts->wckey_list) { list_destroy(file_opts->wckey_list); + file_opts->wckey_list = NULL; + } xfree(file_opts); } } diff --git a/src/sacctmgr/qos_functions.c b/src/sacctmgr/qos_functions.c index 047eabb8cade77d1e607dabfacad33f97ca6f316..363d5f178b8a9d4b402d73fb5239c595f565d461 100644 --- a/src/sacctmgr/qos_functions.c +++ b/src/sacctmgr/qos_functions.c @@ -582,6 +582,7 @@ extern int sacctmgr_add_qos(int argc, char *argv[]) qos = NULL; if(!sacctmgr_find_qos_from_list(g_qos_list, name)) { qos = xmalloc(sizeof(slurmdb_qos_rec_t)); + slurmdb_init_qos_rec(qos, 0); qos->name = xstrdup(name); if(start_qos->description) qos->description = @@ -610,6 +611,7 @@ extern int sacctmgr_add_qos(int argc, char *argv[]) qos->priority = start_qos->priority; qos->usage_factor = start_qos->usage_factor; + qos->usage_thres = start_qos->usage_thres; xstrfmtcat(qos_str, " %s\n", name); list_append(qos_list, qos);