From 022a6c259ceb8056310be6cb773bbbc4911a3204 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Mon, 10 Mar 2008 22:01:49 +0000 Subject: [PATCH] kes Make ask_sysop_to_create... to return if waken from wait. This helps get out of blocked conditions. kes Experimental implementation of switch_device in reservations. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@6578 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/stored/askdir.c | 1 + bacula/src/stored/label.c | 3 +-- bacula/src/stored/reserve.c | 5 +++++ bacula/technotes-2.3 | 3 +++ 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/bacula/src/stored/askdir.c b/bacula/src/stored/askdir.c index 5b14f360de..a6767897be 100644 --- a/bacula/src/stored/askdir.c +++ b/bacula/src/stored/askdir.c @@ -534,6 +534,7 @@ bool dir_ask_sysop_to_create_appendable_volume(DCR *dcr) return false; } Dmsg1(100, "Someone woke me for device %s\n", dev->print_name()); + break; } set_jcr_job_status(jcr, JS_Running); dir_send_job_status(jcr); diff --git a/bacula/src/stored/label.c b/bacula/src/stored/label.c index 115f7ae0d1..18b1aaa7b5 100644 --- a/bacula/src/stored/label.c +++ b/bacula/src/stored/label.c @@ -339,7 +339,6 @@ bool write_new_volume_label_to_dev(DCR *dcr, const char *VolName, } Dmsg1(150, "Label type=%d\n", dev->label_type); if (!dev->rewind(dcr)) { - dev->clear_volhdr(); Dmsg2(130, "Bad status on %s from rewind: ERR=%s\n", dev->print_name(), dev->print_errmsg()); if (!forge_on) { goto bail_out; @@ -602,7 +601,7 @@ void create_volume_label(DEVICE *dev, const char *VolName, ASSERT(dev != NULL); - dev->clear_volhdr(); /* release any old volume */ + dev->clear_volhdr(); /* clear any old volume info */ bstrncpy(dev->VolHdr.Id, BaculaId, sizeof(dev->VolHdr.Id)); dev->VolHdr.VerNum = BaculaTapeVersion; diff --git a/bacula/src/stored/reserve.c b/bacula/src/stored/reserve.c index 7ae826b999..06d55b348c 100644 --- a/bacula/src/stored/reserve.c +++ b/bacula/src/stored/reserve.c @@ -53,6 +53,7 @@ static bool reserve_device_for_append(DCR *dcr, RCTX &rctx); static bool use_storage_cmd(JCR *jcr); static void queue_reserve_message(JCR *jcr); static void pop_reserve_messages(JCR *jcr); +void switch_device(DCR *dcr, DEVICE *dev); /* Requests from the Director daemon */ static char use_storage[] = "use storage=%127s media_type=%127s " @@ -379,6 +380,9 @@ VOLRES *reserve_volume(DCR *dcr, const char *VolumeName) /* Check if we are trying to use the Volume on a different drive */ if (dev != vol->dev) { /* Caller wants to switch Volume to another device */ + switch_device(dcr, vol->dev); + dev = vol->dev; +#ifdef xxx if (!vol->dev->is_busy()) { /* OK to move it -- I'm not sure this will work */ Dmsg3(dbglvl, "==== Swap vol=%s from dev=%s to %s\n", VolumeName, @@ -394,6 +398,7 @@ VOLRES *reserve_volume(DCR *dcr, const char *VolumeName) vol = NULL; /* device busy */ goto get_out; } +#endif } } dev->vol = vol; diff --git a/bacula/technotes-2.3 b/bacula/technotes-2.3 index 3c4a0c7d43..c8de57138b 100644 --- a/bacula/technotes-2.3 +++ b/bacula/technotes-2.3 @@ -2,6 +2,9 @@ General: 10Mar08 +kes Make ask_sysop_to_create... to return if waken from wait. + This helps get out of blocked conditions. +kes Experimental implementation of switch_device in reservations. kes Implement FD version to allow easier protocol changes. kes Add Plugin Options string -- not yet passed to FD. kes Implement PluginOptions ACL. -- 2.39.5