From 9586336bd3fd0ce815268ab8fc0620ea37a7cd92 Mon Sep 17 00:00:00 2001
From: Moe Jette <jette1@llnl.gov>
Date: Mon, 8 Oct 2007 18:39:48 +0000
Subject: [PATCH] Add select_g_reconfigure() function to node changes in
 slurmctld configuration     that can impact node scheduling.

---
 NEWS                                              |  2 ++
 doc/html/selectplugins.shtml                      | 11 +++++++++--
 src/common/node_select.c                          | 15 ++++++++++++++-
 src/common/node_select.h                          |  3 +++
 .../select/bluegene/plugin/select_bluegene.c      |  6 ++++++
 src/plugins/select/cons_res/select_cons_res.c     |  5 +++++
 src/plugins/select/linear/select_linear.c         |  6 ++++++
 src/slurmctld/controller.c                        |  3 ++-
 src/slurmctld/partition_mgr.c                     |  3 ++-
 src/slurmctld/proc_req.c                          |  5 +++--
 10 files changed, 52 insertions(+), 7 deletions(-)

diff --git a/NEWS b/NEWS
index 7a83c84e0cf..777f2045c0d 100644
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,8 @@ documents those changes that are of interest to users and admins.
 
 * Changes in SLURM 1.3.0-pre5
 =============================
+ -- Add select_g_reconfigure() function to node changes in slurmctld configuration
+    that can impact node scheduling.
 
 * Changes in SLURM 1.3.0-pre4
 =============================
diff --git a/doc/html/selectplugins.shtml b/doc/html/selectplugins.shtml
index 2cd4ba6b2d2..d295e64af7d 100644
--- a/doc/html/selectplugins.shtml
+++ b/doc/html/selectplugins.shtml
@@ -339,7 +339,7 @@ state of the node.</p>
 <p class="commandline">int select_p_alter_node_cnt (enum
 select_node_cnt type, void *data);</p>
 <p style="margin-left:.2in"><b>Description</b>: Used for systems like
-a Bluegene system where slurm sees 1 node where many nodes really
+a Bluegene system where SLURM sees 1 node where many nodes really
 exists, in Bluegene's case 1 node reflects 512 nodes in real live, but
 since usually 512 is the smallest allocatable block slurm only handles
 it as 1 node.  This is a function so the user can issue a 'real'
@@ -352,6 +352,13 @@ telling the plug in what the user is really wanting.<br>
 Is a void * so depending on the type sent in argument 1 this should 
 adjust the variable returning what the user is asking for.</p>
 <p style="margin-left:.2in"><b>Returns</b>: SLURM_SUCCESS if successful, otherwise SLURM_ERROR</p>
+
+<p class="commandline">int select_p_reconfigure (void);</p>
+<p style="margin-left:.2in"><b>Description</b>: Used to notify plugin 
+of change in partition configuration or general configuration change.
+The plugin will test global variables for changes as appropriate.</p>
+<p style="margin-left:.2in"><b>Returns</b>: SLURM_SUCCESS if successful, otherwise SLURM_ERROR</p>
+
 <p class="footer"><a href="#top">top</a></p>
 
 <h2>Versioning</h2>
@@ -364,6 +371,6 @@ to maintain data format compatibility across different versions of the plugin.</
 
 <p class="footer"><a href="#top">top</a></p>
 
-<p style="text-align:center;">Last modified 12 October 2006</p>
+<p style="text-align:center;">Last modified 8 October 2007</p>
 
 <!--#include virtual="footer.txt"-->
diff --git a/src/common/node_select.c b/src/common/node_select.c
index 185b3133a13..3fd10e6c589 100644
--- a/src/common/node_select.c
+++ b/src/common/node_select.c
@@ -106,6 +106,7 @@ typedef struct slurm_select_ops {
 	int             (*update_node_state)   (int index, uint16_t state);
 	int             (*alter_node_cnt)      (enum select_node_cnt type,
 						void *data);
+	int		(*reconfigure)         (void);
 } slurm_select_ops_t;
 
 typedef struct slurm_select_context {
@@ -180,7 +181,8 @@ static slurm_select_ops_t * _select_get_ops(slurm_select_context_t *c)
  		"select_p_update_sub_node",
                 "select_p_get_info_from_plugin",
 		"select_p_update_node_state",
-		"select_p_alter_node_cnt"
+		"select_p_alter_node_cnt",
+		"select_p_reconfigure"
 	};
 	int n_syms = sizeof( syms ) / sizeof( char * );
 
@@ -499,6 +501,17 @@ extern int select_g_alter_node_cnt (enum select_node_cnt type, void *data)
 	return (*(g_select_context->ops.alter_node_cnt))(type, data);
 }
 
