all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Christian Ebner <c.ebner@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [PATCH proxmox-backup v2 1/2] datastore: s3: modify delete objects api and log exposed errors
Date: Wed,  4 Mar 2026 14:59:21 +0100	[thread overview]
Message-ID: <20260304135922.717714-6-c.ebner@proxmox.com> (raw)
In-Reply-To: <20260304135922.717714-1-c.ebner@proxmox.com>

Delete objects api calls now return a list of errors in case there
were some, not just a boolean flag. Adapt the call sides to the new
api interface and log encountered errors.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
---
changes since version 1:
- not present in previous version

 pbs-datastore/src/backup_info.rs |  8 +++++---
 pbs-datastore/src/datastore.rs   |  6 ++++--
 pbs-datastore/src/s3.rs          | 26 +++++++++++++++++++++++++-
 3 files changed, 34 insertions(+), 6 deletions(-)

diff --git a/pbs-datastore/src/backup_info.rs b/pbs-datastore/src/backup_info.rs
index 859039cf4..55ca9a49e 100644
--- a/pbs-datastore/src/backup_info.rs
+++ b/pbs-datastore/src/backup_info.rs
@@ -250,14 +250,15 @@ impl BackupGroup {
                 .to_str()
                 .ok_or_else(|| format_err!("invalid group path prefix"))?;
             let prefix = format!("{S3_CONTENT_PREFIX}/{group_prefix}");
-            let delete_objects_error = proxmox_async::runtime::block_on(
+            let delete_objects_errors = proxmox_async::runtime::block_on(
                 s3_client.delete_objects_by_prefix_with_suffix_filter(
                     &S3PathPrefix::Some(prefix),
                     PROTECTED_MARKER_FILENAME,
                     &[GROUP_OWNER_FILE_NAME, GROUP_NOTES_FILE_NAME],
                 ),
             )?;
-            if delete_objects_error {
+            if !delete_objects_errors.is_empty() {
+                crate::s3::log_s3_delete_objects_errors(&delete_objects_errors);
                 bail!("deleting objects failed");
             }
         }
@@ -636,7 +637,8 @@ impl BackupDir {
             let delete_objects_error = proxmox_async::runtime::block_on(
                 s3_client.delete_objects_by_prefix(&S3PathPrefix::Some(prefix)),
             )?;
-            if delete_objects_error {
+            if !delete_objects_error.is_empty() {
+                crate::s3::log_s3_delete_objects_errors(&delete_objects_error);
                 bail!("deleting objects failed");
             }
         }
diff --git a/pbs-datastore/src/datastore.rs b/pbs-datastore/src/datastore.rs
index 7ad3d917d..ee3da93f7 100644
--- a/pbs-datastore/src/datastore.rs
+++ b/pbs-datastore/src/datastore.rs
@@ -955,7 +955,8 @@ impl DataStore {
                         &[GROUP_OWNER_FILE_NAME, GROUP_NOTES_FILE_NAME],
                     ),
                 )?;
-                if delete_objects_error {
+                if !delete_objects_error.is_empty() {
+                    crate::s3::log_s3_delete_objects_errors(&delete_objects_error);
                     bail!("deleting objects failed");
                 }
             }
@@ -2403,7 +2404,8 @@ impl DataStore {
                 let prefix = S3PathPrefix::Some(String::default());
                 let delete_objects_error =
                     proxmox_async::runtime::block_on(s3_client.delete_objects_by_prefix(&prefix))?;
-                if delete_objects_error {
+                if !delete_objects_error.is_empty() {
+                    crate::s3::log_s3_delete_objects_errors(&delete_objects_error);
                     bail!("deleting objects failed");
                 }
             }
diff --git a/pbs-datastore/src/s3.rs b/pbs-datastore/src/s3.rs
index 90efe2cb5..985758bb9 100644
--- a/pbs-datastore/src/s3.rs
+++ b/pbs-datastore/src/s3.rs
@@ -2,7 +2,7 @@ use std::path::{Path, PathBuf};
 
 use anyhow::{bail, format_err, Error};
 
-use proxmox_s3_client::S3ObjectKey;
+use proxmox_s3_client::{DeleteObjectError, S3ObjectKey};
 
 /// Object key prefix to group regular datastore contents (not chunks)
 pub const S3_CONTENT_PREFIX: &str = ".cnt";
@@ -48,6 +48,30 @@ pub fn object_key_from_digest_with_suffix(
     S3ObjectKey::try_from(object_key_string.as_str())
 }
 
+/// Log errors from delete objects api calls
+pub(crate) fn log_s3_delete_objects_errors(errors: &[DeleteObjectError]) {
+    for error in errors {
+        log::error!(
+            "delete object failed: {} {} {}",
+            error
+                .key
+                .as_ref()
+                .map(|key| key.to_string())
+                .unwrap_or_else(|| "None".into()),
+            error
+                .code
+                .as_ref()
+                .map(|s| s.as_str())
+                .unwrap_or_else(|| "None"),
+            error
+                .message
+                .as_ref()
+                .map(|s| s.as_str())
+                .unwrap_or_else(|| "None"),
+        );
+    }
+}
+
 #[test]
 fn test_object_key_from_path() {
     let path = Path::new("vm/100/2025-07-14T14:20:02Z");
-- 
2.47.3





  parent reply	other threads:[~2026-03-04 13:59 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-04 13:59 [PATCH proxmox{,-backup} v2 0/6] fix #7078: Add quirk for providers not supporting deleteObjects Christian Ebner
2026-03-04 13:59 ` [PATCH proxmox v2 1/4] s3-client: parse and return headers for delete object response Christian Ebner
2026-03-04 13:59 ` [PATCH proxmox v2 2/4] s3-client: return dedicated error type " Christian Ebner
2026-03-04 13:59 ` [PATCH proxmox v2 3/4] s3-client: extend provider quirks by delete objects via delete object Christian Ebner
2026-03-04 13:59 ` [PATCH proxmox v2 4/4] s3-client: return list of errors when deleting by prefix Christian Ebner
2026-03-04 13:59 ` Christian Ebner [this message]
2026-03-04 13:59 ` [PATCH proxmox-backup v2 2/2] fix #7078: ui: exponse DeleteObjects via DeleteObject provider quirk Christian Ebner

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=20260304135922.717714-6-c.ebner@proxmox.com \
    --to=c.ebner@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 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