from one drive to another.
kes Enhance disk-changer to detect most error conditions.
kes Fix SD code so that it properly swaps a Volume between drives.
This fixes bug #1083.
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@6881
91ce42f0-d328-0410-95d8-
f526ca767f89
Priority:
================
Priority:
================
+- Check for FD compatibility -- eg .nobackup ...
- Re-check new dcr->reserved_volume
- Softlinks that point to non-existent file are not restored in restore all,
but are restored if the file is individually selected. BUG!
- Re-check new dcr->reserved_volume
- Softlinks that point to non-existent file are not restored in restore all,
but are restored if the file is individually selected. BUG!
#
# Written by Kern Sibbald
#
#
# Written by Kern Sibbald
#
-# Copyright (C) 2000-2007 Free Software Foundation Europe e.V.
+# Copyright (C) 2000-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.
#
# The main author of Bacula is Kern Sibbald, with contributions from
# many others, a complete list can be found in the file AUTHORS.
unload)
debug "Doing disk -f $ctl unload $slot $device $drive"
get_dir
unload)
debug "Doing disk -f $ctl unload $slot $device $drive"
get_dir
- ld=`cat $dir/loaded${drive}`
+ if [ -f $dir/loaded${drive} ]; then
+ ld=`cat $dir/loaded${drive}`
+ else
+ echo "Storage Element $slot is Already Full"
+ exit 1
+ fi
if [ $slot -eq $ld ]; then
echo "0" >$dir/loaded${drive}
unlink $device 2>/dev/null >/dev/null
if [ $slot -eq $ld ]; then
echo "0" >$dir/loaded${drive}
unlink $device 2>/dev/null >/dev/null
load)
debug "Doing disk $ctl load $slot $device $drive"
get_dir
load)
debug "Doing disk $ctl load $slot $device $drive"
get_dir
+ i=0
+ while [ $i -le $maxdrive ]; do
+ if [ -f $dir/loaded${i} ]; then
+ ld=`cat $dir/loaded${i}`
+ else
+ ld=0
+ fi
+ if [ $ld -eq $slot ]; then
+ echo "Drive ${i} Full (Storage element ${ld} loaded)"
+ exit 1
+ fi
+ i=`expr $i + 1`
+ done
if [ -f $dir/loaded${drive} ]; then
ld=`cat $dir/loaded${drive}`
else
ld=0
fi
if [ -f $dir/loaded${drive} ]; then
ld=`cat $dir/loaded${drive}`
else
ld=0
fi
- if [ $ld -eq 0 ]; then
- echo "0" >$dir/loaded${drive}
- unlink $device 2>/dev/null >/dev/null
- rm -f $device
- ln -s $dir/slot${slot} $device
- rtn=$?
- if [ $rtn -eq 0 ]; then
- echo $slot >$dir/loaded${drive}
- fi
- exit $rtn
- else
echo "Drive ${drive} Full (Storage element ${ld} loaded)"
exit 1
fi
echo "Drive ${drive} Full (Storage element ${ld} loaded)"
exit 1
fi
+ echo "0" >$dir/loaded${drive}
+ unlink $device 2>/dev/null >/dev/null
+ rm -f $device
+ ln -s $dir/slot${slot} $device
+ rtn=$?
+ if [ $rtn -eq 0 ]; then
+ echo $slot >$dir/loaded${drive}
+ fi
+ exit $rtn
class VOLRES {
bool m_swapping; /* set when swapping to another drive */
bool m_in_use; /* set when volume reserved or in use */
class VOLRES {
bool m_swapping; /* set when swapping to another drive */
bool m_in_use; /* set when volume reserved or in use */
+ int32_t m_slot; /* slot of swapping volume */
public:
dlink link;
char *vol_name; /* Volume name */
public:
dlink link;
char *vol_name; /* Volume name */
bool is_in_use() const { return m_in_use; };
void set_in_use() { m_in_use = true; };
void clear_in_use() { m_in_use = false; };
bool is_in_use() const { return m_in_use; };
void set_in_use() { m_in_use = true; };
void clear_in_use() { m_in_use = false; };
+ void set_slot(int32_t slot) { m_slot = slot; };
+ int32_t get_slot() const { return m_slot; };
autochanger = false;
VolCatInfo.Slot = 0;
}
autochanger = false;
VolCatInfo.Slot = 0;
}
- Dmsg1(200, "autoload_dev returns %d\n", autochanger);
+ Dmsg1(150, "autoload_dev returns %d\n", autochanger);
/*
* If we autochanged to correct Volume or (we have not just
* released the Volume AND we can automount) we go ahead
/*
* If we autochanged to correct Volume or (we have not just
* released the Volume AND we can automount) we go ahead
void DCR::do_swapping()
{
if (dev->must_unload()) {
void DCR::do_swapping()
{
if (dev->must_unload()) {
- Dmsg0(150, "mount_next_volume release=1\n");
+ Dmsg1(100, "swapping: unloading %s\n", dev->print_name());
unload_autochanger(this, -1);
release_volume();
dev->clear_unload();
unload_autochanger(this, -1);
release_volume();
dev->clear_unload();
* volume to our drive.
*/
if (dev->swap_dev) {
* volume to our drive.
*/
if (dev->swap_dev) {
- Dmsg1(100, "Swap unloading %s\n", dev->swap_dev->print_name());
if (dev->swap_dev->must_unload()) {
if (dev->swap_dev->must_unload()) {
+ if (dev->vol) {
+ dev->Slot = dev->vol->get_slot();
+ }
+ Dmsg2(100, "Swap unloading slot=%d %s\n", dev->Slot,
+ dev->swap_dev->print_name());
unload_dev(this, dev->swap_dev);
unload_dev(this, dev->swap_dev);
}
if (dev->vol) {
dev->vol->clear_swapping();
}
if (dev->vol) {
dev->vol->clear_swapping();
dev->swap_dev = NULL;
}
if (dev->must_load()) {
dev->swap_dev = NULL;
}
if (dev->must_load()) {
+ Dmsg1(100, "swapping: must load %s\n", dev->print_name());
dev->clear_load();
dev->clear_volhdr(); /* force "load" */
}
dev->clear_load();
dev->clear_volhdr(); /* force "load" */
}
if (dev != vol->dev) {
/* Caller wants to switch Volume to another device */
if (!vol->dev->is_busy() && !vol->is_swapping()) {
if (dev != vol->dev) {
/* Caller wants to switch Volume to another device */
if (!vol->dev->is_busy() && !vol->is_swapping()) {
Dmsg3(dbglvl, "==== Swap vol=%s from dev=%s to %s\n",
VolumeName, vol->dev->print_name(), dev->print_name());
free_volume(dev); /* free any volume attached to our drive */
Dmsg3(dbglvl, "==== Swap vol=%s from dev=%s to %s\n",
VolumeName, vol->dev->print_name(), dev->print_name());
free_volume(dev); /* free any volume attached to our drive */
+ dcr->dev = vol->dev; /* temp point to other dev */
+ slot = get_autochanger_loaded_slot(dcr); /* get slot */
+ dcr->dev = dev; /* restore dev */
+ vol->set_slot(slot); /* save slot */
vol->dev->set_unload(); /* unload the other drive */
vol->set_swapping(); /* swap from other drive */
dev->swap_dev = vol->dev; /* remember to get this vol */
vol->dev->set_unload(); /* unload the other drive */
vol->set_swapping(); /* swap from other drive */
dev->swap_dev = vol->dev; /* remember to get this vol */
- vol->dev->set_load(); /* then reload on our drive */
+ dev->set_load(); /* then reload on our drive */
vol->dev->vol = NULL; /* remove volume from other drive */
vol->dev = dev; /* point the Volume at our drive */
dev->vol = vol; /* point our drive at the Volume */
vol->dev->vol = NULL; /* remove volume from other drive */
vol->dev = dev; /* point the Volume at our drive */
dev->vol = vol; /* point our drive at the Volume */
- * We reserve the device for appending by incrementing the
- * reserved_device. We do virtually all the same work that
+ * We reserve the device for appending by incrementing
+ * num_reserved(). We do virtually all the same work that
* is done in acquire_device_for_append(), but we do
* not attempt to mount the device. This routine allows
* the DIR to reserve multiple devices before *really*
* is done in acquire_device_for_append(), but we do
* not attempt to mount the device. This routine allows
* the DIR to reserve multiple devices before *really*
-#define VERSION "2.3.19"
-#define BDATE "02 May 2008"
-#define LSMDATE "02May08"
+#define VERSION "2.3.20"
+#define BDATE "03 May 2008"
+#define LSMDATE "03May08"
#define PROG_COPYRIGHT "Copyright (C) %d-2008 Free Software Foundation Europe e.V.\n"
#define BYEAR "2008" /* year for copyright messages in progs */
#define PROG_COPYRIGHT "Copyright (C) %d-2008 Free Software Foundation Europe e.V.\n"
#define BYEAR "2008" /* year for copyright messages in progs */
+03May08
+kes Implement regression that explicitly tests swapping a Volume
+ from one drive to another.
+kes Enhance disk-changer to detect most error conditions.
+kes Fix SD code so that it properly swaps a Volume between drives.
+ This fixes bug #1083.
02May08
kes Apply libdbi patch from Joao Freitas for regress and for
Bacula trunk. Regress now works with libdbi. Nice.
02May08
kes Apply libdbi patch from Joao Freitas for regress and for
Bacula trunk. Regress now works with libdbi. Nice.