From b64162c2752cbbb8de4ec598e8c2a86e3d304887 Mon Sep 17 00:00:00 2001
From: Morris Jette <jette@schedmd.com>
Date: Thu, 21 May 2015 11:59:07 -0700
Subject: [PATCH] Cosmetic changes to layout work

Changes some variable names "norelation" to "no_relation"
Replace some blocks of spaces with tabs
Add definition of layouts "free" call to slurm.h.in
Add "layout" information to scontrol help message
Fix typo in error message
Translate a french error message to english "valide" to "valid"
---
 NEWS                             |  1 +
 RELEASE_NOTES                    |  4 ++-
 doc/man/man1/scontrol.1          |  4 +--
 slurm/slurm.h.in                 | 10 ++++--
 src/api/Makefile.am              |  2 +-
 src/api/Makefile.in              |  6 ++--
 src/api/layout_info.c            | 18 +++++-----
 src/common/layouts_mgr.c         | 35 +++++++++----------
 src/common/layouts_mgr.h         |  2 +-
 src/common/slurm_protocol_defs.c |  2 +-
 src/common/slurm_protocol_defs.h |  8 ++---
 src/common/slurm_protocol_pack.c | 60 ++++++++++++++++----------------
 src/scontrol/Makefile.am         |  6 ++--
 src/scontrol/Makefile.in         | 16 ++++-----
 src/scontrol/info_layout.c       | 18 +++++-----
 src/scontrol/scontrol.c          | 14 ++++----
 src/scontrol/update_layout.c     | 12 +++----
 src/slurmctld/proc_req.c         |  2 +-
 18 files changed, 113 insertions(+), 107 deletions(-)

diff --git a/NEWS b/NEWS
index 64198d10d0c..3fda9d30ade 100644
--- a/NEWS
+++ b/NEWS
@@ -20,6 +20,7 @@ documents those changes that are of interest to users and administrators.
     job resource allocation time.
  -- Disable the OOM Killer in slurmd and slurmstepd's memory cgroup when using
     MemSpecLimit.
+ -- Add scontrol options to view and modify layouts tables.
 
 * Changes in Slurm 15.08.0pre4
 ==============================
diff --git a/RELEASE_NOTES b/RELEASE_NOTES
index 0baf8f5e31e..edcdf4994b8 100644
--- a/RELEASE_NOTES
+++ b/RELEASE_NOTES
@@ -163,6 +163,7 @@ COMMAND CHANGES (see man pages for details)
  -- Introduce new sbatch option '--kill-on-invalid-dep=yes|no' which allows
     users to specify which behavior they want if a job dependency is not
     satisfied.
+ -- Add scontrol options to view and modify layouts tables.
 
 OTHER CHANGES
 =============
@@ -228,7 +229,8 @@ Changed the following enums and #defines
 
 Added the following API's
 =========================
-
+ -- Added APIs to load, print, and update layouts:
+    slurm_print_layout_info, slurm_load_layout, slurm_update_layout.
 
 Changed the following API's
 ============================
diff --git a/doc/man/man1/scontrol.1 b/doc/man/man1/scontrol.1
index 39d74824c28..8adaf331c5e 100644
--- a/doc/man/man1/scontrol.1
+++ b/doc/man/man1/scontrol.1
@@ -1482,8 +1482,8 @@ Identify the entities to be updated. This specification is required.
 .TP
 \fIKey\fP=<value>
 Keys/Values to update for the entities. The format must respect the layout.d
-configuration files. Key=Type cannot be updated. One Key/Value is required,
-several can be set.
+configuration files. Key=Type cannot be updated. At least one Key/Value is
+required, several can be set.
 
 .TP
 \fBSPECIFICATIONS FOR SHOW COMMAND, LAYOUTS\fR
