]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/dird/autoprune.c
ebl Add field to command list to restrict Runscript console
[bacula/bacula] / bacula / src / dird / autoprune.c
index df4cb5542db2150b1a15cf77cc5269423a87f35a..1eaaeb10d4dce743a1a155d0ded60fca8149285e 100644 (file)
@@ -20,7 +20,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   Bacula® is a registered trademark of John Walker.
+   Bacula® is a registered trademark of Kern Sibbald.
    The licensor of Bacula is the Free Software Foundation Europe
    (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
    Switzerland, email:ftf@fsfeurope.org.
@@ -61,7 +61,7 @@ void do_autoprune(JCR *jcr)
 
    if (jcr->job->PruneJobs || jcr->client->AutoPrune) {
       Jmsg(jcr, M_INFO, 0, _("Begin pruning Jobs.\n"));
-      prune_jobs(ua, client, jcr->JobType);
+      prune_jobs(ua, client, jcr->get_JobType());
       pruned = true;
    } else {
       pruned = false;
@@ -184,13 +184,24 @@ bool prune_volumes(JCR *jcr, bool InChanger, MEDIA_DBR *mr)
             prune_list.num_ids = 0;             /* reset count */
          }
          ok = is_volume_purged(ua, &lmr);
+
+         /*
+          * Check if this volume is available (InChanger + StorageId)
+          * If not, just skip this volume and try the next one
+          */
+         if (ok && InChanger) {
+            if (!lmr.InChanger || (lmr.StorageId != mr->StorageId)) {
+               ok = false;             /* skip this volume, ie not loadable */
+            }
+         }
+
          /*
           * If purged and not moved to another Pool, 
           *   then we stop pruning and take this volume.
           */
          if (ok && lmr.PoolId == mr->PoolId) {
             Dmsg2(050, "Vol=%s MediaId=%d purged.\n", lmr.VolumeName, (int)lmr.MediaId);
-            mr = &lmr;                    /* struct copy */
+            memcpy(mr, &lmr, sizeof(lmr));
             break;                        /* got a volume */
          }
          /*