+/*
+ * Note reconfiguration or change in partition configuration
+ */
+extern int select_g_reconfigure (void)
+{
+	if (slurm_select_init() < 0)
+		return SLURM_ERROR;
+
+	return (*(g_select_context->ops.reconfigure))();
+}
+
 /*
  * Select the "best" nodes for given job from those available
  * IN job_ptr - pointer to job being considered for initiation
diff --git a/src/common/node_select.h b/src/common/node_select.h
index fb13dea0662..22843667be6 100644
--- a/src/common/node_select.h
+++ b/src/common/node_select.h
@@ -294,4 +294,7 @@ extern int select_g_unpack_node_info(node_select_info_msg_t **
 extern int select_g_free_node_info(node_select_info_msg_t **
 				   node_select_info_msg_pptr);
 
+/* Note reconfiguration or change in partition configuration */
+extern int select_g_reconfigure(void);
+
 #endif /*__SELECT_PLUGIN_API_H__*/
diff --git a/src/plugins/select/bluegene/plugin/select_bluegene.c b/src/plugins/select/bluegene/plugin/select_bluegene.c
index 711dbbb3b28..dc5e992a086 100644
--- a/src/plugins/select/bluegene/plugin/select_bluegene.c
+++ b/src/plugins/select/bluegene/plugin/select_bluegene.c
@@ -1230,3 +1230,9 @@ extern int select_p_alter_node_cnt(enum select_node_cnt type, void *data)
 	
 	return SLURM_SUCCESS;
 }
+
+extern int select_p_reconfigure(void)
+{
+	return SLURM_SUCCESS;
+}
+
diff --git a/src/plugins/select/cons_res/select_cons_res.c b/src/plugins/select/cons_res/select_cons_res.c
index 13dbfb720bf..0404b98343b 100644
--- a/src/plugins/select/cons_res/select_cons_res.c
+++ b/src/plugins/select/cons_res/select_cons_res.c
@@ -2496,3 +2496,8 @@ extern int select_p_alter_node_cnt(enum select_node_cnt type, void *data)
 {
 	return SLURM_SUCCESS;
 }
+
+extern int select_p_reconfigure(void)
+{
+	return SLURM_SUCCESS;
+}
diff --git a/src/plugins/select/linear/select_linear.c b/src/plugins/select/linear/select_linear.c
index ba91918cb38..803cb9e73d7 100644
--- a/src/plugins/select/linear/select_linear.c
+++ b/src/plugins/select/linear/select_linear.c
@@ -760,3 +760,9 @@ extern int select_p_alter_node_cnt(enum select_node_cnt type, void *data)
 {
 	return SLURM_SUCCESS;
 }
+
+extern int select_p_reconfigure(void)
+{
+	return SLURM_SUCCESS;
+}
+
diff --git a/src/slurmctld/controller.c b/src/slurmctld/controller.c
index a49358171df..1247b9e531f 100644
--- a/src/slurmctld/controller.c
+++ b/src/slurmctld/controller.c
@@ -549,7 +549,8 @@ static void *_slurmctld_signal_hand(void *no_data)
 			}
 			unlock_slurmctld(config_write_lock);
 			trigger_reconfig();
-			slurm_sched_partition_change();
+			slurm_sched_partition_change();	/* notify sched plugin */
+			select_g_reconfigure();		/* notify select plugin too */
 			break;
 		case SIGABRT:	/* abort */
 			info("SIGABRT received");
diff --git a/src/slurmctld/partition_mgr.c b/src/slurmctld/partition_mgr.c
index 8b4177163c6..a51263c76b8 100644
--- a/src/slurmctld/partition_mgr.c
+++ b/src/slurmctld/partition_mgr.c
@@ -892,7 +892,8 @@ int update_part(update_part_msg_t * part_desc)
 
 	if (error_code == SLURM_SUCCESS) {
 		slurm_sched_partition_change();	/* notify sched plugin */
-		reset_job_priority();	/* free jobs */
+		select_g_reconfigure();		/* notify select plugin too */
+		reset_job_priority();		/* free jobs */
 		if (select_g_block_init(part_list) != SLURM_SUCCESS )
 			error("failed to update node selection plugin state");
 	}
diff --git a/src/slurmctld/proc_req.c b/src/slurmctld/proc_req.c
index 04faeeb529b..7934d99775d 100644
--- a/src/slurmctld/proc_req.c
+++ b/src/slurmctld/proc_req.c
@@ -1488,8 +1488,9 @@ static void _slurm_rpc_reconfigure_controller(slurm_msg_t * msg)
 		info("_slurm_rpc_reconfigure_controller: completed %s", 
 			TIME_STR);
 		slurm_send_rc_msg(msg, SLURM_SUCCESS);
-		slurm_sched_partition_change();
-		schedule();	/* has its own locks */
+		slurm_sched_partition_change();	/* notify sched plugin */
+		select_g_reconfigure();		/* notify select plugin too */
+		schedule();			/* has its own locks */
 		save_all_state();
 	}
 }
-- 
GitLab