From aad76187daac9338dc5a6834546bcf73a86fbd9c Mon Sep 17 00:00:00 2001
From: Moe Jette <jette1@llnl.gov>
Date: Thu, 8 Oct 2009 20:00:50 +0000
Subject: [PATCH] sview and "scontrol show config" now report as SLURM_VERSION
 the version     of slurmctld rather than that of the command.

---
 NEWS                             | 2 ++
 slurm/slurm.h.in                 | 1 +
 src/api/config_info.c            | 2 +-
 src/common/slurm_protocol_defs.c | 1 +
 src/common/slurm_protocol_pack.c | 5 ++++-
 src/slurmctld/proc_req.c         | 1 +
 6 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/NEWS b/NEWS
index 8a9dcfdc7f0..769171aa6b1 100644
--- a/NEWS
+++ b/NEWS
@@ -44,6 +44,8 @@ documents those changes that are of interest to users and admins.
  -- Enable memory allocation logic for jobs step (i.e. allocate resources
     within the job's memory allocation and enforce limits).
  -- handle error state in sinfo
+ -- sview and "scontrol show config" now report as SLURM_VERSION the version 
+    of slurmctld rather than that of the command.
 
 * Changes in SLURM 2.1.0-pre4
 =============================
diff --git a/slurm/slurm.h.in b/slurm/slurm.h.in
index e9e8c11b95e..a654f1a829a 100644
--- a/slurm/slurm.h.in
+++ b/slurm/slurm.h.in
@@ -1392,6 +1392,7 @@ typedef struct slurm_ctl_conf {
                                       * job step have been signalled, before
                                       * they are considered "unkillable". */
 	uint16_t use_pam;	/* enable/disable PAM support */
+	char *version;		/* version of slurmctld */
 	uint16_t wait_time;	/* default job --wait time */
 	uint16_t z_16;		/* reserved for future use */
 	uint32_t z_32;		/* reserved for future use */
diff --git a/src/api/config_info.c b/src/api/config_info.c
index 6d103a589aa..3b53f1aff0c 100644
--- a/src/api/config_info.c
+++ b/src/api/config_info.c
@@ -885,7 +885,7 @@ extern void *slurm_ctl_conf_2_key_pairs (slurm_ctl_conf_t* slurm_ctl_conf_ptr)
 
 	key_pair = xmalloc(sizeof(config_key_pair_t));
 	key_pair->name = xstrdup("SLURM_VERSION");
-	key_pair->value = xstrdup(SLURM_VERSION);
+	key_pair->value = xstrdup(slurm_ctl_conf_ptr->version);
 	list_append(ret_list, key_pair);
 
 	key_pair = xmalloc(sizeof(config_key_pair_t));
diff --git a/src/common/slurm_protocol_defs.c b/src/common/slurm_protocol_defs.c
index d65301fde5e..0bd0457193f 100644
--- a/src/common/slurm_protocol_defs.c
+++ b/src/common/slurm_protocol_defs.c
@@ -1485,6 +1485,7 @@ void slurm_free_ctl_conf(slurm_ctl_conf_info_msg_t * config_ptr)
 		xfree(config_ptr->tmp_fs);
 		xfree(config_ptr->topology_plugin);
 		xfree(config_ptr->unkillable_program);
+		xfree(config_ptr->version);
 		xfree(config_ptr->z_char);
 		xfree(config_ptr);
 	}
diff --git a/src/common/slurm_protocol_pack.c b/src/common/slurm_protocol_pack.c
index 455384b6925..2295e288a09 100644
--- a/src/common/slurm_protocol_pack.c
+++ b/src/common/slurm_protocol_pack.c
@@ -3076,6 +3076,7 @@ _pack_slurm_ctl_conf_msg(slurm_ctl_conf_info_msg_t * build_ptr, Buf buffer)
 	pack16(build_ptr->use_pam, buffer);
 	packstr(build_ptr->unkillable_program, buffer);
 	pack16(build_ptr->unkillable_timeout, buffer);
+	packstr(build_ptr->version, buffer);
 
 	pack16(build_ptr->wait_time, buffer);
 
@@ -3304,7 +3305,8 @@ _unpack_slurm_ctl_conf_msg(slurm_ctl_conf_info_msg_t **
 	safe_unpackstr_xmalloc(&build_ptr->task_plugin, &uint32_tmp, buffer);
 	safe_unpack16(&build_ptr->task_plugin_param, buffer);
 	safe_unpackstr_xmalloc(&build_ptr->tmp_fs, &uint32_tmp, buffer);
-	safe_unpackstr_xmalloc(&build_ptr->topology_plugin, &uint32_tmp, buffer);
+	safe_unpackstr_xmalloc(&build_ptr->topology_plugin, &uint32_tmp, 
+			       buffer);
 	safe_unpack16(&build_ptr->track_wckey, buffer);
 	safe_unpack16(&build_ptr->tree_width, buffer);
 
@@ -3312,6 +3314,7 @@ _unpack_slurm_ctl_conf_msg(slurm_ctl_conf_info_msg_t **
 	safe_unpackstr_xmalloc(&build_ptr->unkillable_program,
 			       &uint32_tmp, buffer);
 	safe_unpack16(&build_ptr->unkillable_timeout, buffer);
+	safe_unpackstr_xmalloc(&build_ptr->version, &uint32_tmp, buffer);
 
 	safe_unpack16(&build_ptr->wait_time, buffer);
 
diff --git a/src/slurmctld/proc_req.c b/src/slurmctld/proc_req.c
index cd62a0ad323..1a173ea8a19 100644
--- a/src/slurmctld/proc_req.c
+++ b/src/slurmctld/proc_req.c
@@ -571,6 +571,7 @@ void _fill_ctld_conf(slurm_ctl_conf_t * conf_ptr)
 	conf_ptr->use_pam             = conf->use_pam;
 	conf_ptr->unkillable_program  = xstrdup(conf->unkillable_program);
 	conf_ptr->unkillable_timeout  = conf->unkillable_timeout;
+	conf_ptr->version             = xstrdup(SLURM_VERSION);
 
 	slurm_conf_unlock();
 	return;
-- 
GitLab