all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [pbs-devel] [PATCH proxmox-backup 1/2] blob/chunk parse errors: add context
@ 2023-07-20 10:23 Fabian Grünbichler
  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
  0 siblings, 2 replies; 3+ messages in thread
From: Fabian Grünbichler @ 2023-07-20 10:23 UTC (permalink / raw)
  To: pbs-devel

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





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

* [pbs-devel] [PATCH proxmox-backup 2/2] blobs: fix outdated comment about file format
  2023-07-20 10:23 [pbs-devel] [PATCH proxmox-backup 1/2] blob/chunk parse errors: add context Fabian Grünbichler
@ 2023-07-20 10:23 ` Fabian Grünbichler
  2023-08-08 11:59 ` [pbs-devel] applied: [PATCH proxmox-backup 1/2] blob/chunk parse errors: add context Wolfgang Bumiller
  1 sibling, 0 replies; 3+ messages in thread
From: Fabian Grünbichler @ 2023-07-20 10:23 UTC (permalink / raw)
  To: pbs-devel

the wrong info here was rather misleading, especially when encountering errors
just talking about "blobs" when the actual problem is with a chunk.

chunks did originally have their own magic values, but that got removed in

4ee8f53d07bf0becf19a22cf4f4674558a4d128c "remove DataChunk file format - use DataBlob instead"

back in 2019, before the 0.1.1 release(!)

Reported-by: Dominik Csapak <d.csapak@proxmox.com>

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
---
 pbs-datastore/src/file_formats.rs | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pbs-datastore/src/file_formats.rs b/pbs-datastore/src/file_formats.rs
index 7e08e530..73d67e20 100644
--- a/pbs-datastore/src/file_formats.rs
+++ b/pbs-datastore/src/file_formats.rs
@@ -35,8 +35,8 @@ pub const DYNAMIC_SIZED_CHUNK_INDEX_1_0: [u8; 8] = [28, 145, 78, 165, 25, 186, 1
 ///
 /// (MAGIC || CRC32 || Data)
 ///
-/// This is basically the same format we use for chunks, but
-/// with other magic numbers so that we can distinguish them.
+/// This format is used for blobs (stored in a BackupDir and accessed directly) and chunks (stored
+/// in a chunk store and accessed via a ChunkReader / index file).
 #[derive(Endian)]
 #[repr(C, packed)]
 pub struct DataBlobHeader {
-- 
2.39.2





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

* [pbs-devel] applied: [PATCH proxmox-backup 1/2] blob/chunk parse errors: add context
  2023-07-20 10:23 [pbs-devel] [PATCH proxmox-backup 1/2] blob/chunk parse errors: add context Fabian Grünbichler
  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 ` Wolfgang Bumiller
  1 sibling, 0 replies; 3+ messages in thread
From: Wolfgang Bumiller @ 2023-08-08 11:59 UTC (permalink / raw)
  To: Fabian Grünbichler; +Cc: pbs-devel

applied both patches, thanks




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

end of thread, other threads:[~2023-08-08 11:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-20 10:23 [pbs-devel] [PATCH proxmox-backup 1/2] blob/chunk parse errors: add context Fabian Grünbichler
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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal