public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pbs-devel] [PATCH proxmox-backup] tape: fix read element status for some changers
@ 2024-08-26 14:04 Dominik Csapak
  2024-09-03  5:26 ` Dietmar Maurer
  0 siblings, 1 reply; 3+ messages in thread
From: Dominik Csapak @ 2024-08-26 14:04 UTC (permalink / raw)
  To: pbs-devel

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 <d.csapak@proxmox.com>
---
 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 b600a49d..940eed4a 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);
 
-- 
2.39.2



_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [pbs-devel] [PATCH proxmox-backup] tape: fix read element status for some changers
  2024-08-26 14:04 [pbs-devel] [PATCH proxmox-backup] tape: fix read element status for some changers Dominik Csapak
@ 2024-09-03  5:26 ` Dietmar Maurer
  2024-09-03  6:55   ` Dominik Csapak
  0 siblings, 1 reply; 3+ messages in thread
From: Dietmar Maurer @ 2024-09-03  5:26 UTC (permalink / raw)
  To: Proxmox Backup Server development discussion, Dominik Csapak

> 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.

cant we simply check if there is remaining data in the reader?


_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [pbs-devel] [PATCH proxmox-backup] tape: fix read element status for some changers
  2024-09-03  5:26 ` Dietmar Maurer
@ 2024-09-03  6:55   ` Dominik Csapak
  0 siblings, 0 replies; 3+ messages in thread
From: Dominik Csapak @ 2024-09-03  6:55 UTC (permalink / raw)
  To: Dietmar Maurer, Proxmox Backup Server development discussion

On 9/3/24 07:26, Dietmar Maurer wrote:
>> 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.
> 
> cant we simply check if there is remaining data in the reader?


yes we could, but we have to do it outside the functions, because
we don't have access to the reader there, only to something that
implements `read`

should i send a patch that checks the remaining size beforehand?


_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-09-03  6:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-08-26 14:04 [pbs-devel] [PATCH proxmox-backup] tape: fix read element status for some changers Dominik Csapak
2024-09-03  5:26 ` Dietmar Maurer
2024-09-03  6:55   ` Dominik Csapak

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