From 5850c2d5f1e7ea2cccf8a3878d0140f3483811ff Mon Sep 17 00:00:00 2001
From: Tim Shaw <tshaw@schedmd.com>
Date: Tue, 21 Mar 2017 16:14:36 -0600
Subject: [PATCH] Improve error output when updating a reservation that has
 already started.

---
 NEWS                        | 1 +
 slurm/slurm_errno.h         | 1 +
 src/common/slurm_errno.c    | 2 ++
 src/slurmctld/reservation.c | 2 +-
 4 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/NEWS b/NEWS
index 2b5d7926abc..dfddfef37db 100644
--- a/NEWS
+++ b/NEWS
@@ -87,6 +87,7 @@ documents those changes that are of interest to users and administrators.
  -- Fix for CPU binding for job steps run under a batch job.
  -- Fix 'flags' variable to be 32 bit from the old 16 bit value in the perl api.
  -- Export sched_nodes for a job in the perl api.
+ -- Improve error output when updating a reservation that has already started.
 
 * Changes in Slurm 17.02.0
 ==========================
diff --git a/slurm/slurm_errno.h b/slurm/slurm_errno.h
index 9f6e5feec34..95dc6ad3b97 100644
--- a/slurm/slurm_errno.h
+++ b/slurm/slurm_errno.h
@@ -192,6 +192,7 @@ enum {
 	ESLURM_PARTITION_DOWN,
 	ESLURM_DUPLICATE_GRES,
 	ESLURM_JOB_SETTING_DB_INX,
+	ESLURM_RSV_ALREADY_STARTED,
 
 	/* switch specific error codes, specific values defined in plugin module */
 	ESLURM_SWITCH_MIN = 3000,
diff --git a/src/common/slurm_errno.c b/src/common/slurm_errno.c
index 2ed0f0d6cda..ed472e87d16 100644
--- a/src/common/slurm_errno.c
+++ b/src/common/slurm_errno.c
@@ -331,6 +331,8 @@ static slurm_errtab_t slurm_errtab[] = {
 	  "Duplicate generic resource (gres) specification"	},
 	{ ESLURM_JOB_SETTING_DB_INX,
 	  "Job update not available right now, the DB index is being set, try again in a bit" },
+	{ ESLURM_RSV_ALREADY_STARTED,
+	  "Reservation already started"	},
 
 	/* slurmd error codes */
 	{ ESLRUMD_PIPE_ERROR_ON_TASK_SPAWN,
diff --git a/src/slurmctld/reservation.c b/src/slurmctld/reservation.c
index 306d39dd4ef..6bbc0820d7f 100644
--- a/src/slurmctld/reservation.c
+++ b/src/slurmctld/reservation.c
@@ -2661,7 +2661,7 @@ extern int update_resv(resv_desc_msg_t *resv_desc_ptr)
 	if (resv_desc_ptr->start_time != (time_t) NO_VAL) {
 		if (resv_ptr->start_time <= time(NULL)) {
 			info("%s: reservation already started", __func__);
-			error_code = ESLURM_INVALID_TIME_VALUE;
+			error_code = ESLURM_RSV_ALREADY_STARTED;
 			goto update_failure;
 		}
 		if (resv_desc_ptr->start_time < (now - 60)) {
-- 
GitLab