From 370a54613df284ea2dfa6287ff0fbb1972d2971e Mon Sep 17 00:00:00 2001
From: Moe Jette <jette1@llnl.gov>
Date: Tue, 22 Apr 2008 00:05:48 +0000
Subject: [PATCH]  -- scontrol modified to report partition partition's
 "DisableRootJobs" value.  -- NOTE: We needed to change an RPC from version
 1.3.0. You must upgrade     all nodes in a cluster from v1.3.0 to v1.3.1 at
 the same time.

---
 META                             |  4 ++--
 NEWS                             |  3 +++
 slurm/slurm.h.in                 | 27 ++++++++++++++-------------
 src/api/config_info.c            |  6 ++++--
 src/api/partition_info.c         |  7 ++++++-
 src/common/slurm_protocol_pack.c |  1 +
 src/slurmctld/partition_mgr.c    |  1 +
 7 files changed, 31 insertions(+), 18 deletions(-)

diff --git a/META b/META
index 6c2222c9f3b..2886e9d30a0 100644
--- a/META
+++ b/META
@@ -12,6 +12,6 @@
   Micro:        1
   Version:	1.3.1
   Release:	1
-  API_CURRENT:	12	
-  API_AGE:	1
+  API_CURRENT:	13
+  API_AGE:	0
   API_REVISION:	0
diff --git a/NEWS b/NEWS
index 27c11c2a6d2..8be11dbc06f 100644
--- a/NEWS
+++ b/NEWS
@@ -16,6 +16,9 @@ documents those changes that are of interest to users and admins.
     Doug Wightman, CRI).
  -- Fix bug if sched/wiki or sched/wiki2 are configured and no job comment is 
     set.
+ -- scontrol modified to report partition partition's "DisableRootJobs" value.
+ -- NOTE: We needed to change an RPC from version 1.3.0. You must upgrade 
+    all nodes in a cluster from v1.3.0 to v1.3.1 at the same time.
 
 * Changes in SLURM 1.3.1
 ========================
diff --git a/slurm/slurm.h.in b/slurm/slurm.h.in
index fe192dfb51e..e74e1c8e16c 100644
--- a/slurm/slurm.h.in
+++ b/slurm/slurm.h.in
@@ -865,25 +865,26 @@ typedef struct job_alloc_info_msg {
 } job_alloc_info_msg_t;
 
 typedef struct partition_info {
-	char *name;		/* name of the partition */
-	uint32_t max_time;	/* minutes or INFINITE */
-	uint32_t max_nodes;	/* per job or INFINITE */
-	uint32_t min_nodes;	/* per job */
-	uint32_t total_nodes;	/* total number of nodes in the partition */
-	uint32_t total_cpus;	/* total number of cpus in the partition */
-	uint16_t node_scaling;	/* select plugin node scaling factor */
+	char *allow_groups;	/* comma delimited list of groups, 
+				 * null indicates all */
 	uint16_t default_part;	/* 1 if this is default partition */
+	uint16_t disable_root_jobs; /* 1 if user root jobs disabled */
 	uint16_t hidden;	/* 1 if partition is hidden by default */
-	uint16_t priority;	/* scheduling priority for jobs */
-	uint16_t root_only;	/* 1 if allocate must come for user root */
+	uint32_t max_nodes;	/* per job or INFINITE */
 	uint16_t max_share;	/* number of jobs to gang schedule */
-	uint16_t state_up;	/* 1 if state is up, 0 if down */
-	char *nodes;		/* list names of nodes in partition */
+	uint32_t max_time;	/* minutes or INFINITE */
+	uint32_t min_nodes;	/* per job */
+	char *name;		/* name of the partition */
 	int *node_inx;		/* list index pairs into node_table:
 				 * start_range_1, end_range_1, 
 				 * start_range_2, .., -1  */
-	char *allow_groups;	/* comma delimited list of groups, 
-				 * null indicates all */
+	uint16_t node_scaling;	/* select plugin node scaling factor */
+	char *nodes;		/* list names of nodes in partition */
+	uint16_t priority;	/* scheduling priority for jobs */
+	uint16_t root_only;	/* 1 if allocate must come for user root */
+	uint16_t state_up;	/* 1 if state is up, 0 if down */
+	uint32_t total_cpus;	/* total number of cpus in the partition */
+	uint32_t total_nodes;	/* total number of nodes in the partition */
 } partition_info_t;
 
 typedef struct delete_partition_msg {
diff --git a/src/api/config_info.c b/src/api/config_info.c
index ba4556c8c08..e649accd835 100644
--- a/src/api/config_info.c
+++ b/src/api/config_info.c
@@ -158,8 +158,10 @@ void slurm_print_ctl_conf ( FILE* out,
 			slurm_ctl_conf_ptr->def_mem_per_task);
 	} else
 		fprintf(out, "DefMemPerTask           = UNLIMITED\n");
