}
Dmsg2(dbglvl, "reserve_vol free vol=%s at %p\n", vol->vol_name, vol->vol_name);
free_volume(dev);
}
Dmsg2(dbglvl, "reserve_vol free vol=%s at %p\n", vol->vol_name, vol->vol_name);
free_volume(dev);
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 */
+// volume_unused(dcr);
+ dev->set_unload(); /* Unload any volume that is on our drive */
+ dcr->dev = vol->dev; /* temp point to other dev */
+ slot = get_autochanger_loaded_slot(dcr); /* get slot on other drive */
+ 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->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 */
- Dmsg2(dbglvl, "=== free_volume %s dev=%s\n", vol->vol_name, dev->print_name());
+ Dmsg2(dbglvl, "=== remove volume %s dev=%s\n", vol->vol_name, dev->print_name());
Dmsg0(dbglvl, "deleted temp vol list\n");
Dmsg0(dbglvl, "unlock volumes\n");
unlock_volumes();
Dmsg0(dbglvl, "deleted temp vol list\n");
Dmsg0(dbglvl, "unlock volumes\n");
unlock_volumes();
- * 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*
/* Changing pool, unload old tape if any in drive */
Dmsg0(dbglvl, "OK dev: num_writers=0, not reserved, pool change, unload changer\n");
/* ***FIXME*** use set_unload() */
/* Changing pool, unload old tape if any in drive */
Dmsg0(dbglvl, "OK dev: num_writers=0, not reserved, pool change, unload changer\n");
/* ***FIXME*** use set_unload() */