From 47da06beed9ea7b51145ae9c7e9542db5ea1b2c5 Mon Sep 17 00:00:00 2001 From: Dominik Csapak Date: Tue, 12 Dec 2023 12:32:48 +0100 Subject: [PATCH] api: tape: add lto9 initialization message to task log so that it's clear that this operation can take a while Signed-off-by: Dominik Csapak --- src/api2/tape/drive.rs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/api2/tape/drive.rs b/src/api2/tape/drive.rs index 5306e605..3a77ca6f 100644 --- a/src/api2/tape/drive.rs +++ b/src/api2/tape/drive.rs @@ -16,7 +16,7 @@ use proxmox_uuid::Uuid; use pbs_api_types::{ Authid, DriveListEntry, LabelUuidMap, Lp17VolumeStatistics, LtoDriveAndMediaStatus, - LtoTapeDrive, MamAttribute, MediaIdFlat, CHANGER_NAME_SCHEMA, DRIVE_NAME_SCHEMA, + LtoTapeDrive, MamAttribute, MediaIdFlat, TapeDensity, CHANGER_NAME_SCHEMA, DRIVE_NAME_SCHEMA, MEDIA_LABEL_SCHEMA, MEDIA_POOL_NAME_SCHEMA, UPID_SCHEMA, }; @@ -309,6 +309,21 @@ pub fn format_media( let mut handle = open_drive(&config, &drive)?; + if !fast.unwrap_or(true) { + let drive_config: LtoTapeDrive = config.lookup("lto", &drive)?; + let file = open_lto_tape_device(&drive_config.path)?; + let mut handle = LtoTapeHandle::new(file)?; + if let Ok(status) = handle.get_drive_and_media_status() { + if status.density >= TapeDensity::LTO9 { + task_log!(worker, "Slow formatting LTO9+ media."); + task_log!( + worker, + "This can take a very long time due to media optimization." + ); + } + } + } + match handle.read_label() { Err(err) => { if let Some(label) = label_text {