]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/dird/vbackup.c
Implement MaxVirtualFullInterval
[bacula/bacula] / bacula / src / dird / vbackup.c
index 64d69bb66f4c4e59f99dfecc460c89921aaf16f7..09ab291a85d78e73f141bf24c142eaa293b32617 100644 (file)
@@ -1,17 +1,20 @@
 /*
-   Bacula® - The Network Backup Solution
+   Bacula(R) - The Network Backup Solution
 
-   Copyright (C) 2008-2014 Free Software Foundation Europe e.V.
+   Copyright (C) 2000-2016 Kern Sibbald
 
-   The main author of Bacula is Kern Sibbald, with contributions from many
-   others, a complete list can be found in the file AUTHORS.
+   The original author of Bacula is Kern Sibbald, with contributions
+   from many others, a complete list can be found in the file AUTHORS.
 
    You may use this file and others of this release according to the
    license defined in the LICENSE file, which includes the Affero General
    Public License, v3.0 ("AGPLv3") and some additional permissions and
    terms pursuant to its AGPLv3 Section 7.
 
-   Bacula® is a registered trademark of Kern Sibbald.
+   This notice must be preserved when any source code is 
+   conveyed and/or propagated.
+
+   Bacula(R) is a registered trademark of Kern Sibbald.
 */
 /*
  *
@@ -47,23 +50,13 @@ void vbackup_cleanup(JCR *jcr, int TermCode);
 bool do_vbackup_init(JCR *jcr)
 {
 
-   if (!get_or_create_fileset_record(jcr)) {
-      Dmsg1(dbglevel, "JobId=%d no FileSet\n", (int)jcr->JobId);
-      return false;
-   }
-
-   apply_pool_overrides(jcr);
-
-   if (!allow_duplicate_job(jcr)) {
-      return false;
-   }
+  /* 
+   * if the read pool has not been allocated yet due to the job 
+   * being upgraded to a virtual full then allocate it now 
+   */
+  if (!jcr->rpool_source)
+    jcr->rpool_source = get_pool_memory(PM_MESSAGE);
 
-   jcr->jr.PoolId = get_or_create_pool_record(jcr, jcr->pool->name());
-   if (jcr->jr.PoolId == 0) {
-      Dmsg1(dbglevel, "JobId=%d no PoolId\n", (int)jcr->JobId);
-      Jmsg(jcr, M_FATAL, 0, _("Could not get or create a Pool record.\n"));
-      return false;
-   }
    /*
     * Note, at this point, pool is the pool for this job.  We
     *  transfer it to rpool (read pool), and a bit later,
@@ -73,7 +66,7 @@ bool do_vbackup_init(JCR *jcr)
    jcr->rpool = jcr->pool;            /* save read pool */
    pm_strcpy(jcr->rpool_source, jcr->pool_source);
 
-   /* If pool storage specified, use it for restore */
+   /* If pool storage specified, use it for virtual full */
    copy_rstorage(jcr, jcr->pool->storage, _("Pool resource"));
 
    Dmsg2(dbglevel, "Read pool=%s (From %s)\n", jcr->rpool->name(), jcr->rpool_source);
@@ -146,7 +139,7 @@ _("This Job is not an Accurate backup so is not equivalent to a Full backup.\n")
               jr.cStartTime);
 
          jr.JobLevel = L_INCREMENTAL; /* Take Full+Diff+Incr */
-         db_accurate_get_jobids(jcr, jcr->db, &jr, &jobids);
+         db_get_accurate_jobids(jcr, jcr->db, &jr, &jobids);
 
       } else if (sel.set_string(jcr->JobIds, true)) {
          /* Found alljobid keyword */
@@ -204,7 +197,7 @@ _("This Job is not an Accurate backup so is not equivalent to a Full backup.\n")
 
    } else {                     /* No argument provided */
       jcr->jr.JobLevel = L_VIRTUAL_FULL;
-      db_accurate_get_jobids(jcr, jcr->db, &jcr->jr, &jobids);
+      db_get_accurate_jobids(jcr, jcr->db, &jcr->jr, &jobids);
       Dmsg1(10, "Accurate jobids=%s\n", jobids.list);
    }
 
@@ -281,6 +274,10 @@ _("This Job is not an Accurate backup so is not equivalent to a Full backup.\n")
    jcr->jr.JobTDate = jcr->start_time;
    jcr->setJobStatus(JS_Running);
 
+   /* Add the following when support for base jobs is added to virtual full */
+   //jcr->HasBase = jcr->job->base != NULL;
+   //jcr->jr.HasBase = jcr->HasBase;
+
    /* Update job start record */
    if (!db_update_job_start_record(jcr, jcr->db, &jcr->jr)) {
       Jmsg(jcr, M_FATAL, 0, "%s", db_strerror(jcr->db));
@@ -573,15 +570,9 @@ static bool create_bootstrap_file(JCR *jcr, char *jobids)
 
    complete_bsr(ua, rx.bsr);
    jcr->ExpectedFiles = write_bsr_file(ua, rx);
-   if (chk_dbglvl(10)) {
-      Pmsg1(000,  "Found %d files to consolidate.\n", jcr->ExpectedFiles);
-   }
-   if (jcr->ExpectedFiles == 0) {
-      free_ua_context(ua);
-      free_bsr(rx.bsr);
-      return false;
-   }
+   Jmsg(jcr, M_INFO, 0, _("Found %d files to consolidate into Virtual Full.\n"),
+        jcr->ExpectedFiles);
    free_ua_context(ua);
    free_bsr(rx.bsr);
-   return true;
+   return jcr->ExpectedFiles==0?false:true;
 }