Mmsg(&jcr->errmsg, _("Network error on bnet_recv in req_vol_info.\n"));
return 0;
}
+ memset(&vol, 0, sizeof(vol));
if (sscanf(dir->msg, OK_media, vol.VolCatName,
&vol.VolCatJobs, &vol.VolCatFiles,
&vol.VolCatBlocks, &vol.VolCatBytes,
* After writing a Volume, send the updated statistics
* back to the director.
*/
-int dir_update_volume_info(JCR *jcr, VOLUME_CAT_INFO *vol, int relabel)
+int dir_update_volume_info(JCR *jcr, DEVICE *dev, int label)
{
BSOCK *dir = jcr->dir_bsock;
time_t EndTime = time(NULL);
char ed1[50], ed2[50];
+ VOLUME_CAT_INFO *vol = &dev->VolCatInfo;
if (vol->VolCatName[0] == 0) {
Jmsg0(jcr, M_ERROR, 0, _("NULL Volume name. This shouldn't happen!!!\n"));
return 0;
}
+ if (dev_state(dev, ST_READ)) {
+ Jmsg0(jcr, M_ERROR, 0, _("Attempt to update_volume_info in read mode!!!\n"));
+ return 0;
+ }
+ if (!dev_state(dev, ST_LABEL)) {
+ Jmsg0(jcr, M_ERROR, 0, _("Attempt to update_volume_info on non-labeled Volume!!!\n"));
+ return 0;
+ }
+ /* Just labeled or relabeled the tape */
+ if (label) {
+ bstrncpy(vol->VolCatStatus, "Append", sizeof(vol->VolCatStatus));
+ vol->VolCatBytes = 1; /* indicates tape labeled */
+ }
bash_spaces(vol->VolCatName);
bnet_fsend(dir, Update_media, jcr->Job,
vol->VolCatName, vol->VolCatJobs, vol->VolCatFiles,
vol->VolCatBlocks, edit_uint64(vol->VolCatBytes, ed1),
vol->VolCatMounts, vol->VolCatErrors,
vol->VolCatWrites, edit_uint64(vol->VolCatMaxBytes, ed2),
- EndTime, vol->VolCatStatus, vol->Slot, relabel);
+ EndTime, vol->VolCatStatus, vol->Slot, label);
Dmsg1(120, "update_volume_data(): %s", dir->msg);
unbash_spaces(vol->VolCatName);
if (bnet_recv(dir) <= 0) {
jstat = JS_WaitMount;
/*
* If we have a valid volume name and we are not
- * removable media, return now, otherwise wait
+ * removable media, return now, or if we have a
+ * Slot for an autochanger, otherwise wait
* for the operator to mount the media.
*/
- if (jcr->VolumeName[0] && !dev_cap(dev, CAP_REM) && dev_cap(dev, CAP_LABEL)) {
+ if ((jcr->VolumeName[0] && !dev_cap(dev, CAP_REM) && dev_cap(dev, CAP_LABEL)) ||
+ (jcr->VolumeName[0] && jcr->VolCatInfo.Slot)) {
Dmsg0(190, "Return 1 from mount without wait.\n");
return 1;
}