public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: "Fabian Grünbichler" <f.gruenbichler@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-backup 1/2] blob/chunk parse errors: add context
Date: Thu, 20 Jul 2023 12:23:55 +0200	[thread overview]
Message-ID: <20230720102356.1906013-1-f.gruenbichler@proxmox.com> (raw)

to make it more obvious that blob is a chunk here and which one is affected.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
---

Notes:
    encountered here: https://forum.proxmox.com/threads/restore-failed-unable-to-parse-raw-blob-wrong-magic.130828
    
    the remote chunk reader change is only visible in VM restore logs if the Qemu
    lib is rebuilt as well, since pbs-restore needs to pick up the change..

 pbs-client/src/remote_chunk_reader.rs   | 5 +++--
 src/bin/proxmox_backup_debug/recover.rs | 2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/pbs-client/src/remote_chunk_reader.rs b/pbs-client/src/remote_chunk_reader.rs
index c975c006..86f7549f 100644
--- a/pbs-client/src/remote_chunk_reader.rs
+++ b/pbs-client/src/remote_chunk_reader.rs
@@ -3,7 +3,7 @@ use std::future::Future;
 use std::pin::Pin;
 use std::sync::{Arc, Mutex};
 
-use anyhow::{bail, Error};
+use anyhow::{bail, format_err, Error};
 
 use proxmox_async::runtime::block_on;
 
@@ -51,7 +51,8 @@ impl RemoteChunkReader {
 
         self.client.download_chunk(digest, &mut chunk_data).await?;
 
-        let chunk = DataBlob::load_from_reader(&mut &chunk_data[..])?;
+        let chunk = DataBlob::load_from_reader(&mut &chunk_data[..])
+            .map_err(|err| format_err!("Failed to parse chunk {} - {err}", hex::encode(digest)))?;
 
         match self.crypt_mode {
             CryptMode::Encrypt => match chunk.crypt_mode()? {
diff --git a/src/bin/proxmox_backup_debug/recover.rs b/src/bin/proxmox_backup_debug/recover.rs
index 113da6da..ccac476b 100644
--- a/src/bin/proxmox_backup_debug/recover.rs
+++ b/src/bin/proxmox_backup_debug/recover.rs
@@ -142,7 +142,7 @@ fn recover_index(
                         if ignore_corrupt_chunks {
                             create_zero_chunk(format!("is corrupt - {err}"))
                         } else {
-                            bail!("{err}");
+                            bail!("Failed to parse chunk {chunk_path:?} - {err}");
                         }
                     })?
             }
-- 
2.39.2





             reply	other threads:[~2023-07-20 10:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-20 10:23 Fabian Grünbichler [this message]
2023-07-20 10:23 ` [pbs-devel] [PATCH proxmox-backup 2/2] blobs: fix outdated comment about file format Fabian Grünbichler
2023-08-08 11:59 ` [pbs-devel] applied: [PATCH proxmox-backup 1/2] blob/chunk parse errors: add context Wolfgang Bumiller

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=20230720102356.1906013-1-f.gruenbichler@proxmox.com \
    --to=f.gruenbichler@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