[pbs-devel] [PATCH proxmox-backup 1/2] s3: pass now optional default request timeout for s3 api calls

Christian Ebner c.ebner at proxmox.com
Wed Aug 20 11:58:06 CEST 2025


The request timeout is now exposed as optional duration to the put
object s3 api calls, so it can be dynamically adapted based on the
payload size when uploading objects via the respective helper
methods. Adapt the remaining direct call sites to use the previous
default, given their limited payload size.

Signed-off-by: Christian Ebner <c.ebner at proxmox.com>
---
 src/api2/admin/s3.rs         | 9 +++++++--
 src/api2/config/datastore.rs | 3 ++-
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/api2/admin/s3.rs b/src/api2/admin/s3.rs
index 209feaebc..73f3779a5 100644
--- a/src/api2/admin/s3.rs
+++ b/src/api2/admin/s3.rs
@@ -7,7 +7,7 @@ use proxmox_http::Body;
 use proxmox_router::{list_subdirs_api_method, Permission, Router, RpcEnvironment, SubdirMap};
 use proxmox_s3_client::{
     S3Client, S3ClientConf, S3ClientOptions, S3ObjectKey, S3_BUCKET_NAME_SCHEMA,
-    S3_CLIENT_ID_SCHEMA,
+    S3_CLIENT_ID_SCHEMA, S3_HTTP_REQUEST_TIMEOUT,
 };
 use proxmox_schema::*;
 use proxmox_sortable_macro::sortable;
@@ -57,7 +57,12 @@ pub async fn check(
     let client = S3Client::new(options).context("client creation failed")?;
     client.head_bucket().await.context("head object failed")?;
     client
-        .put_object(test_object_key.clone(), Body::empty(), true)
+        .put_object(
+            test_object_key.clone(),
+            Body::empty(),
+            Some(S3_HTTP_REQUEST_TIMEOUT),
+            true,
+        )
         .await
         .context("put object failed")?;
     client
diff --git a/src/api2/config/datastore.rs b/src/api2/config/datastore.rs
index 5b9fcd9da..e86ded0db 100644
--- a/src/api2/config/datastore.rs
+++ b/src/api2/config/datastore.rs
@@ -36,7 +36,7 @@ use pbs_datastore::{
     get_datastore_mount_status, DataStore, DatastoreBackend, S3_DATASTORE_IN_USE_MARKER,
 };
 use proxmox_rest_server::WorkerTask;
-use proxmox_s3_client::S3ObjectKey;
+use proxmox_s3_client::{S3ObjectKey, S3_HTTP_REQUEST_TIMEOUT};
 
 use crate::server::jobstate;
 use crate::tools::disks::unmount_by_mountpoint;
@@ -217,6 +217,7 @@ pub(crate) fn do_create_datastore(
         proxmox_async::runtime::block_on(s3_client.put_object(
             object_key,
             hyper::body::Bytes::from(content).into(),
+            Some(S3_HTTP_REQUEST_TIMEOUT),
             true,
         ))
         .context("failed to upload in-use marker for datastore")?;
-- 
2.47.2





More information about the pbs-devel mailing list