diff --git a/slurm/slurm.h.in b/slurm/slurm.h.in
index 30677c08c19..1e3219973b2 100644
--- a/slurm/slurm.h.in
+++ b/slurm/slurm.h.in
@@ -1853,8 +1853,8 @@ typedef struct job_alloc_info_msg {
 } job_alloc_info_msg_t;
 
 typedef struct layout_info_msg {
-        uint32_t record_count;  /* number of char* */
-	char** records;		/*layout or list of layouts*/
+	uint32_t record_count;	/* number of char* */
+	char** records;		/* layout or list of layouts */
 } layout_info_msg_t;
 
 typedef struct update_layout_msg {
@@ -4001,11 +4001,15 @@ extern int slurm_delete_partition PARAMS((delete_part_msg_t * part_msg));
 \*****************************************************************************/
 extern void slurm_print_layout_info PARAMS(
 	(FILE* out, layout_info_msg_t *layout_info_ptr, int one_liner ));
+
 extern int slurm_load_layout PARAMS(
 	(char *layout_type, char *entities, char *type,
-	 uint32_t norelation, layout_info_msg_t **resp));
+	 uint32_t no_relation, layout_info_msg_t **resp));
+
 extern int slurm_update_layout PARAMS((update_layout_msg_t * layout_info_msg));
 
