From a23454fe26df0e2c0151cb73d4cfc0449a237e2a Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Wed, 2 Jul 2008 20:49:44 +0000 Subject: [PATCH] kes Fix mtx-changer to detect both versions of Ubuntu (Debian) mt. This fixes bug #1116. kes Fix failure of 2drive-concurrent-test. Always read label; clear_unload() only after drive is defined in acquire_for_read(). git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/branches/Branch-2.4@7291 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/scripts/mtx-changer.in | 12 ++++++++---- bacula/src/stored/acquire.c | 3 ++- bacula/src/stored/autochanger.c | 2 +- bacula/src/stored/job.c | 8 ++++++-- bacula/src/stored/label.c | 2 ++ bacula/src/stored/reserve.c | 5 +++++ bacula/src/version.h | 6 +++--- bacula/technotes-2.4 | 6 ++++++ 8 files changed, 33 insertions(+), 11 deletions(-) diff --git a/bacula/scripts/mtx-changer.in b/bacula/scripts/mtx-changer.in index 1dbc5b410f..7333bc5483 100644 --- a/bacula/scripts/mtx-changer.in +++ b/bacula/scripts/mtx-changer.in @@ -55,6 +55,8 @@ MTX=@MTX@ # Note Debian has a different mt than the standard Linux version. # When no tape is in the drive it waits 2 minutes. # When a tape is in the drive, it prints user unfriendly output. +# Note, with Ubuntu Gusty (8.04), there are two versions of mt, +# so we attempt to figure out which one. # OS=`uname` @@ -66,10 +68,12 @@ case ${OS} in ready="Current Driver State: at rest." ;; Linux) - if test -e /etc/debian_version ; then - ready="drive status" - else - ready="ONLINE" + ready="ONLINE" + if test -f /etc/debian_version ; then + mt --version|grep "mt-st" >/dev/null 2>&1 + if test $? -eq 1 ; then + ready="drive status" + fi fi ;; esac diff --git a/bacula/src/stored/acquire.c b/bacula/src/stored/acquire.c index 42f15bd765..4af83a3343 100644 --- a/bacula/src/stored/acquire.c +++ b/bacula/src/stored/acquire.c @@ -70,7 +70,6 @@ bool acquire_device_for_read(DCR *dcr) dev->num_writers, jcr->JobId); goto get_out; } - dev->clear_unload(); /* Find next Volume, if any */ vol = jcr->VolList; @@ -173,6 +172,8 @@ bool acquire_device_for_read(DCR *dcr) } } + dev->clear_unload(); + if (reserve_volume(dcr, dcr->VolumeName) == NULL) { Dmsg2(100, "Could not reserve volume %s on %s\n", dcr->VolumeName, dcr->dev->print_name()); diff --git a/bacula/src/stored/autochanger.c b/bacula/src/stored/autochanger.c index a8afe572c4..b00c643632 100644 --- a/bacula/src/stored/autochanger.c +++ b/bacula/src/stored/autochanger.c @@ -118,7 +118,7 @@ int autoload_device(DCR *dcr, int writing, BSOCK *dir) POOLMEM *changer; if (!dev->is_autochanger()) { - Dmsg0(100, "ChangerCommand=0, virtual disk changer\n"); + Dmsg1(100, "Device %s is not an autochanger\n", dev->print_name()); return 0; } diff --git a/bacula/src/stored/job.c b/bacula/src/stored/job.c index e18d41c7ee..10443ceb5f 100644 --- a/bacula/src/stored/job.c +++ b/bacula/src/stored/job.c @@ -220,10 +220,14 @@ void handle_filed_connection(BSOCK *fd, char *job_name) { JCR *jcr; - bmicrosleep(0, 50000); /* wait 50 millisecs */ +/* + * With the following bmicrosleep on, running the + * SD under the debugger fails. + */ +// bmicrosleep(0, 50000); /* wait 50 millisecs */ if (!(jcr=get_jcr_by_full_name(job_name))) { Jmsg1(NULL, M_FATAL, 0, _("FD connect failed: Job name not found: %s\n"), job_name); - Dmsg1(3, "**** Job \"%s\" not found", job_name); + Dmsg1(3, "**** Job \"%s\" not found\n", job_name); return; } diff --git a/bacula/src/stored/label.c b/bacula/src/stored/label.c index da90a41fb0..e2b9f548ea 100644 --- a/bacula/src/stored/label.c +++ b/bacula/src/stored/label.c @@ -85,6 +85,7 @@ int read_dev_volume_label(DCR *dcr) return VOL_IO_ERROR; } } +#ifdef xxx if (dev->is_labeled()) { /* did we already read label? */ /* Compare Volume Names allow special wild card */ if (VolName && *VolName && *VolName != '*' && strcmp(dev->VolHdr.VolumeName, VolName) != 0) { @@ -104,6 +105,7 @@ int read_dev_volume_label(DCR *dcr) Dmsg0(130, "Leave read_volume_label() VOL_OK\n"); return VOL_OK; /* label already read */ } +#endif dev->clear_labeled(); dev->clear_append(); diff --git a/bacula/src/stored/reserve.c b/bacula/src/stored/reserve.c index 929ba8e86a..adc3bfaa85 100644 --- a/bacula/src/stored/reserve.c +++ b/bacula/src/stored/reserve.c @@ -1100,6 +1100,11 @@ int search_res_for_device(RCTX &rctx) if (strcmp(rctx.device_name, changer->hdr.name) == 0) { /* Try each device in this AutoChanger */ foreach_alist(rctx.device, changer->device) { + if (!rctx.device->autoselect) { + Dmsg1(100, "Device %s not autoselect skipped.\n", + rctx.device->hdr.name); + continue; /* device is not available */ + } Dmsg2(dbglvl, "jid=%u Try changer device %s\n", (int)rctx.jcr->JobId, rctx.device->hdr.name); stat = reserve_device(rctx); diff --git a/bacula/src/version.h b/bacula/src/version.h index 9644e97064..f2ce173d8c 100644 --- a/bacula/src/version.h +++ b/bacula/src/version.h @@ -3,9 +3,9 @@ */ #undef VERSION -#define VERSION "2.4.1-b1" -#define BDATE "01 July 2008" -#define LSMDATE "01Jul08" +#define VERSION "2.4.1-b2" +#define BDATE "02 July 2008" +#define LSMDATE "02Jul08" #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.4 b/bacula/technotes-2.4 index a5a579f4f4..cee3704066 100644 --- a/bacula/technotes-2.4 +++ b/bacula/technotes-2.4 @@ -1,6 +1,12 @@ Technical notes on version 2.4 General: +02Jul08 +kes Fix mtx-changer to detect both versions of Ubuntu (Debian) + mt. This fixes bug #1116. +kes Fix failure of 2drive-concurrent-test. Always read label; + clear_unload() only after drive is defined in acquire_for_read(). + Release Beta version 2.4.1-b1 01Jul08 kes Back out bad src/lib/base64.c change. -- 2.39.5