/** * @brief * svr_movejob - Test if the destination is local or not and call a routine to * do the appropriate move. * * param[in,out] jobp - pointer to job to move * param[in] destination - destination to be moved * param[in] req - client request from a qmove client, null if a route * * @return int * @retval 0 : success * @retval -1 : permenent failure or rejection, * @retval 1 : failed but try again * @reval 2 : deferred (ie move in progress), check later */ int svr_movejob(job *jobp, char *destination, struct batch_request *req) { pbs_net_t destaddr; unsigned int port = pbs_server_port_dis; char *toserver; if (strlen(destination) >= (size_t)PBS_MAXROUTEDEST) { sprintf(log_buffer, "name %s over maximum length of %d", destination, PBS_MAXROUTEDEST); log_err(-1, "svr_movejob", log_buffer); pbs_errno = PBSE_QUENBIG; return -1; } strncpy(jobp->ji_qs.ji_destin, destination, PBS_MAXROUTEDEST); jobp->ji_qs.ji_un_type = JOB_UNION_TYPE_ROUTE; if ((toserver = strchr(destination, '@')) != NULL) { /* check to see if the part after '@' is this server */ destaddr = get_hostaddr(parse_servername(++toserver, &port)); if ((destaddr != pbs_server_addr) || (port != pbs_server_port_dis)) { return (net_move(jobp, req)); /* not a local dest */ } } /* if get to here, it is a local destination */ return (local_move(jobp, req)); }
int svr_movejob( job *jobp, char *destination, struct batch_request *req) { pbs_net_t destaddr; int local; unsigned int port; char *toserver; if (strlen(destination) >= (size_t)PBS_MAXROUTEDEST) { sprintf(log_buffer, "name %s over maximum length of %d\n", destination, PBS_MAXROUTEDEST); log_err(-1, "svr_movejob", log_buffer); pbs_errno = PBSE_QUENBIG; return(ROUTE_PERM_FAILURE); } strncpy(jobp->ji_qs.ji_destin, destination, PBS_MAXROUTEDEST); jobp->ji_qs.ji_un_type = JOB_UNION_TYPE_ROUTE; local = 1; if ((toserver = strchr(destination, '@')) != NULL) { /* check to see if the part after '@' is this server */ destaddr = get_hostaddr(parse_servername(++toserver, &port)); if (destaddr != pbs_server_addr) { local = 0; } } if (local != 0) { return(local_move(jobp, req)); } return(net_move(jobp, req)); } /* svr_movejob() */
int svr_movejob( job *jobp, char *destination, int *my_err, struct batch_request *req) { pbs_net_t destaddr; int local; unsigned int port; char *toserver; char log_buf[LOCAL_LOG_BUF_SIZE]; if (LOGLEVEL >= 8) { sprintf(log_buf, "%s", jobp->ji_qs.ji_jobid); log_event(PBSEVENT_JOB, PBS_EVENTCLASS_JOB, __func__, log_buf); } if (strlen(destination) >= (size_t)PBS_MAXROUTEDEST) { sprintf(log_buf, "name %s over maximum length of %d\n", destination, PBS_MAXROUTEDEST); log_err(-1, __func__, log_buf); *my_err = PBSE_QUENBIG; return(-1); } snprintf(jobp->ji_qs.ji_destin, sizeof(jobp->ji_qs.ji_destin), "%s", destination); jobp->ji_qs.ji_un_type = JOB_UNION_TYPE_ROUTE; local = 1; if ((toserver = strchr(destination, '@')) != NULL) { /* check to see if the part after '@' is this server */ char *tmp = parse_servername(++toserver, &port); destaddr = get_hostaddr(my_err, tmp); if (destaddr != pbs_server_addr) { local = 0; } free(tmp); } if (local != 0) { return(local_move(jobp, my_err, req)); } return(net_move(jobp, req)); } /* svr_movejob() */