public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Dominik Csapak <d.csapak@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-backup 2/4] tape: continue without MAM media_usage page
Date: Thu, 30 Mar 2023 13:28:43 +0200	[thread overview]
Message-ID: <20230330112845.2620964-2-d.csapak@proxmox.com> (raw)
In-Reply-To: <20230330112845.2620964-1-d.csapak@proxmox.com>

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

Signed-off-by: Dominik Csapak <d.csapak@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





  reply	other threads:[~2023-03-30 11:28 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-30 11:28 [pbs-devel] [PATCH proxmox-backup 1/4] tape: use correct MAM attribute definitions Dominik Csapak
2023-03-30 11:28 ` Dominik Csapak [this message]
2023-04-20 12:19   ` [pbs-devel] applied [PATCH proxmox-backup 2/4] tape: continue without MAM media_usage page Dietmar Maurer
2023-03-30 11:28 ` [pbs-devel] [PATCH proxmox-backup 3/4] tape: implement 6 byte fallback for MODE SENSE/SELECT Dominik Csapak
2023-03-30 13:38   ` Dominik Csapak
2023-03-30 11:28 ` [pbs-devel] [PATCH proxmox-backup 4/4] tape: typo fixes Dominik Csapak
2023-04-20 12:18 ` [pbs-devel] applied [PATCH proxmox-backup 1/4] tape: use correct MAM attribute definitions Dietmar Maurer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230330112845.2620964-2-d.csapak@proxmox.com \
    --to=d.csapak@proxmox.com \
    --cc=pbs-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal