]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/dird/autoprune.c
Keep the same keywords as in previous version
[bacula/bacula] / bacula / src / dird / autoprune.c
index a6c7ce5653d9ea302e5613a13511981b60225789..86e5c7935e0d4f0a24f2faa45b28b663d0c38986 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.
@@ -50,6 +50,7 @@ void do_autoprune(JCR *jcr)
 {
    UAContext *ua;
    CLIENT *client;
+   POOL *pool;
    bool pruned;
 
    if (!jcr->client) {                /* temp -- remove me */
@@ -58,18 +59,17 @@ void do_autoprune(JCR *jcr)
 
    ua = new_ua_context(jcr);
    client = jcr->client;
+   pool = jcr->pool;
 
    if (jcr->job->PruneJobs || jcr->client->AutoPrune) {
-      Jmsg(jcr, M_INFO, 0, _("Begin pruning Jobs.\n"));
-      prune_jobs(ua, client, jcr->get_JobType());
+      prune_jobs(ua, client, pool, jcr->getJobType());
       pruned = true;
    } else {
       pruned = false;
    }
 
    if (jcr->job->PruneFiles || jcr->client->AutoPrune) {
-      Jmsg(jcr, M_INFO, 0, _("Begin pruning Files.\n"));
-      prune_files(ua, client);
+      prune_files(ua, client, pool);
       pruned = true;
    }
    if (pruned) {
@@ -107,7 +107,6 @@ void prune_volumes(JCR *jcr, bool InChanger, MEDIA_DBR *mr)
    prune_list.JobId = (JobId_t *)malloc(sizeof(JobId_t) * prune_list.max_ids);
 
    ua = new_ua_context(jcr);
-
    db_lock(jcr->db);
 
    /* Edit PoolId */
@@ -123,7 +122,14 @@ void prune_volumes(JCR *jcr, bool InChanger, MEDIA_DBR *mr)
    } else {
       ed2[0] = 0;
    }
-   Dmsg1(100, "Scratch pool=%s\n", ed2);
+
+   if(mr->ScratchPoolId) {
+      edit_int64(mr->ScratchPoolId, ed3);
+      bstrncat(ed2, ed3, sizeof(ed2));
+      bstrncat(ed2, ",", sizeof(ed2));
+   }
+
+   Dmsg1(100, "Scratch pool(s)=%s\n", ed2);
    /*
     * ed2 ends up with scratch poolid and current poolid or
     *   just current poolid if there is no scratch pool 
@@ -154,7 +160,7 @@ void prune_volumes(JCR *jcr, bool InChanger, MEDIA_DBR *mr)
       goto bail_out;
    }
 
-   Dmsg1(100, "num_ids=%d\n", ids.num_ids);
+   Dmsg1(100, "Volume prune num_ids=%d\n", ids.num_ids);
 
    /* Visit each Volume and Prune it until we find one that is purged */
    for (i=0; i<ids.num_ids; i++) {
@@ -183,9 +189,10 @@ void prune_volumes(JCR *jcr, bool InChanger, MEDIA_DBR *mr)
             prune_list.num_ids = 0;             /* reset count */
          }
          if (!is_volume_purged(ua, &lmr)) {
-            Dmsg1(100, "Vol=%s not pruned\n", lmr.VolumeName);
+            Dmsg1(050, "Vol=%s not pruned\n", lmr.VolumeName);
             continue;
          }
+         Dmsg1(050, "Vol=%s is purged\n", lmr.VolumeName);
 
          /*
           * Since we are also pruning the Scratch pool, continue
@@ -217,8 +224,6 @@ void prune_volumes(JCR *jcr, bool InChanger, MEDIA_DBR *mr)
             memcpy(mr, &lmr, sizeof(lmr));
             break;                        /* got a volume */
          }
-      } else {
-         Dmsg2(100, "Nothing pruned MediaId=%d Volume=%s\n", (int)lmr.MediaId, lmr.VolumeName);
       }
    }