Dmsg2(200, "dir_update_vol_info. Release vol=%s dev=%s\n",
dev->VolCatInfo.VolCatName, dev->print_name());
}
- if (!dev->num_writers) { /* if no more writers */
+ if (!dev->is_busy()) { /* if not being used */
volume_unused(dcr); /* we obviously are not using the volume */
}
}
return false;
}
if (recycle) {
- volume_unused(dcr); /* mark volume unused */
+// volume_unused(dcr); /* mark volume unused */
if (!dev->truncate(dcr)) {
Jmsg2(jcr, M_FATAL, 0, _("Truncate error on device %s: ERR=%s\n"),
dev->print_name(), dev->print_errmsg());
if (!dev->poll && retry++ > 4) {
/* Last ditch effort before giving up, force operator to respond */
VolCatInfo.Slot = 0;
+ unlock_volumes();
if (!dir_ask_sysop_to_mount_volume(dcr, ST_APPEND)) {
Jmsg(jcr, M_FATAL, 0, _("Too many errors trying to mount device %s.\n"),
dev->print_name());
- goto bail_out;
+ goto no_lock_bail_out;
}
+ lock_volumes();
}
if (job_canceled(jcr)) {
Jmsg(jcr, M_FATAL, 0, _("Job %d canceled.\n"), jcr->JobId);
}
dev->swap_dev = NULL;
}
+ if (dev->must_load()) {
+ dev->clear_load();
+ dev->clear_volhdr(); /* force "load" */
+ }
if (!is_suitable_volume_mounted()) {
bool have_vol = false;
/* Do we have a candidate volume? */
Dmsg0(200, "Before dir_find_next_appendable_volume.\n");
while (!dir_find_next_appendable_volume(dcr)) {
Dmsg0(200, "not dir_find_next\n");
- if (job_canceled(jcr) || !dir_ask_sysop_to_create_appendable_volume(dcr)) {
+ if (job_canceled(jcr)) {
goto bail_out;
+ }
+ unlock_volumes();
+ if (!dir_ask_sysop_to_create_appendable_volume(dcr)) {
+ goto no_lock_bail_out;
}
+ lock_volumes();
Dmsg0(200, "Again dir_find_next_append...\n");
}
goto mount_next_vol;
bail_out:
unlock_volumes();
+
+no_lock_bail_out:
return false;
}
*/
switch (vol_label_status) {
case VOL_OK:
- Dmsg1(150, "Vol OK name=%s\n", VolumeName);
+ Dmsg1(150, "Vol OK name=%s\n", dev->VolHdr.VolumeName);
dev->VolCatInfo = VolCatInfo; /* structure assignment */
break; /* got a Volume */
case VOL_NAME_ERROR:
* This was not the volume we expected, but it is OK with
* the Director, so use it.
*/
- Dmsg1(150, "want new name=%s\n", VolumeName);
+ Dmsg1(150, "Got new Volume name=%s\n", VolumeName);
dev->VolCatInfo = VolCatInfo; /* structure assignment */
break; /* got a Volume */
/*
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 */
- vol->set_swapping();
- vol->dev->set_unload();
+ vol->dev->set_unload(); /* unload our drive */
+ vol->set_swapping(); /* swap from other drive */
dev->swap_dev = vol->dev; /* remember to get this vol */
- vol->dev->vol = NULL; /* take volume */
- vol->dev = dev;
- dev->vol = vol;
+ vol->dev->set_load(); /* then reload on our drive */
+ vol->dev->vol = NULL; /* remove volume from other drive */
+ vol->dev = dev; /* point it at our drive */
+ dev->vol = vol; /* point our drive at it */
Dmsg3(dbglvl, "==== Swap vol=%s from dev=%s to %s\n",
VolumeName, vol->dev->print_name(), dev->print_name());
} else {
* explicitly read in this drive. This allows the SD to remember
* where the tapes are or last were.
*/
- Dmsg3(dbglvl, "=== mark not reserved vol=%s num_writers=%d dev_reserved=%d\n",
- dev->vol->vol_name, dev->num_writers, dev->num_reserved());
+ Dmsg4(dbglvl, "=== set not reserved vol=%s num_writers=%d dev_reserved=%d dev=%s\n",
+ dev->vol->vol_name, dev->num_writers, dev->num_reserved(), dev->print_name());
dev->vol->clear_in_use();
- Dmsg2(dbglvl, "=== set not reserved. Vol=%s dev=%s\n", dev->vol->vol_name,
- dev->print_name());
if (dev->is_tape() || dev->is_autochanger()) {
return true;
} else {
DEVICE *dev = dcr->dev;
JCR *jcr = dcr->jcr;
- Dmsg4(dbglvl, "MaxJobs=%d Jobs=%d reserves=%d Vol=%s\n",
+ Dmsg5(dbglvl, "MaxJobs=%d Jobs=%d reserves=%d Status=%s Vol=%s\n",
dcr->VolCatInfo.VolCatMaxJobs,
dcr->VolCatInfo.VolCatJobs, dev->num_reserved(),
+ dcr->VolCatInfo.VolCatStatus,
dcr->VolumeName);
+ if (strcmp(dcr->VolCatInfo.VolCatStatus, "Recycle") == 0) {
+ return true;
+ }
if (dcr->VolCatInfo.VolCatMaxJobs > 0 && dcr->VolCatInfo.VolCatMaxJobs <=
(dcr->VolCatInfo.VolCatJobs + dev->num_reserved())) {
/* Max Job Vols depassed or already reserved */
General:
+13Apr08
+kes Tweak the swap Volume from one drive to another code so that
+ it now seems to work.
+kes Resolve several problems with recycling that broke the new
+ code (these problems are in 2.2.9 as well).
+kes Remove the volume lock when calling the sysop code.
+kes Don't mark a reserved volume with no writers as unused otherwise
+ jobs fail.
12Apr08
kes Rework class structures for VOLRES, DCR, and DEVICE to make
the method names a bit more logical, and for more logically