From 4d00a7b35d00e2772e9d77ae5e7d7a64bc9130fd Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Fri, 30 May 2008 18:31:33 +0000 Subject: [PATCH] Fix multiple media restore. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@7062 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/stored/acquire.c | 27 +++++++++++++++------------ bacula/technotes-2.3 | 1 + 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/bacula/src/stored/acquire.c b/bacula/src/stored/acquire.c index 680db29594..37ff22cbee 100644 --- a/bacula/src/stored/acquire.c +++ b/bacula/src/stored/acquire.c @@ -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); diff --git a/bacula/technotes-2.3 b/bacula/technotes-2.3 index b3d7641eea..917c750d2b 100644 --- a/bacula/technotes-2.3 +++ b/bacula/technotes-2.3 @@ -25,6 +25,7 @@ Add long term statistics job table 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. -- 2.39.5