From: Eric Bollengier Date: Sun, 17 Jul 2011 08:06:19 +0000 (+0200) Subject: Cleanup function name and move MaxRunSchedTime value to JCR X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=65c1dba1f85790455ef2271f4f1d8eaca3caf4a7;p=bacula%2Fbacula Cleanup function name and move MaxRunSchedTime value to JCR --- diff --git a/bacula/src/dird/dird_conf.c b/bacula/src/dird/dird_conf.c index a8bb3dfb37..211f4d81cf 100644 --- a/bacula/src/dird/dird_conf.c +++ b/bacula/src/dird/dird_conf.c @@ -365,9 +365,9 @@ static RES_ITEM fs_items[] = { * name handler value code flags default_value */ static RES_ITEM sch_items[] = { - {"name", store_name, ITEM(res_sch.hdr.name), 0, ITEM_REQUIRED, 0}, - {"description", store_str, ITEM(res_sch.hdr.desc), 0, 0, 0}, - {"run", store_run, ITEM(res_sch.run), 0, 0, 0}, + {"name", store_name, ITEM(res_sch.hdr.name), 0, ITEM_REQUIRED, 0}, + {"description", store_str, ITEM(res_sch.hdr.desc), 0, 0, 0}, + {"run", store_run, ITEM(res_sch.run), 0, 0, 0}, {NULL, NULL, {0}, 0, 0, 0} }; @@ -701,6 +701,9 @@ void dump_resource(int type, RES *reshdr, void sendit(void *sock, const char *fm if (res->res_job.MaxStartDelay) { sendit(sock, _(" --> MaxStartDelay=%u\n"), res->res_job.MaxStartDelay); } + if (res->res_job.MaxRunSchedTime) { + sendit(sock, _(" --> MaxRunSchedTime=%u\n"), res->res_job.MaxRunSchedTime); + } if (res->res_job.storage) { STORE *store; foreach_alist(store, res->res_job.storage) { diff --git a/bacula/src/dird/job.c b/bacula/src/dird/job.c index b3bee866cc..476ee755fe 100644 --- a/bacula/src/dird/job.c +++ b/bacula/src/dird/job.c @@ -42,7 +42,7 @@ static void job_monitor_watchdog(watchdog_t *self); static void job_monitor_destructor(watchdog_t *self); static bool job_check_maxwaittime(JCR *jcr); static bool job_check_maxruntime(JCR *jcr); -static bool job_check_maxschedruntime(JCR *jcr); +static bool job_check_maxrunschedtime(JCR *jcr); /* Imported subroutines */ extern void term_scheduler(); @@ -272,9 +272,9 @@ static void *job_thread(void *arg) Jmsg(jcr, M_FATAL, 0, _("Job canceled because max start delay time exceeded.\n")); } - if (job_check_maxschedruntime(jcr)) { + if (job_check_maxrunschedtime(jcr)) { jcr->setJobStatus(JS_Canceled); - Jmsg(jcr, M_FATAL, 0, _("Job canceled because max sched run time exceeded.\n")); + Jmsg(jcr, M_FATAL, 0, _("Job canceled because max run sched time exceeded.\n")); } /* TODO : check if it is used somewhere */ @@ -553,9 +553,9 @@ static void job_monitor_watchdog(watchdog_t *self) Qmsg(jcr, M_FATAL, 0, _("Max run time exceeded. Job canceled.\n")); cancel = true; /* check MaxRunSchedTime */ - } else if (job_check_maxschedruntime(jcr)) { + } else if (job_check_maxrunschedtime(jcr)) { jcr->setJobStatus(JS_Canceled); - Qmsg(jcr, M_FATAL, 0, _("Max sched run time exceeded. Job canceled.\n")); + Qmsg(jcr, M_FATAL, 0, _("Max run sched time exceeded. Job canceled.\n")); cancel = true; } @@ -647,14 +647,14 @@ static bool job_check_maxruntime(JCR *jcr) * Check if MaxRunSchedTime has expired and if the job can be * canceled. */ -static bool job_check_maxschedruntime(JCR *jcr) +static bool job_check_maxrunschedtime(JCR *jcr) { - if (jcr->job->MaxRunSchedTime == 0 || job_canceled(jcr)) { + if (jcr->MaxRunSchedTime == 0 || job_canceled(jcr)) { return false; } - if ((watchdog_time - jcr->sched_time) < jcr->job->MaxRunSchedTime) { + if ((watchdog_time - jcr->sched_time) < jcr->MaxRunSchedTime) { Dmsg3(200, "Job %p (%s) with MaxRunSchedTime %d not expired\n", - jcr, jcr->Job, jcr->job->MaxRunSchedTime); + jcr, jcr->Job, jcr->MaxRunSchedTime); return false; } @@ -1168,6 +1168,7 @@ void set_jcr_defaults(JCR *jcr, JOB *job) jcr->spool_size = job->spool_size; jcr->write_part_after_job = job->write_part_after_job; jcr->accurate = job->accurate; + jcr->MaxRunSchedTime = job->MaxRunSchedTime; if (jcr->RestoreBootstrap) { free(jcr->RestoreBootstrap); jcr->RestoreBootstrap = NULL; diff --git a/bacula/src/jcr.h b/bacula/src/jcr.h index cf880a342d..d520bbad27 100644 --- a/bacula/src/jcr.h +++ b/bacula/src/jcr.h @@ -320,6 +320,7 @@ public: uint32_t ExpectedFiles; /* Expected restore files */ uint32_t MediaId; /* DB record IDs associated with this job */ uint32_t FileIndex; /* Last FileIndex processed */ + utime_t MaxRunSchedTime; /* max run time in seconds from Scheduled time*/ POOLMEM *fname; /* name to put into catalog */ JOB_DBR jr; /* Job DB record for current job */ JOB_DBR previous_jr; /* previous job database record */