Skip to content
Snippets Groups Projects
Commit 3cf3180c authored by Danny Auble's avatar Danny Auble
Browse files

Fix issue with wckeys when tracking wckeys, but not enforcing them,

you could get multiple '*' wckeys.
parent 737e58bc
No related branches found
No related tags found
No related merge requests found
...@@ -25,6 +25,8 @@ documents those changes that are of interest to users and admins. ...@@ -25,6 +25,8 @@ documents those changes that are of interest to users and admins.
able to be destroyed for debug. able to be destroyed for debug.
-- Added extra index's into the database for better performance when -- Added extra index's into the database for better performance when
deleting users. deleting users.
-- Fix issue with wckeys when tracking wckeys but not enforcing them you could
get multiple '*' wckeys.
* Changes in Slurm 14.03.4 * Changes in Slurm 14.03.4
========================== ==========================
......
...@@ -176,6 +176,9 @@ static uint32_t _get_wckeyid(mysql_conn_t *mysql_conn, char **name, ...@@ -176,6 +176,9 @@ static uint32_t _get_wckeyid(mysql_conn_t *mysql_conn, char **name,
NULL) != SLURM_SUCCESS) { NULL) != SLURM_SUCCESS) {
List wckey_list = NULL; List wckey_list = NULL;
slurmdb_wckey_rec_t *wckey_ptr = NULL; slurmdb_wckey_rec_t *wckey_ptr = NULL;
/* we have already checked to make
sure this was the slurm user before
calling this */
wckey_list = list_create(slurmdb_destroy_wckey_rec); wckey_list = list_create(slurmdb_destroy_wckey_rec);
...@@ -187,9 +190,30 @@ static uint32_t _get_wckeyid(mysql_conn_t *mysql_conn, char **name, ...@@ -187,9 +190,30 @@ static uint32_t _get_wckeyid(mysql_conn_t *mysql_conn, char **name,
/* info("adding wckey '%s' '%s' '%s'", */ /* info("adding wckey '%s' '%s' '%s'", */
/* wckey_ptr->name, wckey_ptr->user, */ /* wckey_ptr->name, wckey_ptr->user, */
/* wckey_ptr->cluster); */ /* wckey_ptr->cluster); */
/* we have already checked to make
sure this was the slurm user before if (*name[0] == '*') {
calling this */ /* make sure the non * wckey has been added */
wckey_rec.name = (*name)+1;
if (assoc_mgr_fill_in_wckey(
mysql_conn, &wckey_rec,
ACCOUNTING_ENFORCE_WCKEYS,
NULL) != SLURM_SUCCESS) {
wckey_ptr = xmalloc(
sizeof(slurmdb_wckey_rec_t));
wckey_ptr->name =
xstrdup(wckey_rec.name);
wckey_ptr->user = xstrdup(user);
wckey_ptr->cluster = xstrdup(cluster);
list_prepend(wckey_list, wckey_ptr);
/* info("adding wckey '%s' '%s' " */
/* "'%s'", */
/* wckey_ptr->name, */
/* wckey_ptr->user, */
/* wckey_ptr->cluster); */
}
wckey_rec.name = (*name);
}
if (as_mysql_add_wckeys(mysql_conn, if (as_mysql_add_wckeys(mysql_conn,
slurm_get_slurm_user_id(), slurm_get_slurm_user_id(),
wckey_list) wckey_list)
......
...@@ -133,9 +133,11 @@ static int _make_sure_users_have_default( ...@@ -133,9 +133,11 @@ static int _make_sure_users_have_default(
MYSQL_RES *result = NULL; MYSQL_RES *result = NULL;
MYSQL_ROW row; MYSQL_ROW row;
char *wckey = NULL; char *wckey = NULL;
/* only look at non * and non deleted ones */
query = xstrdup_printf( query = xstrdup_printf(
"select distinct is_def, wckey_name from " "select distinct is_def, wckey_name from "
"\"%s_%s\" where user='%s' FOR UPDATE;", "\"%s_%s\" where user='%s' and wckey_name "
"not like '*%%' and deleted=0 FOR UPDATE;",
cluster, wckey_table, user); cluster, wckey_table, user);
debug4("%d(%s:%d) query\n%s", debug4("%d(%s:%d) query\n%s",
mysql_conn->conn, THIS_FILE, __LINE__, query); mysql_conn->conn, THIS_FILE, __LINE__, query);
...@@ -503,7 +505,7 @@ extern int as_mysql_add_wckeys(mysql_conn_t *mysql_conn, uint32_t uid, ...@@ -503,7 +505,7 @@ extern int as_mysql_add_wckeys(mysql_conn_t *mysql_conn, uint32_t uid,
while ((object = list_next(itr))) { while ((object = list_next(itr))) {
if (!object->cluster || !object->cluster[0] if (!object->cluster || !object->cluster[0]
|| !object->user || !object->user[0] || !object->user || !object->user[0]
|| !object->name || !object->name[0]) { || !object->name) {
error("We need a wckey name, cluster, " error("We need a wckey name, cluster, "
"and user to add."); "and user to add.");
rc = SLURM_ERROR; rc = SLURM_ERROR;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment