This is an automated email from the ASF dual-hosted git repository.
DaanHoogland pushed a commit to branch 4.22
in repository https://gitbox.apache.org/repos/asf/cloudstack.git
The following commit(s) were added to refs/heads/4.22 by this push:
new 345db511a26 Fix bucket usage retrieval workflow for Ceph RGW (#13776)
345db511a26 is described below
commit 345db511a266630611d7c03d602d5afde1f4da21
Author: Bernardo De Marco Gonçalves <[email protected]>
AuthorDate: Wed Oct 21 11:39:31 2026 -0300
Fix bucket usage retrieval workflow for Ceph RGW (#13776)
---
.../datastore/driver/CephObjectStoreDriverImpl.java | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git
a/plugins/storage/object/ceph/src/main/java/org/apache/cloudstack/storage/datastore/driver/CephObjectStoreDriverImpl.java
b/plugins/storage/object/ceph/src/main/java/org/apache/cloudstack/storage/datastore/driver/CephObjectStoreDriverImpl.java
index 2a7b6e1dda6..b3ad2d9552f 100644
---
a/plugins/storage/object/ceph/src/main/java/org/apache/cloudstack/storage/datastore/driver/CephObjectStoreDriverImpl.java
+++
b/plugins/storage/object/ceph/src/main/java/org/apache/cloudstack/storage/datastore/driver/CephObjectStoreDriverImpl.java
@@ -302,13 +302,20 @@ public class CephObjectStoreDriverImpl extends
BaseObjectStoreDriverImpl {
public Map<String, Long> getAllBucketsUsage(long storeId) {
RgwAdmin rgwAdmin = getRgwAdminClient(storeId);
try {
- List<BucketInfo> bucketinfo = rgwAdmin.listBucketInfo();
- Map<String, Long> bucketsusage = new HashMap<String, Long>();
- for (BucketInfo bucket: bucketinfo) {
+ logger.debug("Fetching statistics for all buckets accessible by
the RGW administrator of the provider with ID [{}].", storeId);
+ List<BucketInfo> bucketsInfo = rgwAdmin.listBucketInfo();
+ Map<String, Long> bucketsUsage = new HashMap<>();
+ for (BucketInfo bucket : bucketsInfo) {
BucketInfo.Usage usage = bucket.getUsage();
- bucketsusage.put(bucket.getBucket(),
usage.getRgwMain().getSize_kb());
+ if (usage == null || usage.getRgwMain() == null) {
+ logger.debug("Skipping bucket [{}] because RGW usage
information is unavailable.", bucket.getBucket());
+ continue;
+ }
+
+ bucketsUsage.put(bucket.getBucket(),
usage.getRgwMain().getSize());
}
- return bucketsusage;
+
+ return bucketsUsage;
} catch (Exception e) {
throw new CloudRuntimeException(e);
}