+ Dmsg1(100, "find last jobid for: %s\n", NPRT(Name));
+ if (!db_find_last_jobid(jcr, jcr->db, Name, &jr)) {
+ if (jcr->JobLevel == 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;
+ }
+ verify_jobid = jr.JobId;
+ Dmsg1(100, "Last full jobid=%d\n", verify_jobid);
+ }
+ /*
+ * Now get the job record for the previous backup that interests
+ * us. We use the verify_jobid that we found above.
+ */
+ if (jcr->JobLevel == L_VERIFY_CATALOG ||
+ jcr->JobLevel == L_VERIFY_VOLUME_TO_CATALOG ||
+ jcr->JobLevel == L_VERIFY_DISK_TO_CATALOG) {
+ jcr->previous_jr.JobId = verify_jobid;
+ if (!db_get_job_record(jcr, jcr->db, &jcr->previous_jr)) {
+ Jmsg(jcr, M_FATAL, 0, _("Could not get job record for previous Job. ERR=%s"),
+ db_strerror(jcr->db));
+ return false;
+ }
+ if (jcr->previous_jr.JobStatus != 'T') {
+ Jmsg(jcr, M_FATAL, 0, _("Last Job %d did not terminate normally. JobStatus=%c\n"),
+ verify_jobid, jcr->previous_jr.JobStatus);
+ return false;
+ }
+ Jmsg(jcr, M_INFO, 0, _("Verifying against JobId=%d Job=%s\n"),
+ jcr->previous_jr.JobId, jcr->previous_jr.Job);