From 99b7a31b124b8993d6a83d072bc0522f4e6085a6 Mon Sep 17 00:00:00 2001
From: Danny Auble <da@llnl.gov>
Date: Wed, 26 Aug 2009 20:49:20 +0000
Subject: [PATCH] svn merge -r18526:18546
 https://eris.llnl.gov/svn/slurm/branches/slurm-2.0

---
 NEWS                                               |  1 +
 src/common/slurm_accounting_storage.c              |  2 +-
 .../mysql/accounting_storage_mysql.c               | 14 +++++++++-----
 .../accounting_storage/mysql/mysql_rollup.c        | 12 ++++++++++++
 src/sacctmgr/sacctmgr.c                            |  6 ++++--
 5 files changed, 27 insertions(+), 8 deletions(-)

diff --git a/NEWS b/NEWS
index ff2d4891a8c..c85287c0387 100644
--- a/NEWS
+++ b/NEWS
@@ -200,6 +200,7 @@ documents those changes that are of interest to users and admins.
     reservations (one with a flag of "Maintenance").
  -- Fix bug when updating a pending job's nice value after explicitly setting
     it's priority.
+ -- We no longer add blank QOS'
 
 * Changes in SLURM 2.0.4
 ========================
diff --git a/src/common/slurm_accounting_storage.c b/src/common/slurm_accounting_storage.c
index 22287e56d54..1321ac61976 100644
--- a/src/common/slurm_accounting_storage.c
+++ b/src/common/slurm_accounting_storage.c
@@ -7059,7 +7059,7 @@ extern char *acct_qos_str(List qos_list, uint32_t level)
 		return NULL;
 	} else if(!level) {
 		debug2("no level");
-		return "None";
+		return "";
 	}
 
 	itr = list_iterator_create(qos_list);
diff --git a/src/plugins/accounting_storage/mysql/accounting_storage_mysql.c b/src/plugins/accounting_storage/mysql/accounting_storage_mysql.c
index afff3df0fa5..3e5c199d6f8 100644
--- a/src/plugins/accounting_storage/mysql/accounting_storage_mysql.c
+++ b/src/plugins/accounting_storage/mysql/accounting_storage_mysql.c
@@ -665,6 +665,9 @@ static int _setup_association_limits(acct_association_rec_t *assoc,
 			list_iterator_create(assoc->qos_list);
 		
 		while((tmp_char = list_next(qos_itr))) {
+			/* we don't want to include blank names */
+			if(!tmp_char[0])
+				continue;
 			if(!set) {
 				if(tmp_char[0] == '+' || tmp_char[0] == '-')
 					qos_type = "delta_qos";
@@ -674,11 +677,12 @@ static int _setup_association_limits(acct_association_rec_t *assoc,
 		}
 		
 		list_iterator_destroy(qos_itr);
-		
-		xstrfmtcat(*cols, ", %s", qos_type);		
-		xstrfmtcat(*vals, ", '%s'", qos_val); 		
-		xstrfmtcat(*extra, ", %s=\"%s\"", qos_type, qos_val); 
-		xfree(qos_val);
+		if(qos_val) {
+			xstrfmtcat(*cols, ", %s", qos_type);		
+			xstrfmtcat(*vals, ", '%s'", qos_val); 		
+			xstrfmtcat(*extra, ", %s=\"%s\"", qos_type, qos_val); 
+			xfree(qos_val);
+		}
 	} else if((qos_level == QOS_LEVEL_SET) && default_qos_str) { 
 		/* Add default qos to the account */
 		xstrcat(*cols, ", qos");
diff --git a/src/plugins/accounting_storage/mysql/mysql_rollup.c b/src/plugins/accounting_storage/mysql/mysql_rollup.c
index 755c9b0489b..09e13b04fff 100644
--- a/src/plugins/accounting_storage/mysql/mysql_rollup.c
+++ b/src/plugins/accounting_storage/mysql/mysql_rollup.c
@@ -374,6 +374,17 @@ extern int mysql_hourly_rollup(mysql_conn_t *mysql_conn,
 		}
 		xfree(query);
 		
+		/* If a reservation overlaps another reservation we
+		   total up everything here as if they didn't but when
+		   calculating the total time for a cluster we will
+		   remove the extra time received.  This may result in
+		   unexpected results with association based reports
+		   since the association is given the total amount of
+		   time of each reservation, thus equaling more time
+		   that is available.  Job/Cluster/Reservation reports
+		   should be fine though since we really don't over
+		   allocate resources.
+		*/
 		while((row = mysql_fetch_row(result))) {
 			int row_start = atoi(row[RESV_REQ_START]);
 			int row_end = atoi(row[RESV_REQ_END]);
@@ -945,6 +956,7 @@ extern int mysql_hourly_rollup(mysql_conn_t *mysql_conn,
 		list_flush(assoc_usage_list);
 		list_flush(cluster_usage_list);
 		list_flush(wckey_usage_list);
+		list_flush(resv_usage_list);
 		curr_start = curr_end;
 		curr_end = curr_start + add_sec;
 	}
diff --git a/src/sacctmgr/sacctmgr.c b/src/sacctmgr/sacctmgr.c
index d7ed1517e57..b42016e46c6 100644
--- a/src/sacctmgr/sacctmgr.c
+++ b/src/sacctmgr/sacctmgr.c
@@ -823,10 +823,12 @@ sacctmgr [<OPTION>] [<COMMAND>]                                            \n\
        list cluster       - Format=, Names=, WOLimits                      \n\
        add cluster        - Fairshare=, GrpCPUs=, GrpJobs=,                \n\
                             GrpNodes=, GrpSubmitJob=, MaxCPUMins=          \n\
-                            MaxJobs=, MaxNodes=, MaxWall=, and Name=       \n\
+                            MaxJobs=, MaxNodes=, MaxWall=, Name=,          \n\
+                            and QosLevel=                                  \n\
        modify cluster     - (set options) Fairshare=,                      \n\
                             GrpCPUs=, GrpJobs=, GrpNodes=, GrpSubmitJob=,  \n\
-                            MaxCPUMins=, MaxJobs=, MaxNodes=, and MaxWall= \n\
+                            MaxCPUMins=, MaxJobs=, MaxNodes=, MaxWall=,    \n\
+                            and QosLevel=                                  \n\
                             (where options) Names=                         \n\
        delete cluster     - Names=                                         \n\
                                                                            \n\
-- 
GitLab