From e97132bb64a203535c28214c1cec4c1e49cf9009 Mon Sep 17 00:00:00 2001 From: Dominik Csapak Date: Mon, 26 Aug 2024 16:04:59 +0200 Subject: [PATCH] tape: fix read element status for some changers It seems some changers are setting the PVolTag/AVolTag flags in the ELEMENT STATUS page response, but don't include the actual fields then. To make it work with such changers, downgrade the errors to warnings, so we can continue to decode the remaining data. This is OK since one volume tag is optional and the other is skipped anyway. Reported in the forum: https://forum.proxmox.com/threads/hpe-storeonce-vtl.152547/ Signed-off-by: Dominik Csapak --- pbs-tape/src/sg_pt_changer.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/pbs-tape/src/sg_pt_changer.rs b/pbs-tape/src/sg_pt_changer.rs index b600a49d8..940eed4a6 100644 --- a/pbs-tape/src/sg_pt_changer.rs +++ b/pbs-tape/src/sg_pt_changer.rs @@ -746,9 +746,18 @@ fn decode_element_status_page( let desc: TransportDescriptor = unsafe { reader.read_be_value()? }; let full = (desc.flags1 & 1) != 0; - let volume_tag = subhead.parse_optional_volume_tag(&mut reader, full)?; - subhead.skip_alternate_volume_tag(&mut reader)?; + let volume_tag = match subhead.parse_optional_volume_tag(&mut reader, full) { + Ok(tag) => tag, + Err(err) => { + log::warn!("could not read optional volume tag: {err}"); + None + } + }; + + if let Err(err) = subhead.skip_alternate_volume_tag(&mut reader) { + log::warn!("could not skip alternate volume tag: {err}"); + } result.last_element_address = Some(desc.element_address);