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] tape: library status: don't fail if the library does not support DVCID
Date: Wed,  9 Aug 2023 11:12:55 +0200	[thread overview]
Message-ID: <20230809091255.2111507-1-d.csapak@proxmox.com> (raw)

some libraries (e.g. Qualstar) don't support the DVCID bit in the READ
ELEMENT (B8) command (to return vendor/model of connected drives), so
make that part optional if it fails. We only ever use the serial number
in the `pmtx` tool, so there is not much downside to not having this.

This increases compatibility with such libraries

Reported in the forum:
https://forum.proxmox.com/threads/cant-query-tape-robot-status.131833/

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 pbs-tape/src/sg_pt_changer.rs | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/pbs-tape/src/sg_pt_changer.rs b/pbs-tape/src/sg_pt_changer.rs
index c5a0b561..6cb3a044 100644
--- a/pbs-tape/src/sg_pt_changer.rs
+++ b/pbs-tape/src/sg_pt_changer.rs
@@ -398,20 +398,22 @@ pub fn read_element_status<F: AsRawFd>(file: &mut F) -> Result<MtxStatus, Error>
 
     // get the serial + vendor + model,
     // some changer require this to be an extra scsi command
-    let page = get_element(
+    // some changers don't support this
+    if let Ok(page) = get_element(
         &mut sg_raw,
         ElementType::DataTransferWithDVCID,
         allocation_len,
         false,
-    )?;
-    // should be in same order and same count, but be on the safe side.
-    // there should not be too many drives normally
-    for drive in drives.iter_mut() {
-        for drive2 in &page.drives {
-            if drive2.element_address == drive.element_address {
-                drive.vendor = drive2.vendor.clone();
-                drive.model = drive2.model.clone();
-                drive.drive_serial_number = drive2.drive_serial_number.clone();
+    ) {
+        // should be in same order and same count, but be on the safe side.
+        // there should not be too many drives normally
+        for drive in drives.iter_mut() {
+            for drive2 in &page.drives {
+                if drive2.element_address == drive.element_address {
+                    drive.vendor = drive2.vendor.clone();
+                    drive.model = drive2.model.clone();
+                    drive.drive_serial_number = drive2.drive_serial_number.clone();
+                }
             }
         }
     }
-- 
2.30.2





             reply	other threads:[~2023-08-09  9:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-09  9:12 Dominik Csapak [this message]
2023-11-27 10:44 ` [pbs-devel] applied: " 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=20230809091255.2111507-1-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