Beispiel #1
0
/**
 * @brief
 *	Load a scheduler object in pbs_server from a database scheduler object
 *
 * @param[in]	ps - Address of the scheduler in pbs server
 * @param[out] pdbsched  - Address of the database scheduler object
 * @param[in] updatetype - quick or full update
 *
 * @return   !=0   - Failure
 * @return   0     - Success
 */
static int
svr_to_db_sched(struct pbs_sched *ps, pbs_db_sched_info_t *pdbsched, int updatetype)
{
	pdbsched->sched_name[sizeof(pdbsched->sched_name) - 1] = '\0';
	strncpy(pdbsched->sched_name, ps->sc_name, sizeof(pdbsched->sched_name));

	if (updatetype != PBS_UPDATE_DB_QUICK) {
		if ((encode_attr_db(sched_attr_def,
			ps->sch_attr,
			(int)SCHED_ATR_LAST, &pdbsched->attr_list, 1)) != 0) /* encode all attributes */
			return -1;
	}

	return 0;
}
Beispiel #2
0
/**
 * @brief
 *		Load a database queue object from a server queue object
 *
 * @param[in]	pque	- Address of the queue in the server
 * @param[out]	pdbque  - Address of the database queue object
 *
 *@return 0      Success
 *@return !=0    Failure
 */
static int
svr_to_db_que(pbs_queue *pque, pbs_db_que_info_t *pdbque, int updatetype)
{
	pdbque->qu_name[sizeof(pdbque->qu_name) - 1] = '\0';
	strncpy(pdbque->qu_name, pque->qu_qs.qu_name, sizeof(pdbque->qu_name));
	pdbque->qu_type = pque->qu_qs.qu_type;

	if (updatetype != PBS_UPDATE_DB_QUICK) {
		if ((encode_attr_db(que_attr_def, pque->qu_attr,
			(int)QA_ATR_LAST, &pdbque->attr_list, 1)) != 0) /* encode all attributes */
			return -1;
	}

	return 0;
}
Beispiel #3
0
/**
 * @brief
 *	Load a database server object from a server object in the server
 *
 * @param[in]	ps	-	Address of the server in pbs server
 * @param[out]	pdbsvr	-	Address of the database server object
 * @param[in]   updatetype -    quick or full update
 *
 * @return   !=0   - Failure
 * @return   0     - Success
 *
 */
static int
svr_to_db_svr(struct server *ps, pbs_db_svr_info_t *pdbsvr, int updatetype)
{
	memset(pdbsvr, 0, sizeof(pbs_db_svr_info_t));
	pdbsvr->sv_numjobs = ps->sv_qs.sv_numjobs;
	pdbsvr->sv_numque = ps->sv_qs.sv_numque;
	pdbsvr->sv_jobidnumber = ps->sv_qs.sv_jobidnumber;

	if (updatetype != PBS_UPDATE_DB_QUICK) {
		if ((encode_attr_db(svr_attr_def,
			ps->sv_attr,
			(int)SRV_ATR_LAST, &pdbsvr->attr_list, 1)) != 0) /* encode all attributes */
			return -1;
	}

	return 0;
}