[pbs-devel] [PATCH proxmox-backup 2/4] tape: continue without MAM media_usage page

Dominik Csapak d.csapak at proxmox.com
Thu Mar 30 13:28:43 CEST 2023


sometimes we cannot parse these pages (e.g. vendor quirks that implement
the field differently)

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 pbs-tape/src/sg_tape.rs | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/pbs-tape/src/sg_tape.rs b/pbs-tape/src/sg_tape.rs
index 7ad94d9d..6a5569ac 100644
--- a/pbs-tape/src/sg_tape.rs
+++ b/pbs-tape/src/sg_tape.rs
@@ -911,11 +911,16 @@ impl SgTape {
             status.block_number = Some(position.logical_object_number);
 
             if let Ok(mam) = self.cartridge_memory() {
-                let usage = mam_extract_media_usage(&mam)?;
-
-                status.manufactured = Some(usage.manufactured);
-                status.bytes_read = Some(usage.bytes_read);
-                status.bytes_written = Some(usage.bytes_written);
+                match mam_extract_media_usage(&mam) {
+                    Ok(usage) => {
+                        status.manufactured = Some(usage.manufactured);
+                        status.bytes_read = Some(usage.bytes_read);
+                        status.bytes_written = Some(usage.bytes_written);
+                    }
+                    Err(err) => {
+                        log::warn!("unable to get MAM media usage: {err}");
+                    }
+                }
 
                 if let Ok(volume_stats) = self.volume_statistics() {
                     let passes = std::cmp::max(
-- 
2.30.2






More information about the pbs-devel mailing list