]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/dird/verify.c
First cut of bat rerun a Job from Jobs Run
[bacula/bacula] / bacula / src / dird / verify.c
index b810f139c08b381bef591a8988746161fae26328..92b29edd8179cb58df31ec3ce875798b5bc7a206 100644 (file)
@@ -6,7 +6,7 @@
    The main author of Bacula is Kern Sibbald, with contributions from
    many others, a complete list can be found in the file AUTHORS.
    This program is Free Software; you can redistribute it and/or
-   modify it under the terms of version two of the GNU General Public
+   modify it under the terms of version three of the GNU Affero General Public
    License as published by the Free Software Foundation and included
    in the file LICENSE.
 
@@ -15,7 +15,7 @@
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    General Public License for more details.
 
-   You should have received a copy of the GNU General Public License
+   You should have received a copy of the GNU Affero General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
@@ -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);
    }
    /*
@@ -603,7 +611,7 @@ void get_attributes_and_compare_to_catalog(JCR *jcr, JobId_t JobId)
           */
          fdbr.FileId = 0;
          if (!db_get_file_attributes_record(jcr, jcr->db, jcr->fname,
-              NULL, &fdbr)) {
+              &jcr->previous_jr, &fdbr)) {
             Jmsg(jcr, M_INFO, 0, _("New file: %s\n"), jcr->fname);
             Dmsg1(020, _("File not in catalog: %s\n"), jcr->fname);
             set_jcr_job_status(jcr, JS_Differences);