]> git.sur5r.net Git - bacula/bacula/blob - bacula/patches/testing/next_vol.patch
ebl Add the -B option that extract Catalog configuration from
[bacula/bacula] / bacula / patches / testing / next_vol.patch
1 Index: src/dird/next_vol.c
2 ===================================================================
3 --- src/dird/next_vol.c (revision 7259)
4 +++ src/dird/next_vol.c (working copy)
5 @@ -94,28 +94,30 @@
6                  */
7                 if (prune) {
8                    Dmsg0(150, "Call prune_volumes\n");
9 -                  prune_volumes(jcr, InChanger, mr);
10 +                  ok = prune_volumes(jcr, InChanger, mr);
11                 }
12 -               ok = recycle_oldest_purged_volume(jcr, InChanger, mr);
13 -               if (!ok && create) {
14 -                  Dmsg4(050, "after prune volumes_vol ok=%d index=%d InChanger=%d Vstat=%s\n",
15 -                        ok, index, InChanger, mr->VolStatus);
16 -                  /*
17 -                   * 5. Try pulling a volume from the Scratch pool
18 -                   */ 
19 -                  ok = get_scratch_volume(jcr, InChanger, mr);
20 -               }
21 -               /*
22 -                * If we are using an Autochanger and have not found
23 -                * a volume, retry looking for any volume. 
24 -                */
25 -               if (InChanger) {
26 -                  InChanger = false;
27 -                  if (!ok) {
28 -                     continue;           /* retry again accepting any volume */
29 -                  }
30 -               }
31 -            }
32 +              if (!ok) {
33 +                 ok = recycle_oldest_purged_volume(jcr, InChanger, mr);
34 +                 if (!ok && create) {
35 +                    Dmsg4(050, "after prune volumes_vol ok=%d index=%d InChanger=%d Vstat=%s\n",
36 +                          ok, index, InChanger, mr->VolStatus);
37 +                    /*
38 +                     * 5. Try pulling a volume from the Scratch pool
39 +                     */ 
40 +                    ok = get_scratch_volume(jcr, InChanger, mr);
41 +                    Dmsg4(050, "after get scratch volume ok=%d index=%d InChanger=%d Vstat=%s\n",
42 +                          ok, index, InChanger, mr->VolStatus);
43 +                 }
44 +                 /*
45 +                  * If we are using an Autochanger and have not found
46 +                  * a volume, retry looking for any volume. 
47 +                  */
48 +                 if (!ok && InChanger) {
49 +                    InChanger = false;
50 +                    continue;           /* retry again accepting any volume */
51 +                 }
52 +              }
53 +           }
54           }
55  
56  
57 Index: src/dird/autoprune.c
58 ===================================================================
59 --- src/dird/autoprune.c        (revision 7259)
60 +++ src/dird/autoprune.c        (working copy)
61 @@ -176,6 +176,17 @@
62              prune_list.num_ids = 0;             /* reset count */
63           }
64           ok = is_volume_purged(ua, &lmr);
65 +
66 +        /* 
67 +         * Check if this volume is available (InChanger + StorageId) 
68 +         * If not, just skip this volume and try the next one
69 +         */
70 +        if (ok && InChanger) {
71 +           if (!lmr.InChanger || (lmr.StorageId != mr->StorageId)) {
72 +              ok = false;              /* skip this volume, ie not loadable */
73 +           }
74 +        }
75 +
76           /*
77            * If purged and not moved to another Pool, 
78            *   then we stop pruning and take this volume.