Skip to content

Commit

Permalink
support for providing maxCPUs when adding host.
Browse files Browse the repository at this point in the history
  • Loading branch information
tmetsch committed Aug 8, 2017
1 parent 9109226 commit 3455795
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 2 deletions.
1 change: 1 addition & 0 deletions lsf/lib/lib.xdrlim.c
Expand Up @@ -1206,6 +1206,7 @@ xdr_hostEntry(XDR *xdrs,

if (!xdr_int(xdrs, &hPtr->rcv)
|| !xdr_int(xdrs, &hPtr->nDisks)
|| !xdr_int(xdrs, &hPtr->maxCPUs)
|| !xdr_float(xdrs, &hPtr->cpuFactor))
return FALSE;

Expand Down
5 changes: 5 additions & 0 deletions lsf/lim/lim.conf.c
Expand Up @@ -3043,6 +3043,11 @@ addHost_(struct clusterNode *clPtr,
}

hPtr->statInfo.nDisks = hEntPtr->nDisks;
if (hEntPtr->maxCPUs != NULL) {
hPtr->maxCPUs = hEntPtr->maxCPUs;
} else {
hPtr->maxCPUs = -1;
}
hPtr->rexPriority = hEntPtr->rexPriority;

for (i = 0; i < allInfo.numIndx; i++)
Expand Down
1 change: 1 addition & 0 deletions lsf/lim/lim.h
Expand Up @@ -128,6 +128,7 @@ struct hostNode {
struct hostNode *nextPtr;
time_t expireTime;
uint8_t migrant;
int maxCPUs;
};

#define CLUST_ACTIVE 0x00010000
Expand Down
5 changes: 5 additions & 0 deletions lsf/lim/lim.info.c
Expand Up @@ -452,6 +452,11 @@ hostInfoReq(XDR *xdrs,
infoPtr->flags |= HINFO_SHARED_RESOURCE;
}
infoPtr->rexPriority = candidates[i]->rexPriority;

if (candidates[i]->maxCPUs != -1) {
// this is the case lsaddhost was call with -M parameter.
infoPtr->maxCpus = candidates[i]->maxCPUs;
}
}
limReplyCode = LIME_NO_ERR;

Expand Down
2 changes: 2 additions & 0 deletions lsf/lsf.h
Expand Up @@ -379,6 +379,7 @@ struct hostEntry {
char **resList;
int rexPriority;
char *window;
int maxCPUs;
};

struct config_param {
Expand Down Expand Up @@ -570,6 +571,7 @@ struct hostEntryLog {
char **resList;
int rexPriority;
char *window;
int maxCPUs;
};

/* openlava error numbers
Expand Down
8 changes: 6 additions & 2 deletions lsf/lstools/lsaddhost.c
Expand Up @@ -25,7 +25,7 @@ usage(void)
fprintf(stderr, "\
lsaddhost: [-h] [-V] -m model -t type -f cpuFactor \
-D numDisks -R \"resource list\" -w \"windows\" \
-b \"busy onlist \" [-v] hostname\n");
-M maxCPUs -b \"busy onlist \" [-v] hostname\n");
}
static int getResList(struct hostEntry *, const char *);
static int getBusyThr(struct hostEntry *, const char *);
Expand Down Expand Up @@ -55,7 +55,7 @@ main(int argc, char **argv)
for (cc = 0; cc < 11; cc++)
hPtr->busyThreshold[cc] = INFINIT_LOAD;

while ((cc = getopt(argc, argv, "Vhvm:t:f:D:R:w:b:")) != EOF) {
while ((cc = getopt(argc, argv, "Vhvm:t:f:D:R:w:b:M:")) != EOF) {
switch (cc) {
case 'V':
fputs(_LS_VERSION_, stderr);
Expand Down Expand Up @@ -85,6 +85,9 @@ main(int argc, char **argv)
case 'v':
v = 1; /* verbose */
break;
case 'M':
hPtr->maxCPUs = atoi(optarg);
break;
case 'h':
case '?':
default:
Expand Down Expand Up @@ -187,4 +190,5 @@ printInfo(struct hostEntry *hPtr)
printf("busyThresholds:\n");
for (cc = 0; cc < hPtr->numIndx; cc++)
printf(" %4.2f\n", hPtr->busyThreshold[cc]);
printf("maxCPUs: %d\n", hPtr->maxCPUs);
}

0 comments on commit 3455795

Please sign in to comment.