From 4de41a8965c3843f310e3e43426dd8023f94bddf Mon Sep 17 00:00:00 2001
From: Moe Jette <jette1@llnl.gov>
Date: Wed, 18 Jun 2008 15:47:04 +0000
Subject: [PATCH] svn merge -r14264:14283
 https://eris.llnl.gov/svn/slurm/branches/slurm-1.2

---
 NEWS                    |  8 +++++++-
 src/slurmctld/job_mgr.c | 20 ++++++++++++++++----
 2 files changed, 23 insertions(+), 5 deletions(-)

diff --git a/NEWS b/NEWS
index 169965ddd7f..69928fabbb9 100644
--- a/NEWS
+++ b/NEWS
@@ -335,6 +335,10 @@ documents those changes that are of interest to users and admins.
     Moved existing digital signature logic into new plugin: crypto/openssl.
     Added new support for crypto/munge (available with GPL license).
 
+* Changes in SLURM 1.2.32
+=========================
+ -- Disable scancel of job in RootOnly partition only for sched/wiki2 (Moab).
+
 * Changes in SLURM 1.2.31
 =========================
  -- For Moab only: If GetEnvTimeout=0 in slurm.conf then do not run "su" to get
@@ -348,9 +352,11 @@ documents those changes that are of interest to users and admins.
  -- In select/cons_res improve the resource selection when a job has specified
     a processor count along with a maximum node count.
  -- For an srun command with --ntasks-per-node option and *no* --ntasks count,
-    spawn a task count equal to the number of nodes selected multipled by the 
+    spawn a task count equal to the number of nodes selected multiplied by the 
     --ntasks-per-node value.
  -- In jobcomp/script: Set TZ if set in slurmctld's environment.
+ -- In srun with --verbose option properly format CPU allocation information 
+    logged for clusters with 1000+ nodes and 10+ CPUs per node.
  -- Process a job's --mail_type=end option on any job of job termination, not
     just normal completion (e.g. all failure modes too).
 
diff --git a/src/slurmctld/job_mgr.c b/src/slurmctld/job_mgr.c
index 39363695caa..f7d03451b58 100644
--- a/src/slurmctld/job_mgr.c
+++ b/src/slurmctld/job_mgr.c
@@ -1579,6 +1579,18 @@ extern int job_signal(uint32_t job_id, uint16_t signal, uint16_t batch_flag,
 	struct job_record *job_ptr;
 	time_t now = time(NULL);
 	bool super_user;
+	static bool wiki2_sched = false;
+	static bool wiki2_sched_test = false;
+
+	/* Jobs submitted using Moab command should be cancelled using
+	 * Moab command for accurate job records */
+	if (!wiki2_sched_test) {
+		char *sched_type = slurm_get_sched_type();
+		if (strcmp(sched_type, "sched/wiki2") == 0)
+			wiki2_sched = true;
+		xfree(sched_type);
+		wiki2_sched_test = true;
+	}
 
 	job_ptr = find_job_record(job_id);
 	if (job_ptr == NULL) {
@@ -1592,10 +1604,10 @@ extern int job_signal(uint32_t job_id, uint16_t signal, uint16_t batch_flag,
 		      uid);
 		return ESLURM_ACCESS_DENIED;
 	}
-	if ((!super_user) && job_ptr->part_ptr
-	    &&  (job_ptr->part_ptr->root_only)) {
-		info("Attempt to cancel job in RootOnly partition from uid %d",
-		     uid);
+	if ((!super_user) && (signal == SIGKILL) && job_ptr->part_ptr &&
+	    (job_ptr->part_ptr->root_only) && wiki2_sched) {
+		info("Attempt to cancel Moab job using Slurm command from "
+		     "uid %d", uid);
 		return ESLURM_ACCESS_DENIED;
 	}
 
-- 
GitLab