* This routine returns a 0 only if it is REALLY
* impossible to get the requested Volume.
*
+ * This routine is entered with the device blocked, but not
+ * locked.
+ *
*/
bool DCR::mount_next_write_volume()
{
ask = true; /* ask operator to mount tape */
do_find = true; /* re-find a volume after unload */
}
+ unlock_volumes();
do_unload();
do_swapping(true /*is_writing*/);
do_load(true /*is_writing*/);
+ lock_volumes();
if (do_find && !find_a_volume()) {
goto no_lock_bail_out;
* and move the tape to the end of data.
*
*/
+ unlock_volumes();
if (autoload_device(dcr, true/*writing*/, NULL) > 0) {
autochanger = true;
ask = false;
ask = retry >= 2;
do_find = true; /* do find_a_volume if we retry */
}
+ lock_volumes();
Dmsg1(150, "autoload_dev returns %d\n", autochanger);
/*
* If we autochanged to correct Volume or (we have not just
VolumeName);
if (!dev->eod(dcr)) {
+ Dmsg2(050, "Unable to position to end of data on device %s: ERR=%s\n",
+ dev->print_name(), dev->bstrerror());
Jmsg(jcr, M_ERROR, 0, _("Unable to position to end of data on device %s: ERR=%s\n"),
dev->print_name(), dev->bstrerror());
mark_volume_in_error();
goto mount_next_vol;
}
if (!is_eod_valid()) {
- Dmsg0(150, "goto mount_next_vol\n");
+ Dmsg0(100, "goto mount_next_vol\n");
goto mount_next_vol;
}
* This routine is meant to be called once the first pass
* to ensure that we have a candidate volume to mount.
* Otherwise, we ask the sysop to created one.
+ * Note, the the Volumes are locked on entry.
+ * They are unlocked on failure and remain locked on
+ * success. The caller must know this!!!
*/
bool DCR::find_a_volume()
{
" size=%s\n"), VolumeName,
edit_uint64(dev->VolCatInfo.VolCatBytes, ed1));
} else {
- Jmsg(jcr, M_ERROR, 0, _("Bacula cannot write on disk Volume \"%s\" because: "
+ Mmsg(jcr->errmsg, _("Bacula cannot write on disk Volume \"%s\" because: "
"The sizes do not match! Volume=%s Catalog=%s\n"),
VolumeName,
edit_uint64(pos, ed1),
edit_uint64(dev->VolCatInfo.VolCatBytes, ed2));
+ Jmsg(jcr, M_ERROR, 0, jcr->errmsg);
+ Dmsg0(050, jcr->errmsg);
mark_volume_in_error();
return false;
}