From c18e689bdc00f0d8bbe83bf32ace6e61d0af9f3f Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Fri, 11 Apr 2008 09:36:22 +0000 Subject: [PATCH] Improve algorithm for detecting pre-reserved volume and swapping volumes. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@6795 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/stored/mount.c | 23 ++++++++++++++++------- bacula/src/version.h | 4 ++-- bacula/technotes-2.3 | 3 +++ 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/bacula/src/stored/mount.c b/bacula/src/stored/mount.c index 08b0b33d47..1edab43492 100644 --- a/bacula/src/stored/mount.c +++ b/bacula/src/stored/mount.c @@ -120,19 +120,28 @@ mount_next_vol: unload_dev(dcr, swap_dev); swap_dev = NULL; dev->vol->clear_swapping(); + dev->VolHdr.VolumeName[0] = 0; /* don't yet have right Volume */ } if (!is_suitable_volume_mounted()) { + bool have_vol = false; + /* Do we have a candidate volume? */ + if (dev->vol) { + bstrncpy(VolumeName, dev->vol->vol_name, sizeof(VolumeName)); + have_vol = dir_get_volume_info(this, GET_VOL_INFO_FOR_WRITE); + } /* * Get Director's idea of what tape we should have mounted. * in dcr->VolCatInfo */ - Dmsg0(200, "Before dir_find_next_appendable_volume.\n"); - while (!dir_find_next_appendable_volume(dcr)) { - Dmsg0(200, "not dir_find_next\n"); - if (!dir_ask_sysop_to_create_appendable_volume(dcr)) { - goto bail_out; - } - Dmsg0(200, "Again dir_find_next_append...\n"); + if (!have_vol) { + Dmsg0(200, "Before dir_find_next_appendable_volume.\n"); + while (!dir_find_next_appendable_volume(dcr)) { + Dmsg0(200, "not dir_find_next\n"); + if (job_canceled(jcr) || !dir_ask_sysop_to_create_appendable_volume(dcr)) { + goto bail_out; + } + Dmsg0(200, "Again dir_find_next_append...\n"); + } } } if (job_canceled(jcr)) { diff --git a/bacula/src/version.h b/bacula/src/version.h index 4029714c26..1397b455bc 100644 --- a/bacula/src/version.h +++ b/bacula/src/version.h @@ -4,8 +4,8 @@ #undef VERSION #define VERSION "2.3.18" -#define BDATE "10 April 2008" -#define LSMDATE "10Apr08" +#define BDATE "11 April 2008" +#define LSMDATE "11Apr08" #define PROG_COPYRIGHT "Copyright (C) %d-2008 Free Software Foundation Europe e.V.\n" #define BYEAR "2008" /* year for copyright messages in progs */ diff --git a/bacula/technotes-2.3 b/bacula/technotes-2.3 index a4fb85ceb8..fa0415574b 100644 --- a/bacula/technotes-2.3 +++ b/bacula/technotes-2.3 @@ -24,6 +24,9 @@ Add long term statistics job table General: +11Apr08 +kes Improve algorithm for detecting pre-reserved volume and + swapping volumes. 10Apr08 kes Tweak volume swapping code so it works. kes Correct name overloading in mount.c -- 2.39.5