]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
BEE Backport bacula/src/dird/autoprune.c
authorEric Bollengier <eric@baculasystems.com>
Fri, 24 Apr 2020 15:44:53 +0000 (17:44 +0200)
committerEric Bollengier <eric@baculasystems.com>
Thu, 29 Apr 2021 08:44:17 +0000 (10:44 +0200)
This commit is the result of the squash of the following main commits:

Author: Eric Bollengier <eric@baculasystems.com>
Date:   Fri May 17 16:58:03 2019 +0200

    Fix #5057 Block prune_volumes() with Director::Autoprune directive

Author: Eric Bollengier <eric@baculasystems.com>
Date:   Fri Dec 21 10:11:06 2018 +0100

    Add Director:Autoprune directive to control globally the autoprune feature

bacula/src/dird/autoprune.c

index 6e7f9e47978624c99ef3e27bc54ded8c372a48f1..4de567fe9aeeed8198c03abc6d0bb90b909a626a 100644 (file)
@@ -41,6 +41,11 @@ void do_autoprune(JCR *jcr)
    POOL *pool;
    bool pruned;
 
+   if (!director->AutoPrune) {
+      Dmsg0(100, "AutoPrune globally switched off\n");
+      return;
+   }
+
    if (!jcr->client) {                /* temp -- remove me */
       return;
    }
@@ -86,9 +91,14 @@ void prune_volumes(JCR *jcr, bool InChanger, MEDIA_DBR *mr,
 
    POOL_DBR spr;
 
+   if (!director->AutoPrune) {
+      Dmsg0(100, "AutoPrune globally switched off\n");
+      return;
+   }
+
    Dmsg1(100, "Prune volumes PoolId=%d\n", jcr->jr.PoolId);
    if (!jcr->job->PruneVolumes && !jcr->pool->AutoPrune) {
-      Dmsg0(100, "AutoPrune not set in Pool.\n");
+      Dmsg0(100, "AutoPrune not set in Pool or Job.\n");
       return;
    }