diff --git a/src/plugins/accounting_storage/mysql/accounting_storage_mysql.c b/src/plugins/accounting_storage/mysql/accounting_storage_mysql.c index 01cd4781fb598391e08d8261ba97a34d9675812c..ac294da35e05615e1ee7d59492e92a94865ac47c 100644 --- a/src/plugins/accounting_storage/mysql/accounting_storage_mysql.c +++ b/src/plugins/accounting_storage/mysql/accounting_storage_mysql.c @@ -322,7 +322,7 @@ static int _modify_common(mysql_conn_t *mysql_conn, "values (%d, %d, \"%s\", '%s', \"%s\");", txn_table, now, type, cond_char, user_name, vals); - debug3("query\n%s", query); + debug3("%d query\n%s", mysql_conn->conn, query); rc = mysql_db_query(mysql_conn->acct_mysql_db, query); xfree(query); @@ -356,7 +356,7 @@ static int _remove_common(mysql_conn_t *mysql_conn, /* we want to remove completely all that is less than a day old */ if(table != assoc_table) { - query = xstrdup_printf("delete from %s where creation_time<%d " + query = xstrdup_printf("delete from %s where creation_time>%d " "&& (%s);", table, day_old, name_char); @@ -372,7 +372,7 @@ static int _remove_common(mysql_conn_t *mysql_conn, txn_table, now, type, name_char, user_name); - debug3("query\n%s", query); + debug3("%d query\n%s", mysql_conn->conn, query); rc = mysql_db_query(mysql_conn->acct_mysql_db, query); xfree(query); if(rc != SLURM_SUCCESS) { @@ -393,9 +393,10 @@ static int _remove_common(mysql_conn_t *mysql_conn, if(table == assoc_table || !assoc_char) assoc_char = name_char; - query = xstrdup_printf("select lft, rgt %s where " - "creation_time<%d && (%s);", + query = xstrdup_printf("select lft, rgt from %s where " + "creation_time>%d && (%s);", assoc_table, day_old, assoc_char); + if(!(result = mysql_db_query_ret(mysql_conn->acct_mysql_db, query))) { xfree(query); @@ -409,12 +410,13 @@ static int _remove_common(mysql_conn_t *mysql_conn, "delete from %s where lft between %s AND %s;", assoc_table, row[0], row[1]); xstrfmtcat(query, - "UPDATE %s SET rgt = rgt + %d WHERE rgt > %s;" - "UPDATE %s SET lft = lft + %d WHERE lft > %s;", + "UPDATE %s SET rgt = rgt - %d WHERE rgt > %s;" + "UPDATE %s SET lft = lft - %d WHERE lft > %s;", assoc_table, width, row[1], assoc_table, width, row[1]); + debug3("%d query\n%s", mysql_conn->conn, query); rc = mysql_db_query(mysql_conn->acct_mysql_db, query); xfree(query); if(rc != SLURM_SUCCESS) { @@ -432,7 +434,7 @@ static int _remove_common(mysql_conn_t *mysql_conn, query = xstrdup_printf("SELECT lft, rgt FROM %s WHERE %s;", assoc_table, assoc_char); - debug3("query\n%s", query); + debug3("%d query\n%s", mysql_conn->conn, query); if(!(result = mysql_db_query_ret(mysql_conn->acct_mysql_db, query))) { if(mysql_conn->rollback) { mysql_db_rollback(mysql_conn->acct_mysql_db); @@ -450,7 +452,7 @@ static int _remove_common(mysql_conn_t *mysql_conn, "where deleted=0 && lft between %s and %s;", assoc_table, now, row[0], row[1]); - debug3("query\n%s", query); + debug3("%d query\n%s", mysql_conn->conn, query); rc = mysql_db_query(mysql_conn->acct_mysql_db, query); xfree(query); if(rc != SLURM_SUCCESS) { @@ -1306,7 +1308,7 @@ extern int acct_storage_p_add_clusters(mysql_conn_t *mysql_conn, uint32_t uid, cluster_table, now, now, object->name, now); - debug3("query\n%s", query); + debug3("%d query\n%s", mysql_conn->conn, query); rc = mysql_db_query(mysql_conn->acct_mysql_db, query); xfree(query); if(rc != SLURM_SUCCESS) { @@ -1343,7 +1345,7 @@ extern int acct_storage_p_add_clusters(mysql_conn_t *mysql_conn, uint32_t uid, xfree(cols); xfree(vals); xfree(extra); - debug3("query\n%s", query); + debug3("%d query\n%s", mysql_conn->conn, query); rc = mysql_db_query(mysql_conn->acct_mysql_db, query); xfree(query); @@ -1589,7 +1591,7 @@ extern int acct_storage_p_add_associations(mysql_conn_t *mysql_conn, xfree(cols); xfree(vals); xfree(update); - debug3("query\n%s", query); + debug3("%d query\n%s", mysql_conn->conn, query); rc = mysql_db_query(mysql_conn->acct_mysql_db, query); xfree(query); if(rc != SLURM_SUCCESS) { diff --git a/src/sacctmgr/account_functions.c b/src/sacctmgr/account_functions.c index 0463f116a3b7d71d98a0d812c55ab5f6191b8389..befec66362f5a31729da98a10dc1b7baa4e9b574 100644 --- a/src/sacctmgr/account_functions.c +++ b/src/sacctmgr/account_functions.c @@ -90,9 +90,7 @@ static int _set_cond(int *start, int argc, char *argv[], } (*start) = i; - if(a_set && u_set) - return 3; - else if(a_set) + if(a_set) return 2; else if(u_set) return 1; diff --git a/src/slurmdbd/proc_req.c b/src/slurmdbd/proc_req.c index 0e6cda79a3b3515ae72bfad9ee597a9b5ba6c44a..8f85c805a9a630c03f3e6a234e8d26dccbf76cf1 100644 --- a/src/slurmdbd/proc_req.c +++ b/src/slurmdbd/proc_req.c @@ -290,13 +290,13 @@ static int _add_accounts(void *db_conn, memset(&user, 0, sizeof(acct_user_rec_t)); user.uid = *uid; if(!assoc_mgr_fill_in_user(db_conn, &user, 1)) { - comment = "Couldn't get user info"; + comment = "Your user has not been added to the accounting system yet."; error("%s", comment); rc = SLURM_ERROR; goto end_it; } if(!list_count(user.coord_accts)) { - comment = "User doesn't have privilege to preform this action"; + comment = "Your user doesn't have privilege to preform this action"; error("%s", comment); rc = ESLURM_ACCESS_DENIED; goto end_it; @@ -347,13 +347,13 @@ static int _add_account_coords(void *db_conn, memset(&user, 0, sizeof(acct_user_rec_t)); user.uid = *uid; if(!assoc_mgr_fill_in_user(db_conn, &user, 1)) { - comment = "Couldn't get user info"; + comment = "Your user has not been added to the accounting system yet."; error("%s", comment); rc = SLURM_ERROR; goto end_it; } if(!list_count(user.coord_accts)) { - comment = "User doesn't have privilege to preform this action"; + comment = "Your user doesn't have privilege to preform this action"; error("%s", comment); rc = ESLURM_ACCESS_DENIED; goto end_it; @@ -366,7 +366,7 @@ static int _add_account_coords(void *db_conn, list_iterator_destroy(itr); if(!coord) { - comment = "User doesn't have privilege to preform this action"; + comment = "Your user doesn't have privilege to preform this action"; error("%s", comment); rc = ESLURM_ACCESS_DENIED; goto end_it; @@ -409,13 +409,13 @@ static int _add_assocs(void *db_conn, memset(&user, 0, sizeof(acct_user_rec_t)); user.uid = *uid; if(!assoc_mgr_fill_in_user(db_conn, &user, 1)) { - comment = "Couldn't get user info"; + comment = "Your user has not been added to the accounting system yet."; error("%s", comment); rc = SLURM_ERROR; goto end_it; } if(!user.coord_accts || !list_count(user.coord_accts)) { - comment = "User doesn't have privilege to preform this action"; + comment = "Your user doesn't have privilege to preform this action"; error("%s", comment); rc = ESLURM_ACCESS_DENIED; goto end_it; @@ -439,7 +439,7 @@ static int _add_assocs(void *db_conn, list_iterator_destroy(itr2); list_iterator_destroy(itr); if(!coord) { - comment = "User doesn't have privilege to preform this action"; + comment = "Your user doesn't have privilege to preform this action"; error("%s", comment); rc = ESLURM_ACCESS_DENIED; goto end_it; @@ -463,7 +463,7 @@ static int _add_clusters(void *db_conn, debug2("DBD_ADD_CLUSTERS: called"); if(*uid != slurmdbd_conf->slurm_user_id && assoc_mgr_get_admin_level(db_conn, *uid) < ACCT_ADMIN_SUPER_USER) { - comment = "User doesn't have privilege to preform this action"; + comment = "Your user doesn't have privilege to preform this action"; error("%s", comment); rc = ESLURM_ACCESS_DENIED; goto end_it; @@ -500,13 +500,13 @@ static int _add_users(void *db_conn, memset(&user, 0, sizeof(acct_user_rec_t)); user.uid = *uid; if(!assoc_mgr_fill_in_user(db_conn, &user, 1)) { - comment = "Couldn't get user info"; + comment = "Your user has not been added to the accounting system yet."; error("%s", comment); rc = SLURM_ERROR; goto end_it; } if(!list_count(user.coord_accts)) { - comment = "User doesn't have privilege to preform this action"; + comment = "Your user doesn't have privilege to preform this action"; error("%s", comment); rc = ESLURM_ACCESS_DENIED; goto end_it; @@ -1007,7 +1007,7 @@ static int _modify_accounts(void *db_conn, debug2("DBD_MODIFY_ACCOUNTS: called"); if(*uid != slurmdbd_conf->slurm_user_id && assoc_mgr_get_admin_level(db_conn, *uid) < ACCT_ADMIN_OPERATOR) { - comment = "User doesn't have privilege to preform this action"; + comment = "Your user doesn't have privilege to preform this action"; error("%s", comment); *out_buffer = make_dbd_rc_msg(ESLURM_ACCESS_DENIED, comment, DBD_MODIFY_ACCOUNTS); @@ -1050,7 +1050,7 @@ static int _modify_assocs(void *db_conn, if(*uid != slurmdbd_conf->slurm_user_id && assoc_mgr_get_admin_level(db_conn, *uid) < ACCT_ADMIN_OPERATOR) { - comment = "User doesn't have privilege to preform this action"; + comment = "Your user doesn't have privilege to preform this action"; error("%s", comment); *out_buffer = make_dbd_rc_msg(ESLURM_ACCESS_DENIED, comment, DBD_MODIFY_ASSOCS); @@ -1092,7 +1092,7 @@ static int _modify_clusters(void *db_conn, if(*uid != slurmdbd_conf->slurm_user_id && assoc_mgr_get_admin_level(db_conn, *uid) < ACCT_ADMIN_SUPER_USER) { - comment = "User doesn't have privilege to preform this action"; + comment = "Your user doesn't have privilege to preform this action"; error("%s", comment); *out_buffer = make_dbd_rc_msg(ESLURM_ACCESS_DENIED, comment, DBD_MODIFY_CLUSTERS); @@ -1136,7 +1136,7 @@ static int _modify_users(void *db_conn, if(*uid != slurmdbd_conf->slurm_user_id && assoc_mgr_get_admin_level(db_conn, *uid) < ACCT_ADMIN_OPERATOR) { - comment = "User doesn't have privilege to preform this action"; + comment = "Your user doesn't have privilege to preform this action"; error("%s", comment); *out_buffer = make_dbd_rc_msg(ESLURM_ACCESS_DENIED, comment, DBD_MODIFY_USERS); @@ -1333,7 +1333,7 @@ static int _remove_accounts(void *db_conn, if(*uid != slurmdbd_conf->slurm_user_id && assoc_mgr_get_admin_level(db_conn, *uid) < ACCT_ADMIN_OPERATOR) { - comment = "User doesn't have privilege to preform this action"; + comment = "Your user doesn't have privilege to preform this action"; error("%s", comment); *out_buffer = make_dbd_rc_msg(ESLURM_ACCESS_DENIED, comment, DBD_REMOVE_ACCOUNTS); @@ -1383,7 +1383,7 @@ static int _remove_account_coords(void *db_conn, if(*uid != slurmdbd_conf->slurm_user_id && assoc_mgr_get_admin_level(db_conn, *uid) < ACCT_ADMIN_OPERATOR) { - comment = "User doesn't have privilege to preform this action"; + comment = "Your user doesn't have privilege to preform this action"; error("%s", comment); *out_buffer = make_dbd_rc_msg( ESLURM_ACCESS_DENIED, comment, @@ -1426,7 +1426,7 @@ static int _remove_assocs(void *db_conn, if(*uid != slurmdbd_conf->slurm_user_id && assoc_mgr_get_admin_level(db_conn, *uid) < ACCT_ADMIN_OPERATOR) { - comment = "User doesn't have privilege to preform this action"; + comment = "Your user doesn't have privilege to preform this action"; error("%s", comment); *out_buffer = make_dbd_rc_msg(ESLURM_ACCESS_DENIED, comment, DBD_REMOVE_ASSOCS); @@ -1470,7 +1470,7 @@ static int _remove_clusters(void *db_conn, if(*uid != slurmdbd_conf->slurm_user_id && assoc_mgr_get_admin_level(db_conn, *uid) < ACCT_ADMIN_SUPER_USER) { - comment = "User doesn't have privilege to preform this action"; + comment = "Your user doesn't have privilege to preform this action"; error("%s", comment); *out_buffer = make_dbd_rc_msg(ESLURM_ACCESS_DENIED, comment, DBD_REMOVE_CLUSTERS); @@ -1519,7 +1519,7 @@ static int _remove_users(void *db_conn, if(*uid != slurmdbd_conf->slurm_user_id && assoc_mgr_get_admin_level(db_conn, *uid) < ACCT_ADMIN_OPERATOR) { - comment = "User doesn't have privilege to preform this action"; + comment = "Your user doesn't have privilege to preform this action"; error("%s", comment); *out_buffer = make_dbd_rc_msg(ESLURM_ACCESS_DENIED, comment, DBD_REMOVE_USERS); @@ -1567,7 +1567,7 @@ static int _roll_usage(void *db_conn, if(*uid != slurmdbd_conf->slurm_user_id && assoc_mgr_get_admin_level(db_conn, *uid) < ACCT_ADMIN_OPERATOR) { - comment = "User doesn't have privilege to preform this action"; + comment = "Your user doesn't have privilege to preform this action"; error("%s", comment); rc = ESLURM_ACCESS_DENIED; goto end_it;