[pbs-devel] [PATCH proxmox-backup] api: return s3 client errors during datastore create with context
Christian Ebner
c.ebner at proxmox.com
Thu Jul 24 14:42:36 CEST 2025
The error context might contain information directly pointing to the
reason why the bucket cannot be reached during the datastore creation
bucket access check.
For example, the following text will be shown to the user in the error
dialog:
```
failed to access bucket: client error (Connect): error connecting to https://test.s3.pve-c1.local:7480/
- dns error: failed to lookup address information: Name or service not known (400)
```
Suggested-by: Gabriel Goller <g.goller at proxmox.com>
Signed-off-by: Christian Ebner <c.ebner at proxmox.com>
---
src/api2/config/datastore.rs | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/api2/config/datastore.rs b/src/api2/config/datastore.rs
index d24323152..b99f515ca 100644
--- a/src/api2/config/datastore.rs
+++ b/src/api2/config/datastore.rs
@@ -382,10 +382,13 @@ pub fn create_datastore(
bucket,
store_name.clone(),
);
- let s3_client = S3Client::new(options).context("failed to create s3 client")?;
+ let s3_client = S3Client::new(options)
+ .context("failed to create s3 client")
+ .map_err(|err| format_err!("{err:#}"))?;
// Fine to block since this runs in worker task
proxmox_async::runtime::block_on(s3_client.head_bucket())
- .context("failed to access bucket")?;
+ .context("failed to access bucket")
+ .map_err(|err| format_err!("{err:#}"))?;
}
}
--
2.47.2
More information about the pbs-devel
mailing list