From: Kern Sibbald Date: Wed, 1 Jul 2009 19:00:38 +0000 (+0000) Subject: Fix bug #1317 Allow duplicate jobs = no does not work X-Git-Tag: Release-3.0.2~129 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=9acea4a20472c94e0d69750b57248fb0331c3aad;p=bacula%2Fbacula Fix bug #1317 Allow duplicate jobs = no does not work git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@8937 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/src/dird/dird_conf.c b/bacula/src/dird/dird_conf.c index 83c583618c..7a3f446030 100644 --- a/bacula/src/dird/dird_conf.c +++ b/bacula/src/dird/dird_conf.c @@ -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} diff --git a/bacula/src/dird/job.c b/bacula/src/dird/job.c index dbca697b29..6a11f9d389 100644 --- a/bacula/src/dird/job.c +++ b/bacula/src/dird/job.c @@ -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); diff --git a/bacula/technotes b/bacula/technotes index 2532fa2a1a..e20801290f 100644 --- a/bacula/technotes +++ b/bacula/technotes @@ -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