From 91ea68adc4893afa5211f1ab642bd9d73cadd3e2 Mon Sep 17 00:00:00 2001
From: Brian Christiansen <brian@schedmd.com>
Date: Thu, 8 Sep 2016 15:27:44 -0600
Subject: [PATCH] Display configured and allocated tres on nodes

In scontrol show nodes.
---
 NEWS                |  1 +
 src/api/node_info.c | 11 +++++++++++
 2 files changed, 12 insertions(+)

diff --git a/NEWS b/NEWS
index 08c0ea4426b..0bdc0a0877e 100644
--- a/NEWS
+++ b/NEWS
@@ -30,6 +30,7 @@ documents those changes that are of interest to users and administrators.
  -- Fix for node's available tres array getting filled in with configured gres
     model types.
  -- Log if job --bb option contains any unrecognized content.
+ -- Display configured and allocated tres for nodes in scontrol show nodes.
 
 * Changes in Slurm 17.02.0pre1
 ==============================
diff --git a/src/api/node_info.c b/src/api/node_info.c
index 2db7429c451..ec69988befd 100644
--- a/src/api/node_info.c
+++ b/src/api/node_info.c
@@ -126,6 +126,7 @@ slurm_sprint_node_table (node_info_t * node_ptr,
 	int idle_cpus;
 	uint32_t cluster_flags = slurmdb_setup_cluster_flags();
 	uint32_t alloc_memory;
+	char *node_alloc_tres = NULL;
 	char *line_end = (one_liner) ? " " : "\n   ";
 
 	if (node_scaling)
@@ -315,7 +316,17 @@ slurm_sprint_node_table (node_info_t * node_ptr,
 	} else {
 		xstrcat(out, "SlurmdStartTime=None");
 	}
+	xstrcat(out, line_end);
 
+	/****** TRES Line ******/
+	select_g_select_nodeinfo_get(node_ptr->select_nodeinfo,
+				     SELECT_NODEDATA_TRES_ALLOC_FMT_STR,
+				     NODE_STATE_ALLOCATED, &node_alloc_tres);
+	xstrfmtcat(out, "CfgTRES=%s", node_ptr->tres_fmt_str);
+	xstrcat(out, line_end);
+	xstrfmtcat(out, "AllocTRES=%s",
+		   (node_alloc_tres) ?  node_alloc_tres : "");
+	xfree(node_alloc_tres);
 	xstrcat(out, line_end);
 
 	/****** Power Management Line ******/
-- 
GitLab