]> git.sur5r.net Git - bacula/bacula/commitdiff
Fix multiple media restore.
authorKern Sibbald <kern@sibbald.com>
Fri, 30 May 2008 18:31:57 +0000 (18:31 +0000)
committerKern Sibbald <kern@sibbald.com>
Fri, 30 May 2008 18:31:57 +0000 (18:31 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/branches/Branch-2.2@7063 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/src/stored/acquire.c
bacula/technotes-2.1

index 680db29594e57926497d522e5017948f6788cee6..37ff22cbee26f1d0a3c6a0acd405ade6b9d7083e 100644 (file)
@@ -97,18 +97,6 @@ bool acquire_device_for_read(DCR *dcr)
    bstrncpy(dcr->media_type, vol->MediaType, sizeof(dcr->media_type));
    dcr->VolCatInfo.Slot = vol->Slot;
    dcr->VolCatInfo.InChanger = vol->Slot > 0; 
-   if (reserve_volume(dcr, dcr->VolumeName) == NULL) {
-      Dmsg2(100, "Could not reserve volume %s on %s\n", dcr->VolumeName,
-            dcr->dev->print_name());
-      Jmsg2(jcr, M_FATAL, 0, _("Could not reserve volume %s on %s\n"), dcr->VolumeName,
-            dcr->dev->print_name());
-      goto get_out;
-   }
-   if (dev->vol && dev->vol->is_swapping()) {
-      dev->vol->set_slot(vol->Slot);
-      Dmsg3(100, "swapping: slot=%d Vol=%s dev=%s\n", dev->vol->get_slot(),
-         dev->vol->vol_name, dev->print_name());
-   }
     
    /*
     * If the MediaType requested for this volume is not the
@@ -169,8 +157,10 @@ bool acquire_device_for_read(DCR *dcr)
          Dmsg1(50, "Media Type change.  New device %s chosen.\n", dev->print_name());
 
          bstrncpy(dcr->VolumeName, vol->VolumeName, sizeof(dcr->VolumeName));
+         bstrncpy(dcr->VolCatInfo.VolCatName, vol->VolumeName, sizeof(dcr->VolCatInfo.VolCatName));
          bstrncpy(dcr->media_type, vol->MediaType, sizeof(dcr->media_type));
          dcr->VolCatInfo.Slot = vol->Slot;
+         dcr->VolCatInfo.InChanger = vol->Slot > 0; 
          bstrncpy(dcr->pool_name, store->pool_name, sizeof(dcr->pool_name));
          bstrncpy(dcr->pool_type, store->pool_type, sizeof(dcr->pool_type));
       } else {
@@ -182,6 +172,19 @@ bool acquire_device_for_read(DCR *dcr)
       }
    }
 
+   if (reserve_volume(dcr, dcr->VolumeName) == NULL) {
+      Dmsg2(100, "Could not reserve volume %s on %s\n", dcr->VolumeName,
+            dcr->dev->print_name());
+      Jmsg2(jcr, M_FATAL, 0, _("Could not reserve volume %s on %s\n"), dcr->VolumeName,
+            dcr->dev->print_name());
+      goto get_out;
+   }
+   if (dev->vol && dev->vol->is_swapping()) {
+      dev->vol->set_slot(vol->Slot);
+      Dmsg3(100, "swapping: slot=%d Vol=%s dev=%s\n", dev->vol->get_slot(),
+         dev->vol->vol_name, dev->print_name());
+   }
+
 
    init_device_wait_timers(dcr);
 
index f1b0aa960f57eb67ef26543fcb8ce92694de3e48..db869752951a9fc6727bb4465279721200bcbfa9 100644 (file)
@@ -2,6 +2,7 @@
 
 General:
 30May08
+kes  Fix multiple media restore.
 kes  Make DEVICE Slot private and access it via a method.
      Allows better control over when it is set and cleared.
 kes  Fix possible seg fault if SQL error.