]> git.sur5r.net Git - bacula/bacula/commitdiff
Fix bug #1317 Allow duplicate jobs = no does not work
authorKern Sibbald <kern@sibbald.com>
Wed, 1 Jul 2009 19:00:38 +0000 (19:00 +0000)
committerKern Sibbald <kern@sibbald.com>
Wed, 1 Jul 2009 19:00:38 +0000 (19:00 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@8937 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/src/dird/dird_conf.c
bacula/src/dird/job.c
bacula/technotes

index 83c583618c46974c24415eb7b6a2c39c182a3531..7a3f44603030a7a8987b19a32fba28f4b69a0f12 100644 (file)
@@ -335,7 +335,7 @@ RES_ITEM job_items[] = {
    {"accurate",           store_bool, ITEM(res_job.accurate), 0,0,0},
    {"allowduplicatejobs", store_bool, ITEM(res_job.AllowDuplicateJobs), 0, ITEM_DEFAULT, false},
    {"allowhigherduplicates",   store_bool, ITEM(res_job.AllowHigherDuplicates), 0, ITEM_DEFAULT, true},
-   {"cancelqueuedduplicates",  store_bool, ITEM(res_job.CancelQueuedDuplicates), 0, ITEM_DEFAULT, true},
+   {"cancelqueuedduplicates",  store_bool, ITEM(res_job.CancelQueuedDuplicates), 0, ITEM_DEFAULT, false},
    {"cancelrunningduplicates", store_bool, ITEM(res_job.CancelRunningDuplicates), 0, ITEM_DEFAULT, false},
    {"pluginoptions", store_str, ITEM(res_job.PluginOptions), 0, 0, 0},
    {NULL, NULL, {0}, 0, 0, 0}
index dbca697b2965cfc65efbdaacf8d02df1725210ac..6a11f9d389cc8e929bd3527274bf9989981f8282 100644 (file)
@@ -676,9 +676,8 @@ bool allow_duplicate_job(JCR *jcr)
    }
    if (!job->AllowHigherDuplicates) {
       foreach_jcr(djcr) {
-         char ec1[50];
-         if (jcr == djcr) {
-            continue;                   /* do not cancel this job */
+         if (jcr == djcr || djcr->JobId == 0) {
+            continue;                   /* do not cancel this job or consoles */
          }
          if (strcmp(job->name(), djcr->job->name()) == 0) {
             bool cancel_queued = false;
@@ -689,12 +688,6 @@ bool allow_duplicate_job(JCR *jcr)
                }
             }
             /* Cancel */
-            if (!(job->CancelQueuedDuplicates || job->CancelRunningDuplicates)) {
-               /* Zap current job */
-               Jmsg(jcr, M_FATAL, 0, _("Duplicate job not allowed. JobId=%s\n"),
-                  edit_uint64(djcr->JobId, ec1));
-               return false;
-            }
             /* If CancelQueuedDuplicates is set do so only if job is queued */
             if (job->CancelQueuedDuplicates) {
                 switch (djcr->JobStatus) {
@@ -713,13 +706,17 @@ bool allow_duplicate_job(JCR *jcr)
             }
             if (cancel_queued || job->CancelRunningDuplicates) {
                UAContext *ua = new_ua_context(djcr);
-               Jmsg(jcr, M_INFO, 0, _("Cancelling duplicate JobId=%s.\n"), 
-                  edit_uint64(djcr->JobId, ec1));
+               Jmsg(jcr, M_INFO, 0, _("Cancelling duplicate JobId=%d.\n"), djcr->JobId);
                ua->jcr = djcr;
                cancel_job(ua, djcr);
                free_ua_context(ua);
-               Dmsg2(800, "Have cancelled JCR %p Job=%d\n", djcr, djcr->JobId);
+               Dmsg2(800, "Have cancelled JCR %p JobId=%d\n", djcr, djcr->JobId);
+            } else {
+               /* Zap current job */
+               Jmsg(jcr, M_FATAL, 0, _("JobId %d already running. Duplicate job not allowed.\n"),
+                  djcr->JobId);
             }
+            break;                 /* did our work, get out */
          }
       }
       endeach_jcr(djcr);
index 2532fa2a1ab47da5d16dbf93a5d91d6ae384d713..e20801290f587a4ddca61b5228ce1355ba77ef0e 100644 (file)
@@ -3,6 +3,7 @@
 General:
 
 01Jul09
+kes  Fix bug #1317 Allow duplicate jobs = no does not work
 kes  Eliminate double job report when do_xxx_init() returns failure
 kes  Add debug code to MaxDiffInterval
 29Jun09