char dev_name[MAX_NAME_LENGTH];
MEDIA_DBR mr, omr;
POOL_DBR pr;
+ bool print_reminder = true;
int ok = FALSE;
- int mounted = FALSE;
int i;
bool media_record_exists = false;
static char *barcode_keyword[] = {
/* Here we can get
* 3001 OK mount. Device=xxx or
* 3001 Mounted Volume vvvv
+ * 3906 is cannot mount non-tape
+ * So for those, no need to print a reminder
*/
- mounted = strncmp(sd->msg, "3001 ", 5) == 0;
+ if (strncmp(sd->msg, "3001 ", 5) == 0 ||
+ strncmp(sd->msg, "3906 ", 5) == 0) {
+ print_reminder = false;
}
}
}
- if (!mounted) {
+ }
+ if (!print_reminder) {
bsendmsg(ua, _("Do not forget to mount the drive!!!\n"));
}
bnet_sig(sd, BNET_TERMINATE);
* send_label_request() below
*/
if (is_cleaning_tape(ua, &mr, &pr)) {
- set_pool_dbr_defaults_in_media_dbr(&mr, &pr);
- if (db_create_media_record(ua->jcr, ua->db, &mr)) {
- bsendmsg(ua, _("Catalog record for cleaning tape \"%s\" successfully created.\n"),
- mr.VolumeName);
- } else {
- bsendmsg(ua, "Catalog error on cleaning tape: %s", db_strerror(ua->db));
+ if (media_record_exists) { /* we update it */
+ mr.VolBytes = 1;
+ if (!db_update_media_record(ua->jcr, ua->db, &mr)) {
+ bsendmsg(ua, "%s", db_strerror(ua->db));
+ }
+ } else { /* create the media record */
+ set_pool_dbr_defaults_in_media_dbr(&mr, &pr);
+ if (db_create_media_record(ua->jcr, ua->db, &mr)) {
+ bsendmsg(ua, _("Catalog record for cleaning tape \"%s\" successfully created.\n"),
+ mr.VolumeName);
+ } else {
+ bsendmsg(ua, "Catalog error on cleaning tape: %s", db_strerror(ua->db));
+ }
}
- continue;
+ continue; /* done, go handle next volume */
}
bstrncpy(mr.MediaType, store->media_type, sizeof(mr.MediaType));
if (ua->jcr->store_bsock) {