This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
- version 2 as ammended with additional clauses defined in the
+ version 2 as amended with additional clauses defined in the
file LICENSE in the main source directory.
This program is distributed in the hope that it will be useful,
JCR *jcr = dcr->jcr;
DEV_BLOCK *block = dcr->block;
- Dmsg0(100, "Enter mount_next_volume()\n");
+ Dmsg1(100, "Enter mount_next_volume(release=%d)\n", release);
init_device_wait_timers(dcr);
Dmsg3(100, "After find_next_append. Vol=%s Slot=%d Parts=%d\n",
dcr->VolCatInfo.VolCatName, dcr->VolCatInfo.Slot, dcr->VolCatInfo.VolCatParts);
- dev->num_parts = dcr->VolCatInfo.VolCatParts;
-
/*
* Get next volume and ready it for append
* This code ensures that the device is ready for
* we will err, recurse and ask the operator the next time.
*/
if (!release && dev->is_tape() && dev_cap(dev, CAP_AUTOMOUNT)) {
+ Dmsg0(100, "(1)Ask=0");
ask = false; /* don't ask SYSOP this time */
}
/* Don't ask if not removable */
if (!dev_cap(dev, CAP_REM)) {
+ Dmsg0(100, "(2)Ask=0");
ask = false;
}
Dmsg2(100, "Ask=%d autochanger=%d\n", ask, autochanger);
}
/* Ensure the device is open */
- /* If we have a dvd that requires mount, we first want to guess
- * which Volume is loaded, so we continue (if the wrong device is
- * loaded, open_device just below would fail.
- */
- if (!dev->is_dvd()) {
- if (!open_device(dcr)) {
- if (dev->poll) {
- goto mount_next_vol;
- } else {
- return false;
- }
+ if (!open_device(dcr)) {
+ if ((dev->poll) || (dev->is_dvd())) {
+ goto mount_next_vol;
+ } else {
+ return false;
}
- } else {
- /*
- * Just copy the VolCatName in the device resource
- * (usually done by open_dev).
- * It is necessary so we can open the real files later.
- */
- bstrncpy(dev->VolCatInfo.VolCatName, dcr->VolCatInfo.VolCatName, sizeof(dev->VolCatInfo.VolCatName));
}
/*
vol_label_status = VOL_OK;
create_volume_label(dev, dcr->VolumeName, "Default");
dev->VolHdr.LabelType = PRE_LABEL;
- } else if (dev->is_dvd()) {
- vol_label_status = read_dvd_volume_label(dcr, /*write*/true);
} else {
vol_label_status = read_dev_volume_label(dcr);
}
/* Restore desired volume name, note device info out of sync */
/* This gets the info regardless of the Pool */
bstrncpy(dcr->VolumeName, dev->VolHdr.VolumeName, sizeof(dcr->VolumeName));
- if (autochanger && dir_get_volume_info(dcr, GET_VOL_INFO_FOR_READ)) {
+ if (autochanger && !dir_get_volume_info(dcr, GET_VOL_INFO_FOR_READ)) {
mark_volume_not_inchanger(dcr);
}
memcpy(&dev->VolCatInfo, &devVolCatInfo, sizeof(dev->VolCatInfo));
dcr->VolumeName, dev->print_name());
goto read_volume; /* read label we just wrote */
}
+ if (!dev_cap(dev, CAP_LABEL) && dcr->VolCatInfo.VolCatBytes == 0) {
+ Jmsg(jcr, M_INFO, 0, _("Warning device %s not configured to autolabel Volumes.\n"),
+ dev->print_name());
+ }
/* If not removable, Volume is broken */
if (!dev_cap(dev, CAP_REM)) {
Jmsg(jcr, M_WARNING, 0, _("Volume \"%s\" not on device %s.\n"),
if (dev->is_open()) {
offline_or_rewind_dev(dev);
}
- Dmsg0(190, "===== release_volume ---");
+ Dmsg0(190, "release_volume\n");
}
/*