]> git.sur5r.net Git - bacula/bacula/commitdiff
Cleanup function name and move MaxRunSchedTime value to JCR
authorEric Bollengier <eric@eb.homelinux.org>
Sun, 17 Jul 2011 08:06:19 +0000 (10:06 +0200)
committerKern Sibbald <kern@sibbald.com>
Sat, 20 Apr 2013 12:49:06 +0000 (14:49 +0200)
bacula/src/dird/dird_conf.c
bacula/src/dird/job.c
bacula/src/jcr.h

index a8bb3dfb37910e19c1b09bdb8450ffc3773ded65..211f4d81cfbebdb9768ee41c25aca444fc039b6a 100644 (file)
@@ -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) {
index b3bee866cc7f94e8f9d07fa05b3c9a84dd5c3a1a..476ee755fef4f1fb72c9625af9f5c76601028915 100644 (file)
@@ -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;
index cf880a342d883f1dee6462ae56b811f1a8f52114..d520bbad271726e661bba9ef878ae77e8b958435 100644 (file)
@@ -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 */