+extern void slurm_free_layout_info_msg PARAMS(
+	(layout_info_msg_t * layout_info_msg));
 
 /*****************************************************************************\
  *	SLURM RESERVATION CONFIGURATION READ/PRINT/UPDATE FUNCTIONS
diff --git a/src/api/Makefile.am b/src/api/Makefile.am
index 8a477cb88ee..461d8f93977 100644
--- a/src/api/Makefile.am
+++ b/src/api/Makefile.am
@@ -92,9 +92,9 @@ slurmapi_src =           \
 	init_msg.c       \
 	job_info.c       \
 	job_step_info.c  \
+	layout_info.c    \
 	license_info.c   \
 	node_info.c      \
-	layout_info.c     \
 	partition_info.c \
 	pmi_server.c     \
 	pmi_server.h     \
diff --git a/src/api/Makefile.in b/src/api/Makefile.in
index f014148ab9c..a0e3afbb9a5 100644
--- a/src/api/Makefile.in
+++ b/src/api/Makefile.in
@@ -188,8 +188,8 @@ libslurmhelper_la_DEPENDENCIES = $(am__DEPENDENCIES_1)
 am__objects_1 = allocate.lo allocate_msg.lo block_info.lo \
 	burst_buffer_info.lo cache_info.lo cancel.lo checkpoint.lo \
 	complete.lo config_info.lo front_end_info.lo init_msg.lo \
-	job_info.lo job_step_info.lo license_info.lo node_info.lo \
-	layout_info.lo partition_info.lo pmi_server.lo \
+	job_info.lo job_step_info.lo layout_info.lo license_info.lo \
+	node_info.lo partition_info.lo pmi_server.lo \
 	reservation_info.lo signal.lo slurm_get_statistics.lo \
 	slurm_hostlist.lo slurm_pmi.lo step_ctx.lo step_io.lo \
 	step_launch.lo submit.lo suspend.lo topo_info.lo triggers.lo \
@@ -598,9 +598,9 @@ slurmapi_src = \
 	init_msg.c       \
 	job_info.c       \
 	job_step_info.c  \
+	layout_info.c    \
 	license_info.c   \
 	node_info.c      \
-	layout_info.c     \
 	partition_info.c \
 	pmi_server.c     \
 	pmi_server.h     \
diff --git a/src/api/layout_info.c b/src/api/layout_info.c
index 95855e7eed4..070a8086fc6 100644
--- a/src/api/layout_info.c
+++ b/src/api/layout_info.c
@@ -71,12 +71,12 @@
 }*/
 
 extern int slurm_load_layout (char *layout_type, char *entities, char *type,
-			      uint32_t norelation, layout_info_msg_t **resp)
+			      uint32_t no_relation, layout_info_msg_t **resp)
 {
-        int rc;
-        slurm_msg_t req_msg;
-        slurm_msg_t resp_msg;
-        layout_info_request_msg_t req;
+	int rc;
+	slurm_msg_t req_msg;
+	slurm_msg_t resp_msg;
+	layout_info_request_msg_t req;
 
 	slurm_msg_t_init(&req_msg);
 	slurm_msg_t_init(&resp_msg);
@@ -84,9 +84,9 @@ extern int slurm_load_layout (char *layout_type, char *entities, char *type,
 	req.layout_type  = layout_type;
 	req.entities     = entities;
 	req.type         = type;
-	req.norelation   = norelation;
-        req_msg.msg_type = REQUEST_LAYOUT_INFO;
-        req_msg.data     = &req;
+	req.no_relation  = no_relation;
+	req_msg.msg_type = REQUEST_LAYOUT_INFO;
+	req_msg.data     = &req;
 
 	if (slurm_send_recv_controller_msg(&req_msg, &resp_msg) < 0)
 		return SLURM_ERROR;
@@ -118,6 +118,6 @@ void slurm_print_layout_info ( FILE* out, layout_info_msg_t *layout_info_ptr,
 		//FIXME change "\n" if one_liner
 		fprintf ( out, "%s", layout_info_ptr->records[i]);
 	}
-	if ( !one_liner)
+	if (!one_liner)
 		fprintf(out, "\n");
 }
diff --git a/src/common/layouts_mgr.c b/src/common/layouts_mgr.c
index 0b2c24529ed..025d7d1f3da 100644
--- a/src/common/layouts_mgr.c
+++ b/src/common/layouts_mgr.c
@@ -1586,7 +1586,7 @@ typedef struct _pack_args {
 	hostlist_t list_entities;
 	char       *type;
 	uint32_t   all;
-	uint32_t   norelation;
+	uint32_t   no_relation;
 } _pack_args_t;
 
 /*
@@ -1699,7 +1699,7 @@ static uint8_t _pack_layout_tree(xtree_node_t* node, uint8_t which,
 	hostlist_t enclosed;
 	char *enclosed_str = NULL, *e_name = NULL, *e_type = NULL;
 	Buf buffer;
-	char *strdump, *str;
+	char *strdump, *str = NULL;
 
 	/* only need to work for preorder and leaf cases */
 	if (which != XTREE_PREORDER && which != XTREE_LEAF) {
@@ -1735,15 +1735,14 @@ static uint8_t _pack_layout_tree(xtree_node_t* node, uint8_t which,
 	if (!enode || !enode->entity) {
 		e_name = (char*) "NULL";
 		e_type = NULL;
-	}
-	else {
+	} else {
 		e_name = enode->entity->name;
 		e_type = enode->entity->type;
 	}
 
 	/* print this entity as root if necessary */
-	if (level == 0 && pargs->norelation != 1 && pargs->type == NULL) {
-		if( pargs->all != 0 ||
+	if (level == 0 && pargs->no_relation != 1 && pargs->type == NULL) {
+		if (pargs->all != 0 ||
 		    pargs->list_entities == NULL ||
 		    hostlist_find(pargs->list_entities, e_name) != -1) {
 			str = xstrdup_printf("Root=%s\n", e_name);
@@ -1770,8 +1769,8 @@ static uint8_t _pack_layout_tree(xtree_node_t* node, uint8_t which,
 	str = pargs->current_line;
 	pargs->current_line = NULL;
 
-	/*don't print enclosed if norelation option*/
-	if( pargs->norelation == 1
+	/* don't print enclosed if no_relation option */
+	if (pargs->no_relation == 1
 	    && enclosed_str != NULL
 	    && pargs->list_entities == NULL) {
 		xfree(enclosed_str);
@@ -1779,24 +1778,24 @@ static uint8_t _pack_layout_tree(xtree_node_t* node, uint8_t which,
 		return 1;
 	}
 
-	/*don't print non enclosed if no "entities char*" option*/
-	if( pargs->all == 0
+	/* don't print non enclosed if no "entities char*" option */
+	if (pargs->all == 0
 	    && pargs->list_entities == NULL
 	    && enclosed_str == NULL ) {
 		xfree(str);
 		return 1;
 	}
 
-	/*don't print entities if not named in "entities char*"*/
-	if( pargs->all == 0
+	/* don't print entities if not named in "entities char*" */
+	if (pargs->all == 0
 	    && pargs->list_entities != NULL
 	    && hostlist_find(pargs->list_entities, e_name) == -1) {
 		xfree(str);
 		return 1;
 	}
 
-	/*don't print entities if not type of "type char*"*/
-	if( pargs->type != NULL
+	/* don't print entities if not type of "type char*" */
+	if (pargs->type != NULL
 	    && (e_type == NULL || strcasecmp(e_type,pargs->type)!=0)) {
 		xfree(str);
 		return 1;
@@ -1813,8 +1812,8 @@ static uint8_t _pack_layout_tree(xtree_node_t* node, uint8_t which,
 	}
 
 	packstr(str, buffer);
-
 	xfree(str);
+
 	return 1;
 }
 
@@ -2524,7 +2523,7 @@ entity_t* layouts_get_entity(const char* name)
 
 
 int layouts_pack_layout(char *l_type, char *char_entities, char *type,
-			uint32_t norelation, Buf buffer)
+			uint32_t no_relation, Buf buffer)
 {
 	_pack_args_t pargs;
 	layout_t* layout;
@@ -2550,10 +2549,10 @@ int layouts_pack_layout(char *l_type, char *char_entities, char *type,
 			pargs.list_entities = hostlist_create(char_entities);
 	}
 	pargs.type = type;
-	pargs.norelation = norelation;
+	pargs.no_relation = no_relation;
 
 
-	if ( pargs.norelation == 0
+	if ( pargs.no_relation == 0
 	     && pargs.list_entities == NULL
 	     && pargs.type == NULL ) {
 		/* start by packing the layout priority */
diff --git a/src/common/layouts_mgr.h b/src/common/layouts_mgr.h
index d505153cd9f..40db1ee6e8c 100644
--- a/src/common/layouts_mgr.h
+++ b/src/common/layouts_mgr.h
@@ -189,7 +189,7 @@ entity_t* layouts_get_entity(const char* name);
  * Return SLURM_SUCCES or SLURM_ERROR in case of failure
  */
 int layouts_pack_layout(char *l_type, char *entities, char *type,
-			uint32_t norelation, Buf buffer);
+			uint32_t no_relation, Buf buffer);
 
 /*
  * layouts_update_layout - update a particular layout loading the information
diff --git a/src/common/slurm_protocol_defs.c b/src/common/slurm_protocol_defs.c
index 2eca97bc03e..5a04a26fe85 100644
--- a/src/common/slurm_protocol_defs.c
+++ b/src/common/slurm_protocol_defs.c
@@ -861,7 +861,7 @@ extern void slurm_free_layout_info_request_msg(layout_info_request_msg_t * msg)
 extern void slurm_free_layout_info_msg(layout_info_msg_t * msg)
 {
 	int i;
-	for (i=0; i<msg->record_count; i++)
+	for (i = 0; i < msg->record_count; i++)
 		xfree(msg->records[i]);
 	xfree(msg->records);
 	xfree(msg);
diff --git a/src/common/slurm_protocol_defs.h b/src/common/slurm_protocol_defs.h
index 5c8f7bc84b3..7ea40289a8a 100644
--- a/src/common/slurm_protocol_defs.h
+++ b/src/common/slurm_protocol_defs.h
@@ -586,10 +586,10 @@ typedef struct resv_info_request_msg {
 } resv_info_request_msg_t;
 
 typedef struct layout_info_request_msg {
-        char* layout_type;
-        char* entities;
-        char* type;
-        uint32_t norelation;
+	char* layout_type;
+	char* entities;
+	char* type;
+	uint32_t no_relation;
 } layout_info_request_msg_t;
 
 typedef struct complete_job_allocation {
diff --git a/src/common/slurm_protocol_pack.c b/src/common/slurm_protocol_pack.c
index 27c1ee84f46..f8c0166534d 100644
--- a/src/common/slurm_protocol_pack.c
+++ b/src/common/slurm_protocol_pack.c
@@ -2940,13 +2940,13 @@ _pack_update_layout_msg(update_layout_msg_t * msg, Buf buffer,
 {
 	xassert(msg != NULL);
 
-	/*if (protocol_version >= SLURM_15_08_PROTOCOL_VERSION) {*/
+	if (protocol_version >= SLURM_15_08_PROTOCOL_VERSION) {
 		packstr(msg->layout, buffer);
 		packstr(msg->arg, buffer);
-	/*} else {
-		error("_pack_update_node_msg: protocol_version "
-		      "%hu not supported", protocol_version);
-	}*/
+	} else {
+		error("%s: protocol_version %hu not supported",
+		      __func__, protocol_version);
+	}
 }
 
 static int _unpack_update_layout_msg(update_layout_msg_t ** msg, Buf buffer,
@@ -2960,16 +2960,16 @@ static int _unpack_update_layout_msg(update_layout_msg_t ** msg, Buf buffer,
 	tmp_ptr = xmalloc(sizeof(update_layout_msg_t));
 	*msg = tmp_ptr;
 
-	/*if (protocol_version >= SLURM_15_08_PROTOCOL_VERSION) {*/
+	if (protocol_version >= SLURM_15_08_PROTOCOL_VERSION) {
 		safe_unpackstr_xmalloc(&tmp_ptr->layout,
 				       &uint32_tmp, buffer);
 		safe_unpackstr_xmalloc(&tmp_ptr->arg,
 				       &uint32_tmp, buffer);
-	/*} else {
-		error("_unpack_update_layout_msg: protocol_version "
-		      "%hu not supported", protocol_version);
+	} else {
+		error("%s: protocol_version %hu not supported",
+		      __func__, protocol_version);
 		goto unpack_error;
-	}*/
+	}
 	return SLURM_SUCCESS;
 
 unpack_error:
@@ -4976,32 +4976,32 @@ _unpack_layout_info_msg(layout_info_msg_t ** msg, Buf buffer,
 			xmalloc(sizeof(char*) * base_buffer_size);
 		(*msg)->record_count = base_buffer_size;
 
-		i=0;
+		i = 0;
 		while (remaining_buf(buffer) > 0) {
 			safe_unpackstr_xmalloc(&tmp_str, &utmp32, buffer);
 			if (tmp_str != NULL) {
-					if (*tmp_str == '\0') {
-							xfree(tmp_str);
-							break;
-					}
-					if (i == (*msg)->record_count) {
-						(*msg)->record_count
-							+= base_buffer_size;
-						xrealloc(records,
-							 sizeof(char*) *
-							 (*msg)->record_count);
-					}
-					records[i] = tmp_str;
-					++i;
-					//xfree(tmp_str);
-					continue;
+				if (*tmp_str == '\0') {
+						xfree(tmp_str);
+						break;
+				}
+				if (i == (*msg)->record_count) {
+					(*msg)->record_count
+						+= base_buffer_size;
+					records = xrealloc(records,
+						  sizeof(char*) *
+						  (*msg)->record_count);
+				}
+				records[i] = tmp_str;
+				++i;
+				//xfree(tmp_str);
+				continue;
 			}
 		}
 		(*msg)->record_count = i;
 		xrealloc(records, sizeof(char*) * (*msg)->record_count);
 	} else {
-		error("_unpack_reserve_layout_msg: protocol_version "
-		      "%hu not supported", protocol_version);
+		error("%s: protocol_version %hu not supported",
+		      __func__, protocol_version);
 		goto unpack_error;
 	}
 	return SLURM_SUCCESS;
@@ -10858,7 +10858,7 @@ _pack_layout_info_request_msg(layout_info_request_msg_t * msg, Buf buffer,
 	packstr(msg->layout_type, buffer);
 	packstr(msg->entities, buffer);
 	packstr(msg->type, buffer);
-	pack32(msg->norelation, buffer);
+	pack32(msg->no_relation, buffer);
 }
 
 static int
@@ -10874,7 +10874,7 @@ _unpack_layout_info_request_msg(layout_info_request_msg_t ** msg, Buf buffer,
 	safe_unpackstr_xmalloc(&layout_info->layout_type, &uint32_tmp, buffer);
 	safe_unpackstr_xmalloc(&layout_info->entities, &uint32_tmp, buffer);
 	safe_unpackstr_xmalloc(&layout_info->type, &uint32_tmp, buffer);
-	safe_unpack32(&layout_info->norelation, buffer);
+	safe_unpack32(&layout_info->no_relation, buffer);
 	return SLURM_SUCCESS;
 
 unpack_error:
diff --git a/src/scontrol/Makefile.am b/src/scontrol/Makefile.am
index 51f7c42be86..aec33501ef6 100644
--- a/src/scontrol/Makefile.am
+++ b/src/scontrol/Makefile.am
@@ -12,18 +12,18 @@ scontrol_SOURCES =	\
 	info_burst_buffer.c \
 	info_cache.c    \
 	info_job.c	\
+	info_layout.c	\
 	info_lics.c	\
 	info_node.c	\
 	info_part.c	\
 	info_res.c	\
-	info_layout.c	\
 	scontrol.c	\
 	scontrol.h	\
 	update_job.c	\
+	update_layout.c \
 	update_node.c	\
 	update_part.c	\
-	update_step.c   \
-	update_layout.c
+	update_step.c
 
 convenience_libs = $(top_builddir)/src/api/libslurm.o $(DL_LIBS) -lm
 
diff --git a/src/scontrol/Makefile.in b/src/scontrol/Makefile.in
index 61276e4e991..5d9ccfe9b29 100644
--- a/src/scontrol/Makefile.in
+++ b/src/scontrol/Makefile.in
@@ -139,11 +139,11 @@ am__installdirs = "$(DESTDIR)$(bindir)"
 PROGRAMS = $(bin_PROGRAMS)
 am_scontrol_OBJECTS = create_res.$(OBJEXT) info_block.$(OBJEXT) \
 	info_burst_buffer.$(OBJEXT) info_cache.$(OBJEXT) \
-	info_job.$(OBJEXT) info_lics.$(OBJEXT) info_node.$(OBJEXT) \
-	info_part.$(OBJEXT) info_res.$(OBJEXT) info_layout.$(OBJEXT) \
-	scontrol.$(OBJEXT) update_job.$(OBJEXT) update_node.$(OBJEXT) \
-	update_part.$(OBJEXT) update_step.$(OBJEXT) \
-	update_layout.$(OBJEXT)
+	info_job.$(OBJEXT) info_layout.$(OBJEXT) info_lics.$(OBJEXT) \
+	info_node.$(OBJEXT) info_part.$(OBJEXT) info_res.$(OBJEXT) \
+	scontrol.$(OBJEXT) update_job.$(OBJEXT) \
+	update_layout.$(OBJEXT) update_node.$(OBJEXT) \
+	update_part.$(OBJEXT) update_step.$(OBJEXT)
 scontrol_OBJECTS = $(am_scontrol_OBJECTS)
 am__DEPENDENCIES_1 =
 am__DEPENDENCIES_2 = $(top_builddir)/src/api/libslurm.o \
@@ -471,18 +471,18 @@ scontrol_SOURCES = \
 	info_burst_buffer.c \
 	info_cache.c    \
 	info_job.c	\
+	info_layout.c	\
 	info_lics.c	\
 	info_node.c	\
 	info_part.c	\
 	info_res.c	\
-	info_layout.c	\
 	scontrol.c	\
 	scontrol.h	\
 	update_job.c	\
+	update_layout.c \
 	update_node.c	\
 	update_part.c	\
-	update_step.c   \
-	update_layout.c
+	update_step.c
 
 convenience_libs = $(top_builddir)/src/api/libslurm.o $(DL_LIBS) -lm
 scontrol_LDADD = \
diff --git a/src/scontrol/info_layout.c b/src/scontrol/info_layout.c
index 11c8e6355f0..b2ba7e99781 100644
--- a/src/scontrol/info_layout.c
+++ b/src/scontrol/info_layout.c
@@ -44,10 +44,10 @@
 extern void
 scontrol_print_layout (int argc, char *argv[])
 {
-	int i=0, tag_len = 0;
+	int i = 0, tag_len = 0;
 	char *tag = NULL, *val = NULL;
-	char *layout_type=NULL, *entities=NULL, *type=NULL;
-	uint32_t norelation=0;
+	char *layout_type = NULL, *entities = NULL, *type = NULL;
+	uint32_t no_relation = 0;
 	layout_info_msg_t *layout_info_ptr = NULL;
 
 	while (i < argc) {
@@ -64,26 +64,26 @@ scontrol_print_layout (int argc, char *argv[])
 		} else {
 			val = NULL;
 		}
-		if (strncasecmp(tag, "layout", MAX(tag_len, 3)) == 0) {
+		if (strncasecmp(tag, "layouts", MAX(tag_len, 3)) == 0) {
 			layout_type = val;
-		} else if (strncasecmp (tag, "entity", MAX(tag_len, 5)) == 0) {
+		} else if (strncasecmp (tag, "entity", MAX(tag_len, 3)) == 0) {
 			entities = val;
 		} else if (strncasecmp (tag, "type", MAX(tag_len, 3)) == 0) {
 			type = val;
-		} else if (strncasecmp (tag, "nolayout", MAX(tag_len, 4)) == 0) {
-			norelation = 1;
+		} else if (strncasecmp (tag, "nolayout", MAX(tag_len, 4)) == 0){
+			no_relation = 1;
 		} else {
 			exit_code = 1;
 			if (quiet_flag != 1)
 				fprintf (stderr,
-					 "invalid option:%s for layouts \n",
+					 "invalid option for layouts: %s\n",
 					 tag);
 		}
 		i++;
 	}
 	if (slurm_load_layout (layout_type,
 			       entities, type,
-			       norelation, &layout_info_ptr)
+			       no_relation, &layout_info_ptr)
 					== SLURM_PROTOCOL_SUCCESS) {
 		slurm_print_layout_info ( stdout, layout_info_ptr, one_liner );
 	}
diff --git a/src/scontrol/scontrol.c b/src/scontrol/scontrol.c
index 66f506488e6..161dda1d426 100644
--- a/src/scontrol/scontrol.c
+++ b/src/scontrol/scontrol.c
@@ -1466,7 +1466,7 @@ _show_it (int argc, char *argv[])
 {
 	char *tag = NULL, *val = NULL;
 	int tag_len = 0;
-	bool allow_opt=false;
+	bool allow_opt = false;
 
 	if (argc < 2) {
 		exit_code = 1;
@@ -1477,7 +1477,7 @@ _show_it (int argc, char *argv[])
 	}
 
 	if (strncasecmp (argv[1], "layouts", MAX(tag_len, 2)) != 0)
-		allow_opt=true;
+		allow_opt = true;
 
 	if (argc > 3 && allow_opt) {
 		exit_code = 1;
@@ -1546,10 +1546,10 @@ _show_it (int argc, char *argv[])
 	} else if (strncasecmp (tag, "jobs", MAX(tag_len, 1)) == 0 ||
 		   strncasecmp (tag, "jobid", MAX(tag_len, 1)) == 0 ) {
 		scontrol_print_job (val);
+	} else if (strncasecmp (tag, "layouts", MAX(tag_len, 2)) == 0) {
+		scontrol_print_layout(argc-1, argv + 1);
 	} else if (strncasecmp(tag, "licenses", MAX(tag_len, 2)) == 0) {
 		scontrol_print_licenses(val);
-	} else if (strncasecmp (tag, "layouts", MAX(tag_len, 2)) == 0) {
-		scontrol_print_layout(argc-1, &argv[1]);
 	} else if (strncasecmp (tag, "nodes", MAX(tag_len, 1)) == 0) {
 		scontrol_print_node_list (val);
 	} else if (strncasecmp (tag, "partitions", MAX(tag_len, 1)) == 0 ||
@@ -1591,7 +1591,7 @@ _update_it (int argc, char *argv[])
 	int node_tag = 0, part_tag = 0, job_tag = 0;
 	int block_tag = 0, sub_tag = 0, res_tag = 0;
 	int debug_tag = 0, step_tag = 0, front_end_tag = 0;
-	int layout_tag=0;
+	int layout_tag = 0;
 	int jerror_code = SLURM_SUCCESS;
 
 	/* First identify the entity to update */
@@ -1966,8 +1966,8 @@ scontrol [<OPTION>] [<COMMAND>]                                            \n\
 									   \n\
   <ENTITY> may be \"aliases\", \"burstBuffer\", \"config\", \"daemons\",   \n\
        \"frontend\", \"hostlist\", \"hostlistsorted\", \"hostnames\",      \n\
-       \"job\", \"node\", \"partition\", \"reservation\", \"slurmd\",      \n\
-        \"step\", or \"topology\"                                          \n\
+       \"job\", \"layouts\", \"node\", \"partition\", \"reservation\",     \n\
+       \"slurmd\", \"step\", or \"topology\"                               \n\
        (also for BlueGene only: \"block\" or \"submp\").                   \n\
 									   \n\
   <ID> may be a configuration parameter name, job id, node name, partition \n\
diff --git a/src/scontrol/update_layout.c b/src/scontrol/update_layout.c
index acc4b55b2b3..b5feff1cc15 100644
--- a/src/scontrol/update_layout.c
+++ b/src/scontrol/update_layout.c
@@ -47,10 +47,10 @@ extern int
 scontrol_update_layout (int argc, char *argv[])
 {
 	int rc;
-	int i=0, tag_len = 0;
+	int i = 0, tag_len = 0;
 	char *tag = NULL, *val = NULL;
 	update_layout_msg_t msg;
-	char *opt=NULL;
+	char *opt = NULL;
 
 	opt = xstrdup_printf(" ");
 
@@ -69,7 +69,7 @@ scontrol_update_layout (int argc, char *argv[])
 				 tag);
 			goto done;
 		}
-		if (strncasecmp(tag, "Layouts", MAX(tag_len, 2)) == 0) {
+		if (strncasecmp(tag, "layouts", MAX(tag_len, 2)) == 0) {
 			msg.layout = val;
 		} else if (strncasecmp(tag, "entity", MAX(tag_len, 2)) == 0) {
 			msg.arg = xstrdup_printf("Entity=%s", val);
@@ -83,19 +83,19 @@ scontrol_update_layout (int argc, char *argv[])
 	if (msg.layout == NULL) {
 		exit_code = 1;
 		fprintf (stderr,
-			 "No valide layout name in update command\n");
+			 "No valid layout name in update command\n");
 		goto done;
 	}
 	if (msg.arg == NULL) {
 		exit_code = 1;
 		fprintf (stderr,
-			 "No valide layout enity in update command\n");
+			 "No valid layout enity in update command\n");
 		goto done;
 	}
 	if ( strlen(opt) <= 1 ) {
 		exit_code = 1;
 		fprintf (stderr,
-			 "No valide upates arguments in update command\n");
+			 "No valid updates arguments in update command\n");
 		goto done;
 	}
 
diff --git a/src/slurmctld/proc_req.c b/src/slurmctld/proc_req.c
index 6ab346b8b51..5e888d40123 100644
--- a/src/slurmctld/proc_req.c
+++ b/src/slurmctld/proc_req.c
@@ -3956,7 +3956,7 @@ static void _slurm_rpc_layout_show(slurm_msg_t * msg)
 		if ( layouts_pack_layout(layout_req_msg->layout_type,
 					 layout_req_msg->entities,
 					 layout_req_msg->type,
-					 layout_req_msg->norelation,
+					 layout_req_msg->no_relation,
 					 buffer) != SLURM_SUCCESS) {
 			debug2("_slurm_rpc_layout_show, unable to get layout[%s]",
 			       layout_req_msg->layout_type);
-- 
GitLab