X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=bacula%2Fsrc%2Fdird%2Fautoprune.c;h=df4cb5542db2150b1a15cf77cc5269423a87f35a;hb=c205f98aff775e96e18dc0af2f194e76f2ddaaa9;hp=9a91eb44e7bfc6cf30d1f054723d8baf561e6bed;hpb=365d4a362825518c48eeaa244a9b21d2a5f9cc2e;p=bacula%2Fbacula diff --git a/bacula/src/dird/autoprune.c b/bacula/src/dird/autoprune.c index 9a91eb44e7..df4cb5542d 100644 --- a/bacula/src/dird/autoprune.c +++ b/bacula/src/dird/autoprune.c @@ -190,9 +190,17 @@ bool prune_volumes(JCR *jcr, bool InChanger, MEDIA_DBR *mr) */ if (ok && lmr.PoolId == mr->PoolId) { Dmsg2(050, "Vol=%s MediaId=%d purged.\n", lmr.VolumeName, (int)lmr.MediaId); - mr = &lmr; /* struct copy */ - break; + mr = &lmr; /* struct copy */ + break; /* got a volume */ } + /* + * We purged something but did not get a volume in the current pool. + * It must be a scratch volume, so try to get it. + */ + if (ok && get_scratch_volume(jcr, InChanger, mr)) { + break; /* got a volume */ + } + ok = false; /* clear OK, in case we fall out */ } else { Dmsg2(050, "Nothing pruned MediaId=%d Volume=%s\n", (int)lmr.MediaId, lmr.VolumeName); }