public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Shan Shaji <s.shaji@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [PATCH proxmox-backup 5/9] fix #7908: datastore: api: add option to create zero-byte chunk markers
Date: Mon, 19 Oct 2026 18:03:55 +0200	[thread overview]
Message-ID: <20261019160359.20851-6-s.shaji@proxmox.com> (raw)
In-Reply-To: <20261019160359.20851-1-s.shaji@proxmox.com>

Expose the `rebuild-chunk-markers` option inside the `/api2/config/
datastore` endpoint. This allows users to optionally create empty,
zero-byte chunk markers during reconstruction.

Fixes: https://bugzilla.proxmox.com/show_bug.cgi?id=7908

Signed-off-by: Shan Shaji <s.shaji@proxmox.com>
---
 src/api2/config/datastore.rs     | 15 ++++++++++++++-
 src/api2/node/disks/directory.rs |  1 +
 src/api2/node/disks/zfs.rs       |  1 +
 3 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/src/api2/config/datastore.rs b/src/api2/config/datastore.rs
index a390bbd6b..b3832bae5 100644
--- a/src/api2/config/datastore.rs
+++ b/src/api2/config/datastore.rs
@@ -95,12 +95,13 @@ impl Drop for UnmountGuard {
 
 pub(crate) fn do_create_datastore(
     lock: BackupLockGuard,
-    _worker: &dyn WorkerTaskContext,
+    worker: &dyn WorkerTaskContext,
     backend_type: DatastoreBackendType,
     mut datastore: DataStoreConfig,
     prune_job_config: Option<PruneJobConfig>,
     reuse_datastore: bool,
     overwrite_in_use: bool,
+    rebuild_chunk_markers: bool,
 ) -> Result<(), Error> {
     // always start out in maintenance-mode create, so access can be blocked during creation
     // without needing to hold the config lock, only the maintenance-mode lock.
@@ -134,6 +135,10 @@ pub(crate) fn do_create_datastore(
         let datastore_instance =
             DataStore::lookup_datastore(lookup_with(&datastore.name, Operation::Lookup))?;
         proxmox_async::runtime::block_on(datastore_instance.s3_refresh())?;
+
+        if rebuild_chunk_markers {
+            datastore_instance.create_empty_s3_chunk_markers(worker)?;
+        }
     }
 
     unset_maintenance_mode(Some(maintenance_mode_lock), &datastore.name, current_type)?;
@@ -161,6 +166,12 @@ pub(crate) fn do_create_datastore(
                 default: false,
                 description: "Overwrite in use marker (S3 backed datastores only)."
             },
+            "rebuild-chunk-markers": {
+                type: Boolean,
+                optional: true,
+                default: false,
+                description: "Create zero-byte chunk markers (S3 backed datastores only)"
+            }
         },
     },
     access: {
@@ -173,6 +184,7 @@ pub fn create_datastore(
     config: DataStoreConfig,
     reuse_datastore: bool,
     overwrite_in_use: bool,
+    rebuild_chunk_markers: bool,
     rpcenv: &mut dyn RpcEnvironment,
 ) -> Result<String, Error> {
     let auth_id: Authid = rpcenv.get_auth_id().unwrap().parse()?;
@@ -239,6 +251,7 @@ pub fn create_datastore(
                 prune_job_config,
                 reuse_datastore,
                 overwrite_in_use,
+                rebuild_chunk_markers,
             )
         },
     )
diff --git a/src/api2/node/disks/directory.rs b/src/api2/node/disks/directory.rs
index 61e4f9df6..81b6fe36e 100644
--- a/src/api2/node/disks/directory.rs
+++ b/src/api2/node/disks/directory.rs
@@ -258,6 +258,7 @@ pub fn create_datastore_disk(
                     None,
                     false,
                     false,
+                    false,
                 )?;
             }
 
diff --git a/src/api2/node/disks/zfs.rs b/src/api2/node/disks/zfs.rs
index b5a0dbfe6..f8c905ccf 100644
--- a/src/api2/node/disks/zfs.rs
+++ b/src/api2/node/disks/zfs.rs
@@ -318,6 +318,7 @@ pub fn create_zpool(
                     None,
                     false,
                     false,
+                    false,
                 )?;
             }
 
-- 
2.47.3





  parent reply	other threads:[~2026-10-19 16:04 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-19 16:03 [PATCH proxmox{-backup,} 0/9] fix #7903: rebuild local S3 chunk markers Shan Shaji
2026-10-19 16:03 ` [PATCH proxmox-backup 1/9] refactor: remove local `LogThrottle` in favor of proxmox-log Shan Shaji
2026-10-19 16:03 ` [PATCH proxmox-backup 2/9] datastore: factor out s3 chunk objects pagination into a helper Shan Shaji
2026-10-19 16:03 ` [PATCH proxmox-backup 3/9] pbs-datastore: inherit proxmox-log crate from workspace Shan Shaji
2026-10-19 16:03 ` [PATCH proxmox-backup 4/9] datastore: add method to create zero-byte chunk markers Shan Shaji
2026-10-19 16:03 ` Shan Shaji [this message]
2026-10-19 16:03 ` [PATCH proxmox-backup 6/9] fix #7908: datastore: ui: add option " Shan Shaji
2026-10-19 16:03 ` [PATCH proxmox-backup 7/9] fix #7908: backup-manager: " Shan Shaji
2026-10-19 16:03 ` [PATCH proxmox-backup 8/9] docs: add explanation regarding ``rebuild-chunk-markers`` option Shan Shaji
2026-10-19 16:03 ` [PATCH proxmox 9/9] proxmox-log: add LogThrottle implementation Shan Shaji

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=20261019160359.20851-6-s.shaji@proxmox.com \
    --to=s.shaji@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