-	fprintf(out, "DisableRootJobs         = %u\n",
-		slurm_ctl_conf_ptr->disable_root_jobs);
+	if (slurm_ctl_conf_ptr->disable_root_jobs)
+		fprintf(out, "DisableRootJobs         = YES\n");
+	else
+		fprintf(out, "DisableRootJobs         = NO\n");
 	fprintf(out, "Epilog                  = %s\n",
 		slurm_ctl_conf_ptr->epilog);
 	fprintf(out, "EpilogMsgTime           = %u\n",
diff --git a/src/api/partition_info.c b/src/api/partition_info.c
index 022778526fa..ff6fba90121 100644
--- a/src/api/partition_info.c
+++ b/src/api/partition_info.c
@@ -1,8 +1,8 @@
 /*****************************************************************************\
  *  partition_info.c - get/print the partition state information of slurm
- *  $Id$
  *****************************************************************************
  *  Copyright (C) 2002-2007 The Regents of the University of California.
+ *  Copyright (C) 2008 Lawrence Livermore National Security.
  *  Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
  *  Written by Morris Jette <jette1@llnl.gov> et. al.
  *  LLNL-CODE-402394.
@@ -202,6 +202,11 @@ char *slurm_sprint_partition_info ( partition_info_t * part_ptr,
 		sprintf(tmp_line, "MaxNodes=%s ", tmp1);
 	}
 	xstrcat(out, tmp_line);
+	if (part_ptr->disable_root_jobs)
+		sprintf(tmp_line, "DisableRootJobs=YES ");
+	else
+		sprintf(tmp_line, "DisableRootJobs=NO ");
+	xstrcat(out, tmp_line);
 	if ((part_ptr->allow_groups == NULL) || 
 	    (part_ptr->allow_groups[0] == '\0'))
 		sprintf(tmp_line, "AllowGroups=ALL");
diff --git a/src/common/slurm_protocol_pack.c b/src/common/slurm_protocol_pack.c
index 4672025bba2..a0abfea9782 100644
--- a/src/common/slurm_protocol_pack.c
+++ b/src/common/slurm_protocol_pack.c
@@ -1897,6 +1897,7 @@ _unpack_partition_info_members(partition_info_t * part, Buf buffer)
 	
 	safe_unpack32(&part->total_cpus,   buffer);
 	safe_unpack16(&part->default_part, buffer);
+	safe_unpack16(&part->disable_root_jobs, buffer);
 	safe_unpack16(&part->hidden,       buffer);
 	safe_unpack16(&part->root_only,    buffer);
 	safe_unpack16(&part->max_share,    buffer);
diff --git a/src/slurmctld/partition_mgr.c b/src/slurmctld/partition_mgr.c
index b90b66cf135..ed69fb096d7 100644
--- a/src/slurmctld/partition_mgr.c
+++ b/src/slurmctld/partition_mgr.c
@@ -762,6 +762,7 @@ void pack_part(struct part_record *part_ptr, Buf buffer)
 	pack16(node_scaling, buffer);
 	pack32(part_ptr->total_cpus, buffer);
 	pack16(default_part_flag,    buffer);
+	pack16(part_ptr->disable_root_jobs, buffer);
 	pack16(part_ptr->hidden,     buffer);
 	pack16(part_ptr->root_only,  buffer);
 	pack16(part_ptr->max_share,  buffer);
-- 
GitLab