From ce462cd94d90f4785b622cedc2ca48d616fe3f07 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Wed, 2 Jul 2008 20:41:34 +0000 Subject: [PATCH] kes Fix mtx-changer to detect both versions of Ubuntu (Debian) mt. This fixes bug #1116. kes Add const in python files to reduce compiler warnings. This may have to be backed out because of later compiler strict checking. 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/trunk@7289 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/scripts/mtx-changer.in | 16 ++++++++-------- bacula/src/dird/pythondir.c | 2 +- bacula/src/filed/pythonfd.c | 2 +- bacula/src/lib/pythonlib.c | 2 +- bacula/src/stored/acquire.c | 3 ++- bacula/src/stored/label.c | 2 ++ bacula/src/stored/pythonsd.c | 22 +++++++++++----------- bacula/src/version.h | 4 ++-- bacula/technotes-2.5 | 8 ++++++++ 9 files changed, 36 insertions(+), 25 deletions(-) diff --git a/bacula/scripts/mtx-changer.in b/bacula/scripts/mtx-changer.in index 1a5ecc578b..62b8707d8f 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" + if test $? -eq 1 ; then + ready="drive status" + fi fi ;; esac @@ -197,10 +201,6 @@ case $cmd in ${MTX} -f $ctl status >${TMPFILE} rtn=$? cat ${TMPFILE} | grep " Storage Element [0-9]*:.*Full" | awk "{print \$3 \$4}" | sed "s/Full *\(:VolumeTag=\)*//" - -# If you want/can use IMPORT/EXPORT slots as normal slots within bacula -# replace the previous line by this one -# sed "s/ IMPORT\/EXPORT//" "${TMPFILE}" | grep " Storage Element [0-9]*:.*Full" | awk "{print \$3 \$4}" | sed "s/Full *\(:VolumeTag=\)*//" # # If you have a VXA PacketLoader and the above does not work, try # turning it off and enabling the following line. diff --git a/bacula/src/dird/pythondir.c b/bacula/src/dird/pythondir.c index 16a20a007b..c8c9c463a9 100644 --- a/bacula/src/dird/pythondir.c +++ b/bacula/src/dird/pythondir.c @@ -67,7 +67,7 @@ PyMethodDef JobMethods[] = { struct s_vars { const char *name; - char *fmt; + const char *fmt; }; /* Read-only variables */ diff --git a/bacula/src/filed/pythonfd.c b/bacula/src/filed/pythonfd.c index 08b1736cde..ccdca4b75d 100644 --- a/bacula/src/filed/pythonfd.c +++ b/bacula/src/filed/pythonfd.c @@ -60,7 +60,7 @@ PyMethodDef JobMethods[] = { struct s_vars { const char *name; - char *fmt; + const char *fmt; }; /* Read-only variables */ diff --git a/bacula/src/lib/pythonlib.c b/bacula/src/lib/pythonlib.c index 133c88f7c0..bb1fb97949 100644 --- a/bacula/src/lib/pythonlib.c +++ b/bacula/src/lib/pythonlib.c @@ -1,7 +1,7 @@ /* Bacula® - The Network Backup Solution - Copyright (C) 2004-2007 Free Software Foundation Europe e.V. + Copyright (C) 2004-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. 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/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/pythonsd.c b/bacula/src/stored/pythonsd.c index 9bcfc1b8f4..95f4fef482 100644 --- a/bacula/src/stored/pythonsd.c +++ b/bacula/src/stored/pythonsd.c @@ -1,16 +1,7 @@ -/* - * - * Bacula interface to Python for the Storage Daemon - * - * Kern Sibbald, January MMV - * - * Version $Id$ - * - */ /* Bacula® - The Network Backup Solution - Copyright (C) 2005-2006 Free Software Foundation Europe e.V. + Copyright (C) 2005-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. @@ -34,6 +25,15 @@ (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich, Switzerland, email:ftf@fsfeurope.org. */ +/* + * + * Bacula interface to Python for the Storage Daemon + * + * Kern Sibbald, January MMV + * + * Version $Id$ + * + */ #include "bacula.h" @@ -59,7 +59,7 @@ PyMethodDef JobMethods[] = { struct s_vars { const char *name; - char *fmt; + const char *fmt; }; static struct s_vars getvars[] = { diff --git a/bacula/src/version.h b/bacula/src/version.h index 5cc00cb8e5..6c1ddaf4ea 100644 --- a/bacula/src/version.h +++ b/bacula/src/version.h @@ -4,8 +4,8 @@ #undef VERSION #define VERSION "2.5.1" -#define BDATE "27 June 2008" -#define LSMDATE "27Jun08" +#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.5 b/bacula/technotes-2.5 index 589c98c6c0..c5ffe9d42b 100644 --- a/bacula/technotes-2.5 +++ b/bacula/technotes-2.5 @@ -30,6 +30,14 @@ vtape driver General: +02Jul08 +kes Fix mtx-changer to detect both versions of Ubuntu (Debian) + mt. This fixes bug #1116. +kes Add const in python files to reduce compiler warnings. + This may have to be backed out because of later compiler + strict checking. +kes Fix failure of 2drive-concurrent-test. Always read label; + clear_unload() only after drive is defined in acquire_for_read(). 27Jun08 kes Generally clean up the manual tape loading code. The main conceptial change is that when a volume is marked to be unloaded, -- 2.39.5