[pbs-devel] [PATCH proxmox-backup 4/4] api: tape: add lto9 initialization message to task log

Dominik Csapak d.csapak at proxmox.com
Tue Dec 12 12:32:48 CET 2023


so that it's clear that this operation can take a while

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 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 {
-- 
2.39.2




More information about the pbs-devel mailing list