예제 #1
0
END_TEST

START_TEST(save_characteristic_test)
{
    struct pbsnode node;
    struct node_check_info node_info;
    initialize_pbsnode(&node, NULL, NULL, 0, FALSE);
    memset(&node_info, 0, sizeof(node_info));
    save_characteristic(NULL, &node_info);
    save_characteristic(&node, NULL);
    save_characteristic(&node, &node_info);
}
예제 #2
0
void mgr_node_modify(

  struct batch_request *preq)  /* I */

  {
  int               need_todo = 0;

  int               rc;
  int               bad = 0;

  const char       *nodename = NULL;

  svrattrl         *plist;
  node_check_info   nci;

  struct pbsnode   *pnode = NULL;

  nodename = preq->rq_ind.rq_manager.rq_objname;
  pnode = find_nodebyname(nodename);

  if (pnode == NULL)
    {
    req_reject(PBSE_UNKNODE, 0, preq, NULL, NULL);

    return;
    }

  plist = (svrattrl *)GET_NEXT(preq->rq_ind.rq_manager.rq_attr);

  save_characteristic(pnode,&nci);

  rc = mgr_modify_node(
         &pnode,
         node_attr_def,
         ND_ATR_LAST,
         plist,
         preq->rq_perm,
         &bad,
         ATR_ACTION_ALTER);

  if (rc != 0)
    {
    /* In the specific node case, reply w/ error and return*/

    switch (rc)
      {
      case PBSE_INTERNAL:

      case PBSE_SYSTEM:

        req_reject(rc, bad, preq, NULL, NULL);

        break;

      case PBSE_NOATTR:

      case PBSE_ATTRRO:

      case PBSE_MUTUALEX:

      case PBSE_BADNDATVAL:

        reply_badattr(rc, bad, plist, preq);

        break;

      default:

        req_reject(rc, 0, preq, NULL, NULL);

        break;
      }

    if(pnode != NULL)
      {
      unlock_node(pnode, "mgr_node_set", (char *)"error", LOGLEVEL);
      pnode = NULL;
      }

    return;
    } /* END if (rc != 0) */
  else
    {
      /* modifications succeeded for this node */
    if(pnode != NULL)
      {
      chk_characteristic(pnode, &nci, &need_todo);
      }
    }

  if(pnode != NULL)
    {
    unlock_node(pnode, "mgr_node_set", (char *)"single_node", LOGLEVEL);
    pnode = NULL;
    }

  if (need_todo & WRITENODE_STATE)
    {
    /*some nodes set to "offline"*/
    write_node_state();

    need_todo &= ~(WRITENODE_STATE);
    }

  if (need_todo & WRITENODE_POWER_STATE)
    {
    /*some nodes changed power state*/
    write_node_power_state();

    need_todo &= ~(WRITENODE_POWER_STATE);
    }

  if (need_todo & WRITENODE_NOTE)
    {
    /*some nodes have new "note"s*/
    write_node_note();

    need_todo &= ~(WRITENODE_NOTE);
    }

  if (need_todo & WRITE_NEW_NODESFILE)
    {
    /*create/delete/prop/ntype change*/
    if (!update_nodes_file(NULL))
      need_todo &= ~(WRITE_NEW_NODESFILE);  /*successful on update*/
    }

  recompute_ntype_cnts();

  reply_ack(preq);  /*request completely successful*/

  return;
  }  /* END void mgr_node_set() */