static int find_nodemasks(Queue *queue, Resources *rsrcs) { Job *job; Bitfield jobs_using; BITFIELD_CLRALL(&jobs_using); /* * Compute the set of nodes that are both physically available and also * assigned to this queue. */ BITFIELD_CPY(&queue->availmask, &(queue->queuemask)); BITFIELD_ANDM(&queue->availmask, &(queue->rsrcs->availmask)); /* * Compute the set of nodes in use by jobs running on the queue (if * there are any) and remove those nodes from the available node mask. */ if (queue->running) { for (job = queue->jobs; job != NULL; job = job->next) { if (job->state == 'R') BITFIELD_SETM(&jobs_using, &(job->nodemask)); } } /* * Remove the used node bits from the queue's availmask, and add them to * the resources' nodes used bits. */ BITFIELD_CLRM(&queue->availmask, &jobs_using); BITFIELD_SETM(&rsrcs->nodes_used, &jobs_using); return (0); }
static int nodemask_overlaps(void) { char *id = "nodemask_overlaps"; QueueList *qlp1, *qlp2; Bitfield overlap; /* Check for overlapping queue nodemasks in batch queues. */ for (qlp1 = schd_BatchQueues; qlp1 != NULL; qlp1 = qlp1->next) { if (!(qlp1->queue->flags & QFLAGS_NODEMASK)) continue; for (qlp2 = qlp1->next; qlp2 != NULL; qlp2 = qlp2->next) { /* * If the queues are on different hosts, they may appear to * overlap - no problem. */ if (strcmp(qlp1->queue->exechost, qlp2->queue->exechost)) continue; if ((qlp2->queue->flags & QFLAGS_NODEMASK)) { DBPRT(("comparing nodemask for queue %s with queue %s\n", qlp1->queue->qname, qlp2->queue->qname)); BITFIELD_CPY(&overlap, &(qlp1->queue->queuemask)); BITFIELD_ANDM(&overlap, &(qlp2->queue->queuemask)); if (!BITFIELD_IS_ZERO(&overlap)) { (void)sprintf(log_buffer, "Queues %s and %s have overlapping nodemasks!", qlp1->queue->qname, qlp2->queue->qname); log_record(PBSEVENT_SYSTEM, PBS_EVENTCLASS_SERVER, id, log_buffer); DBPRT(("%s: %s\n", id, log_buffer)); return (1); } } } } /* Make sure batch queues and external queues have differing nodemasks. */ for (qlp1 = schd_BatchQueues; qlp1 != NULL; qlp1 = qlp1->next) { if (!(qlp1->queue->flags & QFLAGS_NODEMASK)) continue; for (qlp2 = schd_ExternQueues; qlp2 != NULL; qlp2 = qlp2->next) { /* * If the queues are on different hosts, they may appear to * overlap - no problem. */ if (strcmp(qlp1->queue->exechost, qlp2->queue->exechost)) continue; if ((qlp2->queue->flags & QFLAGS_NODEMASK)) { DBPRT(("comparing nodemask for queue %s with queue %s\n", qlp1->queue->qname, qlp2->queue->qname)); BITFIELD_CPY(&overlap, &(qlp1->queue->queuemask)); BITFIELD_ANDM(&overlap, &(qlp2->queue->queuemask)); if (!BITFIELD_IS_ZERO(&overlap)) { (void)sprintf(log_buffer, "Queues %s and %s have overlapping nodemasks!", qlp1->queue->qname, qlp2->queue->qname); log_record(PBSEVENT_SYSTEM, PBS_EVENTCLASS_SERVER, id, log_buffer); DBPRT(("%s: %s\n", id, log_buffer)); return (1); } } } } return (0); }