From 8e156981cb68f33ed65b9b50a92480f7d0948110 Mon Sep 17 00:00:00 2001 From: dev Date: Fri, 15 Jul 2005 01:47:31 +0000 Subject: [PATCH] force reservations with feature list to be locked down to initially allocated node list git-svn-id: svn://opensvn.adaptivecomputing.com/maui/trunk@11 3f5042e3-fb1d-0410-be18-d6ca2573e517 --- src/moab/MRes.c | 2 +- src/server/UserI.c | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/src/moab/MRes.c b/src/moab/MRes.c index bd1cd96..108eb23 100644 --- a/src/moab/MRes.c +++ b/src/moab/MRes.c @@ -1237,7 +1237,7 @@ int MResToXML( int *AList; - char tmpString[MAX_MLINE]; + char tmpString[MAX_MBUFFER]; if ((R == NULL) || (E == NULL)) { diff --git a/src/server/UserI.c b/src/server/UserI.c index 643cfc3..5010d03 100644 --- a/src/server/UserI.c +++ b/src/server/UserI.c @@ -6295,6 +6295,8 @@ int UIResCreate( int index; char Pattern[MAX_MBUFFER]; + char *PatPtr; + int PatSize; char *ptr; char *TokPtr; @@ -6657,6 +6659,38 @@ int UIResCreate( NodeCount = NIndex; } + /* When the feature list is set, and a HOST_REGEX or "ALL" + * is used, we replace the Pattern with the resulting nodelist. + * This ensures the reservation is checkpointed properly */ + + if ((strcmp(FeatureList,NONE) != 0) && (strstr(Pattern,"TASKS") == NULL)) + { + PatPtr = Pattern; + PatSize = sizeof(Pattern); + PatPtr[0] = '\0'; + + for (nindex = 0;nindex < NodeCount;nindex++) + { + if (PatSize < 100) + { + DBG(0,fSCHED) DPrint("ERROR: regex buffer overflow creating reservation '%s'\n", ResID); + + return(FAILURE); + } + + if (nindex != 0) + { + MUSNPrintF(&PatPtr,&PatSize,"|%s", + NodeList[nindex].N->Name); + } + else + { + MUSNPrintF(&PatPtr,&PatSize,"%s", + NodeList[nindex].N->Name); + } + } + } + /* translate dedicated proc request to per node proc request */ SPC = tmpRQ.DRes.Procs;