From 9d302348da487f361947b9cab85876f62c6884dd Mon Sep 17 00:00:00 2001
From: Moe Jette <jette1@llnl.gov>
Date: Tue, 23 Mar 2010 22:22:50 +0000
Subject: [PATCH] Modify job step allocation logic to return
 ESLURM_NODE_NOT_AVAIL rather than ESLURM_REQUESTED_NODE_CONFIG_UNAVAILABLE
 when slurmctld has restarted and nodes have not yet registered (in unknown
 state).

---
 src/slurmctld/step_mgr.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/src/slurmctld/step_mgr.c b/src/slurmctld/step_mgr.c
index db1e77a05ef..534f5ba1e52 100644
--- a/src/slurmctld/step_mgr.c
+++ b/src/slurmctld/step_mgr.c
@@ -848,10 +848,12 @@ _pick_step_nodes (struct job_record  *job_ptr,
 			if (node_tmp == NULL) {
 				if (step_spec->min_nodes <=
 				    (bit_set_count(nodes_avail) +
-				     nodes_picked_cnt +
-				     mem_blocked_nodes)) {
+				     nodes_picked_cnt + mem_blocked_nodes)) {
 					*return_code =
 						ESLURM_INVALID_TASK_MEMORY;
+				} else if (!bit_super_set(job_ptr->node_bitmap, 
+							  up_node_bitmap)) {
+					*return_code = ESLURM_NODE_NOT_AVAIL;
 				}
 				goto cleanup;
 			}
@@ -895,9 +897,13 @@ _pick_step_nodes (struct job_record  *job_ptr,
 		/* user is requesting more cpus than we got from the
 		 * picked nodes we should return with an error */
 		if (step_spec->cpu_count > cpus_picked_cnt) {
-			if (step_spec->cpu_count <=
-			    (cpus_picked_cnt + mem_blocked_cpus)) {
+			if (step_spec->cpu_count &&
+			    (step_spec->cpu_count <=
+			     (cpus_picked_cnt + mem_blocked_cpus))) {
 				*return_code = ESLURM_INVALID_TASK_MEMORY;
+			} else if (!bit_super_set(job_ptr->node_bitmap, 
+						  up_node_bitmap)) {
+				*return_code = ESLURM_NODE_NOT_AVAIL;
 			}
 			debug2("Have %d nodes with %d cpus which is less "
 			       "than what the user is asking for (%d cpus) "
-- 
GitLab