From 637087a5169079e0a9be38b2fa70c1dcffe2be85 Mon Sep 17 00:00:00 2001 From: Eric Bollengier Date: Sat, 4 Sep 2010 14:35:07 +0200 Subject: [PATCH] Allow to verify any job specified in argument --- bacula/src/dird/ua_run.c | 2 +- bacula/src/dird/verify.c | 32 ++++++++++++++++++++------------ 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/bacula/src/dird/ua_run.c b/bacula/src/dird/ua_run.c index 42f7182319..20923bd521 100644 --- a/bacula/src/dird/ua_run.c +++ b/bacula/src/dird/ua_run.c @@ -546,7 +546,7 @@ static bool reset_restore_context(UAContext *ua, JCR *jcr, run_ctx &rc) rc.level_name = NULL; } if (rc.jid) { - /* Note, this is also MigrateJobId */ + /* Note, this is also MigrateJobId and a VerifyJobId */ jcr->RestoreJobId = str_to_int64(rc.jid); rc.jid = 0; } diff --git a/bacula/src/dird/verify.c b/bacula/src/dird/verify.c index b3a27dc364..92b29edd81 100644 --- a/bacula/src/dird/verify.c +++ b/bacula/src/dird/verify.c @@ -130,24 +130,32 @@ bool do_verify(JCR *jcr) if (jcr->verify_job && (jcr->getJobLevel() == L_VERIFY_VOLUME_TO_CATALOG || jcr->getJobLevel() == L_VERIFY_DISK_TO_CATALOG)) { - Name = jcr->verify_job->name(); + Name = jcr->verify_job->name(); } else { Name = NULL; } Dmsg1(100, "find last jobid for: %s\n", NPRT(Name)); - if (!db_find_last_jobid(jcr, jcr->db, Name, &jr)) { - if (jcr->getJobLevel() == L_VERIFY_CATALOG) { - Jmsg(jcr, M_FATAL, 0, _( - "Unable to find JobId of previous InitCatalog Job.\n" - "Please run a Verify with Level=InitCatalog before\n" - "running the current Job.\n")); - } else { - Jmsg(jcr, M_FATAL, 0, _( - "Unable to find JobId of previous Job for this client.\n")); + + /* see if user supplied a jobid= as run argument or from menu */ + if (jcr->RestoreJobId) { + verify_jobid = jcr->RestoreJobId; + Dmsg1(100, "Supplied jobid=%d\n", verify_jobid); + + } else { + if (!db_find_last_jobid(jcr, jcr->db, Name, &jr)) { + if (jcr->getJobLevel() == L_VERIFY_CATALOG) { + Jmsg(jcr, M_FATAL, 0, _( + "Unable to find JobId of previous InitCatalog Job.\n" + "Please run a Verify with Level=InitCatalog before\n" + "running the current Job.\n")); + } else { + Jmsg(jcr, M_FATAL, 0, _( + "Unable to find JobId of previous Job for this client.\n")); + } + return false; } - return false; + verify_jobid = jr.JobId; } - verify_jobid = jr.JobId; Dmsg1(100, "Last full jobid=%d\n", verify_jobid); } /* -- 2.39.5