From fe9a0efe43ded24d84efe35036ebefb09e914524 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Thu, 17 Jul 2008 09:23:05 +0000 Subject: [PATCH] Fix verify jobs to work again git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@7392 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/dird/job.c | 41 ++++++++++++++++++--------------------- bacula/src/dird/jobq.c | 2 +- bacula/src/dird/vbackup.c | 9 ++------- bacula/src/dird/verify.c | 17 ++++++++++++++++ bacula/technotes-2.5 | 2 ++ 5 files changed, 41 insertions(+), 30 deletions(-) diff --git a/bacula/src/dird/job.c b/bacula/src/dird/job.c index 209d3d6fca..1ade241b42 100644 --- a/bacula/src/dird/job.c +++ b/bacula/src/dird/job.c @@ -148,9 +148,23 @@ bool setup_job(JCR *jcr) jcr->pool_source = get_pool_memory(PM_MESSAGE); pm_strcpy(jcr->pool_source, _("unknown source")); } - Dmsg2(500, "pool=%s (From %s)\n", jcr->pool->name(), jcr->pool_source); - /* ****FIXME**** */ - if (jcr->JobType == JT_MIGRATE || jcr->JobType == JT_COPY) { + + switch (jcr->JobType) { + case JT_VERIFY: + case JT_RESTORE: + case JT_COPY: + case JT_MIGRATE: + jcr->JobReads = true; + break; + case JT_BACKUP: + if (jcr->JobLevel == L_VIRTUAL_FULL) { + jcr->JobReads = true; + } + break; + default: + break; + } + if (jcr->JobReads) { if (!jcr->rpool_source) { jcr->rpool_source = get_pool_memory(PM_MESSAGE); pm_strcpy(jcr->rpool_source, _("unknown source")); @@ -1050,33 +1064,16 @@ void set_jcr_defaults(JCR *jcr, JOB *job) jcr->job = job; jcr->JobType = job->JobType; jcr->JobStatus = JS_Created; + switch (jcr->JobType) { case JT_ADMIN: jcr->JobLevel = L_NONE; break; - case JT_VERIFY: - case JT_RESTORE: - case JT_COPY: - case JT_MIGRATE: - jcr->JobReads = true; - jcr->JobLevel = job->JobLevel; - break; - case JT_BACKUP: - jcr->JobLevel = job->JobLevel; - if (jcr->JobLevel == L_VIRTUAL_FULL) { - jcr->JobReads = true; - } - break; default: jcr->JobLevel = job->JobLevel; break; } - if (jcr->JobReads) { - if (!jcr->rpool_source) { - jcr->rpool_source = get_pool_memory(PM_MESSAGE); - pm_strcpy(jcr->rpool_source, _("unknown source")); - } - } + if (!jcr->fname) { jcr->fname = get_pool_memory(PM_FNAME); } diff --git a/bacula/src/dird/jobq.c b/bacula/src/dird/jobq.c index c04ff9306b..4f21b14612 100644 --- a/bacula/src/dird/jobq.c +++ b/bacula/src/dird/jobq.c @@ -700,7 +700,7 @@ static bool acquire_resources(JCR *jcr) bool skip_this_jcr = false; jcr->acquired_resource_locks = false; - if (jcr->rstore == jcr->wstore) { /* deadlock */ + if (jcr->rstore && jcr->rstore == jcr->wstore) { /* possible deadlock */ Jmsg(jcr, M_FATAL, 0, _("Job canceled. Attempt to read and write same device.\n" " Read storage \"%s\" (From %s) -- Write storage \"%s\" (From %s)\n"), jcr->rstore->name(), jcr->rstore_source, jcr->wstore->name(), jcr->wstore_source); diff --git a/bacula/src/dird/vbackup.c b/bacula/src/dird/vbackup.c index 86c117d1ca..3c82b4fe6c 100644 --- a/bacula/src/dird/vbackup.c +++ b/bacula/src/dird/vbackup.c @@ -61,12 +61,6 @@ void vbackup_cleanup(JCR *jcr, int TermCode); */ bool do_vbackup_init(JCR *jcr) { - /* ***FIXME*** remove when implemented in job.c */ - if (!jcr->rpool_source) { - jcr->rpool_source = get_pool_memory(PM_MESSAGE); - pm_strcpy(jcr->rpool_source, _("unknown source")); - } - if (!get_or_create_fileset_record(jcr)) { Dmsg1(dbglevel, "JobId=%d no FileSet\n", (int)jcr->JobId); return false; @@ -124,7 +118,7 @@ bool do_vbackup_init(JCR *jcr) return false; } } - /* ***FIXME*** this is probably not needed */ + if (!set_migration_wstorage(jcr, jcr->pool)) { return false; } @@ -170,6 +164,7 @@ bool do_vbackup(JCR *jcr) /* * Now start a job with the Storage daemon */ + Dmsg2(000, "rstorage=%p wstorage=%p\n", jcr->rstorage, jcr->wstorage); Dmsg2(000, "Read store=%s, write store=%s\n", ((STORE *)jcr->rstorage->first())->name(), ((STORE *)jcr->wstorage->first())->name()); diff --git a/bacula/src/dird/verify.c b/bacula/src/dird/verify.c index 7471a50afb..50e4491e21 100644 --- a/bacula/src/dird/verify.c +++ b/bacula/src/dird/verify.c @@ -69,6 +69,23 @@ bool do_verify_init(JCR *jcr) if (!allow_duplicate_job(jcr)) { return false; } + switch (jcr->JobLevel) { + case L_VERIFY_INIT: + case L_VERIFY_CATALOG: + case L_VERIFY_DISK_TO_CATALOG: + free_rstorage(jcr); + free_wstorage(jcr); + break; + case L_VERIFY_VOLUME_TO_CATALOG: + free_wstorage(jcr); + break; + case L_VERIFY_DATA: + break; + default: + Jmsg2(jcr, M_FATAL, 0, _("Unimplemented Verify level %d(%c)\n"), jcr->JobLevel, + jcr->JobLevel); + return false; + } return true; } diff --git a/bacula/technotes-2.5 b/bacula/technotes-2.5 index 0abaaa5afd..ba68bbcfdd 100644 --- a/bacula/technotes-2.5 +++ b/bacula/technotes-2.5 @@ -30,6 +30,8 @@ vtape driver General: +17Jul08 +kes Fix verify jobs to work again. 16Jul08 kes Virtual Backup tweaks -- it is close to working. 15Jul08 -- 2.39.5