コード例 #1
0
int get_alps_statuses(

  struct pbsnode       *parent,
  struct batch_request *preq,
  int                  *bad,
  tlist_head           *pstathd)

  {
  struct pbsnode *alps_node;
  all_nodes_iterator  *iter = NULL;
  int             rc = PBSE_NONE;

  while ((alps_node = next_host(parent->alps_subnodes, &iter, NULL)) != NULL)
    {
    rc = status_node(alps_node, preq, bad, pstathd);
    unlock_node(alps_node, __func__, NULL, LOGLEVEL);

    if (rc != PBSE_NONE)
      break;
    }

  if (iter != NULL)
    delete iter;

  return(rc);
  } /* END get_alps_statuses() */
コード例 #2
0
ファイル: req_stat.c プロジェクト: craigprescott/torque
/* instead of getting the status on a node with numa nodes, report
 * the status of all the numa nodes
 *
 * @param pnode - the node to report on
 * @param preq - the batch request
 * @param pstathd - the list to add this response to
 *
 * @return - 0 on SUCCESS, error code otherwise
 */
int get_numa_statuses(

  struct pbsnode       *pnode,    /* ptr to node receiving status query */
  struct batch_request *preq,
  int                  *bad,      /* O */
  tlist_head           *pstathd)  /* head of list to append status to  */

  {
  int i;
  int rc = 0;

  struct pbsnode *pn;

  if (pnode->num_node_boards == 0)
    {
    /* no numa nodes, just return the status for this node */
    rc = status_node(pnode, preq, bad, pstathd);

    return(rc);
    }

  for (i = 0; i < pnode->num_node_boards; i++)
    {
    pn = AVL_find(i,pnode->nd_mom_port,pnode->node_boards);

    if (pn == NULL)
      continue;

    lock_node(pn, __func__, NULL, LOGLEVEL);
    rc = status_node(pn, preq, bad, pstathd);
    unlock_node(pn, __func__, NULL, LOGLEVEL);

    if (rc != PBSE_NONE)
      {
      return(rc);
      }
    }

  return(rc);
  } /* END get_numa_statuses() */
コード例 #3
0
int get_alps_statuses(

  struct pbsnode       *parent,
  struct batch_request *preq,
  int                  *bad,
  tlist_head           *pstathd)

  {
  struct pbsnode *alps_node;
  int             iter = -1;
  int             rc = PBSE_NONE;

  while ((alps_node = next_host(&(parent->alps_subnodes), &iter, NULL)) != NULL)
    {
    rc = status_node(alps_node, preq, bad, pstathd);
    unlock_node(alps_node, __func__, NULL, 0);

    if (rc != PBSE_NONE)
      break;
    }

  return(rc);
  } /* END get_alps_statuses() */
コード例 #4
0
ファイル: req_stat.c プロジェクト: altair4/pbspro
void
req_stat_node(struct batch_request *preq)
{
	char		    *name;
	struct batch_reply  *preply;
	svrattrl	    *pal;
	struct pbsnode	    *pnode = NULL;
	int		    rc   = 0;
	int		    type = 0;
	int		    i;

	/*
	 * first, check that the server indeed has a list of nodes
	 * and if it does, validate the name of the requested object--
	 * either name is that of a spedific node, or name[0] is null/@
	 * meaning request is for all nodes in the server's jurisdiction
	 */

	if (pbsndlist == 0  ||  svr_totnodes <= 0) {
		req_reject(PBSE_NONODES, 0, preq);
		return;
	}

	resc_access_perm = preq->rq_perm;

	name = preq->rq_ind.rq_status.rq_id;

	if ((*name == '\0') || (*name =='@'))
		type = 1;
	else {
		pnode = find_nodebyname(name);
		if (pnode == NULL) {
			req_reject(PBSE_UNKNODE, 0, preq);
			return;
		}
	}

	preply = &preq->rq_reply;
	preply->brp_choice = BATCH_REPLY_CHOICE_Status;
	CLEAR_HEAD(preply->brp_un.brp_status);

	if (type == 0) {		/* get status of the named node */
		rc = status_node(pnode, preq, &preply->brp_un.brp_status);

	} else {			/* get status of all nodes */

		for (i = 0; i < svr_totnodes; i++) {
			pnode = pbsndlist[i];

			rc = status_node(pnode, preq,
				&preply->brp_un.brp_status);
			if (rc)
				break;
		}
	}

	if (!rc) {
		(void)reply_send(preq);
	} else {
		if (rc != PBSE_UNKNODEATR)
			req_reject(rc, 0, preq);

		else {
			pal = (svrattrl *)GET_NEXT(preq->rq_ind.
				rq_status.rq_attr);
			reply_badattr(rc, bad, pal, preq);
		}
	}
}
コード例 #5
0
ファイル: req_stat.c プロジェクト: risyomei-poppin-games/PBS
void req_stat_node(

  struct batch_request *preq) /* ptr to the decoded request   */

  {
  char    *name;

  struct pbsnode *pnode = NULL;

  struct batch_reply *preply;
  svrattrl *pal;
  int     rc   = 0;
  int     type = 0;
  int     i;

  struct prop props;


  char     *id = "req_stat_node";

  /*
   * first, check that the server indeed has a list of nodes
   * and if it does, validate the name of the requested object--
   * either name is that of a specific node, or name[0] is null/@
   * meaning request is for all nodes in the server's jurisdiction
   */

  if (LOGLEVEL >= 6)
    {
    log_record(
      PBSEVENT_SCHED,
      PBS_EVENTCLASS_REQUEST,
      id,
      "entered");
    }

  if ((pbsndmast == NULL) || (svr_totnodes <= 0))
    {
    req_reject(PBSE_NONODES, 0, preq, NULL, "node list is empty - check 'server_priv/nodes' file");

    return;
    }

  name = preq->rq_ind.rq_status.rq_id;

  if ((*name == '\0') || (*name == '@'))
    {
    type = 1;
    }
  else if ((*name == ':') && (*(name + 1) != '\0'))
    {
    if (!strcmp(name + 1, "ALL"))
      {
      type = 1;  /* psuedo-group for all nodes */
      }
    else
      {
      type = 2;
      props.name = name + 1;
      props.mark = 1;
      props.next = NULL;
      }
    }
  else
    {
    pnode = find_nodebyname(name);

    if (pnode == NULL)
      {
      req_reject(PBSE_UNKNODE, 0, preq, NULL, "cannot locate specified node");

      return;
      }
    }

  preply = &preq->rq_reply;

  preply->brp_choice = BATCH_REPLY_CHOICE_Status;

  CLEAR_HEAD(preply->brp_un.brp_status);

  if (type == 0)
    {
    /* get status of the named node */

    rc = status_node(pnode, preq, &preply->brp_un.brp_status);
    }
  else
    {
    /* get status of all or several nodes */

    for (i = 0;i < svr_totnodes;i++)
      {
      pnode = pbsndmast[i];

      if ((type == 2) && !hasprop(pnode, &props))
        continue;

      if ((rc = status_node(pnode, preq, &preply->brp_un.brp_status)) != 0)
        break;
      }
    }

  if (!rc)
    {
    /* SUCCESS */

    reply_send(preq);
    }
  else
    {
    if (rc != PBSE_UNKNODEATR)
      {
      req_reject(rc, 0, preq, NULL, NULL);
      }
    else
      {
      pal = (svrattrl *)GET_NEXT(preq->rq_ind.rq_status.rq_attr);

      reply_badattr(rc, bad, pal, preq);
      }
    }

  return;
  }  /* END req_stat_node() */