From: Kern Sibbald Date: Thu, 3 Apr 2008 20:15:16 +0000 (+0000) Subject: Implement unload_dev() before swap device. X-Git-Tag: Release-7.0.0~4763 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=a91d82fcba63b32f59b077b132414d2e67e011db;p=bacula%2Fbacula Implement unload_dev() before swap device. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@6737 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/src/stored/autochanger.c b/bacula/src/stored/autochanger.c index 1a22132784..3416c63291 100644 --- a/bacula/src/stored/autochanger.c +++ b/bacula/src/stored/autochanger.c @@ -1,7 +1,7 @@ /* Bacula® - The Network Backup Solution - Copyright (C) 2002-2007 Free Software Foundation Europe e.V. + Copyright (C) 2002-2008 Free Software Foundation Europe e.V. The main author of Bacula is Kern Sibbald, with contributions from many others, a complete list can be found in the file AUTHORS. @@ -416,6 +416,14 @@ static bool unload_other_drive(DCR *dcr, int slot) } break; } + if (dev->is_busy()) { + Jmsg(dcr->jcr, M_WARNING, 0, _("Volume \"%s\" is in use by device %s\n"), + dcr->VolumeName, dev->print_name()); + Dmsg4(100, "Vol %s for dev=%s is busy dev=%s slot=%d\n", + dcr->VolumeName, dcr->dev->print_name(), dev->print_name(), dev->Slot); + Dmsg2(100, "num_writ=%d reserv=%d\n", dev->num_writers, dev->reserved_device); + return false; + } return unload_dev(dcr, dev); } @@ -432,15 +440,6 @@ bool unload_dev(DCR *dcr, DEVICE *dev) return false; } dev->dlock(); - if (dev->is_busy()) { - Jmsg(jcr, M_WARNING, 0, _("Volume \"%s\" is in use by device %s\n"), - dcr->VolumeName, dev->print_name()); - Dmsg4(100, "Vol %s for dev=%s is busy dev=%s slot=%d\n", - dcr->VolumeName, dcr->dev->print_name(), dev->print_name(), dev->Slot); - Dmsg2(100, "num_writ=%d reserv=%d\n", dev->num_writers, dev->reserved_device); - dev->dunlock(); - return false; - } POOLMEM *changer_cmd = get_pool_memory(PM_FNAME); POOL_MEM results(PM_MESSAGE); diff --git a/bacula/src/stored/reserve.c b/bacula/src/stored/reserve.c index 881a5a751d..0d5df442a8 100644 --- a/bacula/src/stored/reserve.c +++ b/bacula/src/stored/reserve.c @@ -390,6 +390,10 @@ VOLRES *reserve_volume(DCR *dcr, const char *VolumeName) bstrncpy(dcr->VolumeName, VolumeName, sizeof(dcr->VolumeName)); #else if (!vol->dev->is_busy()) { + if (vol->dev->Slot > 0) { + Dmsg1(dbglvl, "Unload dev=%s\n", vol->dev->print_name()); + unload_dev(dcr, vol->dev); + } /* OK to move it -- I'm not sure this will work */ Dmsg3(dbglvl, "==== Swap vol=%s from dev=%s to %s\n", VolumeName, vol->dev->print_name(), dev->print_name()); diff --git a/bacula/technotes-2.3 b/bacula/technotes-2.3 index fbb40d2fe2..4695dc7f03 100644 --- a/bacula/technotes-2.3 +++ b/bacula/technotes-2.3 @@ -25,6 +25,7 @@ Add long term statistics job table General: 03Apr08 +kes Implement unload_dev() before swap device. ebl Add statistics prunning with option and menu kes Separate unload_dev() from unload_other_device() in autochanger.c 02Apr08