]> git.sur5r.net Git - bacula/bacula/commitdiff
Add Accurate and MaxRunSchedTime in Schedule resource
authorEric Bollengier <eric@baculasystems.com>
Wed, 4 Jan 2012 11:07:14 +0000 (12:07 +0100)
committerKern Sibbald <kern@sibbald.com>
Sat, 20 Apr 2013 12:50:22 +0000 (14:50 +0200)
bacula/src/dird/dird_conf.h
bacula/src/dird/run_conf.c
bacula/src/dird/scheduler.c

index 272516f18ef54b6f96972acc687a16176e94f499..0a9d26cafba2f3b0a1e628e81c17c1345b908e0b 100644 (file)
@@ -319,7 +319,7 @@ public:
 inline char *STORE::dev_name() const
 { 
    DEVICE *dev = (DEVICE *)device->first();
-   return dev->hdr.name;
+   return dev->name();
 }
 
 inline char *STORE::name() const { return hdr.name; }
@@ -613,8 +613,12 @@ public:
    uint32_t level;                    /* level override */
    int32_t Priority;                  /* priority override */
    uint32_t job_type;
+   utime_t MaxRunSchedTime;           /* max run time in sec from Sched time */
+   bool MaxRunSchedTime_set;          /* MaxRunSchedTime given */
    bool spool_data;                   /* Data spooling override */
    bool spool_data_set;               /* Data spooling override given */
+   bool accurate;                     /* accurate */
+   bool accurate_set;                 /* accurate given */
    bool write_part_after_job;         /* Write part after job override */
    bool write_part_after_job_set;     /* Write part after job override given */
    
index 23b8732ceca49d2c3a56f566cc445ff5a93d548f..69f80d3c34d5910b22e0b19d154dc81be2a9ec18 100644 (file)
@@ -1,7 +1,7 @@
 /*
    Bacula® - The Network Backup Solution
 
-   Copyright (C) 2000-2008 Free Software Foundation Europe e.V.
+   Copyright (C) 2000-2011 Free Software Foundation Europe e.V.
 
    The main author of Bacula is Kern Sibbald, with contributions from
    many others, a complete list can be found in the file AUTHORS.
@@ -32,7 +32,6 @@
  *
  *     Kern Sibbald, May MM
  *
- *     Version $Id$
  */
 
 #include "bacula.h"
@@ -163,6 +162,8 @@ static struct s_kw RunFields[] = {
    {"priority",          'p'},
    {"spooldata",         's'},
    {"writepartafterjob", 'W'},
+   {"maxrunschedtime",   'm'},
+   {"accurate",          'a'},
    {NULL,                 0}
 };
 
@@ -183,6 +184,7 @@ void store_run(LEX *lc, RES_ITEM *item, int index, int pass)
 {
    int i, j;
    bool found;
+   utime_t utime;
    int token, state, state2 = 0, code = 0, code2 = 0;
    int options = lc->options;
    RUN **run = (RUN **)(item->value);
@@ -304,6 +306,27 @@ void store_run(LEX *lc, RES_ITEM *item, int index, int pass)
                   lrun.msgs = (MSGS *)res;
                }
                break;
+            case 'm':           /* max run sched time */
+               token = lex_get_token(lc, T_QUOTED_STRING); 
+               if (!duration_to_utime(lc->str, &utime)) {
+                  scan_err1(lc, _("expected a time period, got: %s"), lc->str);
+                  return;
+               }
+               lrun.MaxRunSchedTime = utime;
+               lrun.MaxRunSchedTime_set = true;
+               break;
+            case 'a':           /* accurate */
+               token = lex_get_token(lc, T_NAME);
+               if (strcasecmp(lc->str, "yes") == 0 || strcasecmp(lc->str, "true") == 0) {
+                  lrun.accurate = true;
+                  lrun.accurate_set = true;
+               } else if (strcasecmp(lc->str, "no") == 0 || strcasecmp(lc->str, "false") == 0) {
+                  lrun.accurate = false;
+                  lrun.accurate_set = true;
+               } else {
+                  scan_err1(lc, _("Expect a YES or NO, got: %s"), lc->str);
+               }
+               break;
             default:
                scan_err1(lc, _("Expected a keyword name, got: %s"), lc->str);
                /* NOT REACHED */
index a4b32ce126b2f6f2cb37412d4d5c8245dd1ea5b3..154cc8d05c4fdc91b5ba69b480252cd00eafe534 100644 (file)
@@ -232,9 +232,15 @@ again:
    if (run->spool_data_set) {
       jcr->spool_data = run->spool_data;
    }
+   if (run->accurate_set) {     /* overwrite accurate mode */
+      jcr->accurate = run->accurate;
+   }
    if (run->write_part_after_job_set) {
       jcr->write_part_after_job = run->write_part_after_job;
    }
+   if (run->MaxRunSchedTime_set) {
+      jcr->MaxRunSchedTime = run->MaxRunSchedTime;
+   }
    Dmsg0(dbglvl, "Leave wait_for_next_job()\n");
    return jcr;
 }
@@ -266,7 +272,6 @@ static void find_runs()
 
    Dmsg0(dbglvl, "enter find_runs()\n");
 
-
    /* compute values for time now */
    now = time(NULL);
    (void)localtime_r(&now, &tm);