From bb6c2dd88a514fcb2f174bf7f85f35ea66a9f348 Mon Sep 17 00:00:00 2001 From: bas Date: Tue, 12 Apr 2011 09:14:51 +0000 Subject: [PATCH] added a patch for diagnose -f to allow an argument: * -f [user|group|acct|class|qos] git-svn-id: svn://opensvn.adaptivecomputing.com/maui/trunk@151 3f5042e3-fb1d-0410-be18-d6ca2573e517 --- CHANGELOG | 3 +++ include/moab-proto.h | 3 ++- src/moab/MFS.c | 50 ++++++++++++++++++++++++++++++++++++++++++++ src/server/UserI.c | 3 ++- src/server/mclient.c | 3 ++- 5 files changed, 59 insertions(+), 3 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 3d9654c..69f0202 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,4 +1,7 @@ Maui 3.3.2 + - Patch for 'diagnose -f'. Allow to specify what section of fairshare you want to see, default is + everything (-f [user|group|acct|class|qos]). To show fairshare for a group, use: + * diagnose -f group (Author: Dennis Stam and applied by Bas van der Vlies) Maui 3.3.1 - Fixed issue where hostlist was being overwritten resulting in broken $PBS_NODEFILE. (Alexis Cousein) diff --git a/include/moab-proto.h b/include/moab-proto.h index 283e11a..fe6d6ec 100644 --- a/include/moab-proto.h +++ b/include/moab-proto.h @@ -485,7 +485,8 @@ int MFSInitialize(mfsc_t *); double MFSCalcFactor(mfsc_t *,double *); char *MFSTargetToString(double,int); int MFSShutdown(mfsc_t *); -int MFSShow(char *,int,int); +/* Added the DiagOpt, of type char */ +int MFSShow(char *,int,char *,int); diff --git a/src/moab/MFS.c b/src/moab/MFS.c index 35113ea..dc5ea18 100644 --- a/src/moab/MFS.c +++ b/src/moab/MFS.c @@ -1038,6 +1038,8 @@ int MFSShow( char *Buf, /* O */ int BufSize, /* I */ + /* Added this so we can asked what we want to see */ + char *Opts, int Mode) /* I */ { @@ -1076,6 +1078,34 @@ int MFSShow( BufSize, Mode); + /** DsT Show the given option in the logfile **/ + DBG(3,fFS) DPrint("%s(Opts,%s)\n", + FName, + Opts); + + /** DsT Begin check if given option is supported, else just skip and show all **/ + int LIMITOUTPUT = FALSE; + + if ( strcmp( Opts, "user" ) == 0 ) { + LIMITOUTPUT = TRUE; + } else if( strcmp( Opts, "group" ) == 0 ) { + LIMITOUTPUT = TRUE; + } else if( strcmp( Opts, "acct" ) == 0 ) { + LIMITOUTPUT = TRUE; + } else if( strcmp( Opts, "class" ) == 0 ) { + LIMITOUTPUT = TRUE; + } else if( strcmp( Opts, "qos" ) == 0 ) { + LIMITOUTPUT = TRUE; + } + + /** DsT Always show if we are going to LIMIT the output **/ + DBG(3,fFS) DPrint("%s(LIMIT,%d),(WHAT,%s)\n", + FName, + LIMITOUTPUT, + Opts); + + /** Dst End check options **/ + if (Buf == NULL) { return(FAILURE); @@ -1184,6 +1214,10 @@ int MFSShow( { case mxoUser: + /** DsT if limit is true but Opts does not compare to users, skip **/ + if (LIMITOUTPUT == TRUE && strcmp( Opts, "user" ) != 0 ) + continue; + if (MSched.DefaultU != NULL) DF = &MSched.DefaultU->F; @@ -1191,6 +1225,10 @@ int MFSShow( case mxoGroup: + /** DsT if limit is true but Opts does not compare to group, skip **/ + if (LIMITOUTPUT == TRUE && strcmp( Opts, "group" ) != 0 ) + continue; + if (MSched.DefaultG != NULL) DF = &MSched.DefaultG->F; @@ -1198,6 +1236,10 @@ int MFSShow( case mxoAcct: + /** DsT if limit is true but Opts does not compare to acct, skip **/ + if (LIMITOUTPUT == TRUE && strcmp( Opts, "acct" ) != 0 ) + continue; + if (MSched.DefaultA != NULL) DF = &MSched.DefaultA->F; @@ -1205,6 +1247,10 @@ int MFSShow( case mxoClass: + /** DsT if limit is true but Opts does not compare to class, skip **/ + if (LIMITOUTPUT == TRUE && strcmp( Opts, "class" ) != 0 ) + continue; + if (MSched.DefaultC != NULL) DF = &MSched.DefaultC->F; @@ -1212,6 +1258,10 @@ int MFSShow( case mxoQOS: + /** DsT if limit is true but Opts does not compare to qos, skip **/ + if (LIMITOUTPUT == TRUE && strcmp( Opts, "qos" ) != 0 ) + continue; + if (MSched.DefaultQ != NULL) DF = &MSched.DefaultQ->F; diff --git a/src/server/UserI.c b/src/server/UserI.c index 75a229a..50e6c57 100644 --- a/src/server/UserI.c +++ b/src/server/UserI.c @@ -6157,7 +6157,8 @@ int UIDiagnose( { int BufSize = MAX_MBUFFER; - MFSShow(SBuffer,BufSize,IFlags); + /* DsT Added DiagOpt, so we can limit the output */ + MFSShow(SBuffer,BufSize,DiagOpt,IFlags); *SBufSize = strlen(SBuffer); } /* END BLOCK */ diff --git a/src/server/mclient.c b/src/server/mclient.c index 8f11395..82bf234 100644 --- a/src/server/mclient.c +++ b/src/server/mclient.c @@ -4236,7 +4236,8 @@ int MCShowUsage( fprintf(stderr," -a [ACCOUNTID]\n"); fprintf(stderr," -c [CLASSID]\n"); - fprintf(stderr," -f // fairshare\n"); + /** DsT added the possible options for f **/ + fprintf(stderr," -f [user|group|acct|class|qos] // fairshare\n"); fprintf(stderr," -g [GROUPID]\n"); fprintf(stderr," -j [JOBID]\n"); fprintf(stderr," -m // frame\n");