StepBee commented on code in PR #13776:
URL: https://github.com/apache/cloudstack/pull/13776#discussion_r4230866345


##########
plugins/storage/object/ceph/src/main/java/org/apache/cloudstack/storage/datastore/driver/CephObjectStoreDriverImpl.java:
##########
@@ -302,13 +302,20 @@ public void setBucketQuota(BucketTO bucket, long storeId, 
long size) {
     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_kb());

Review Comment:
   @bernardodemarco i uploaded around 3 GB to be sure.
   
   The logs show the debug log of your fix - so the fix is applied correctly:
   2026-10-09 12:03:41,697 DEBUG [o.a.c.s.d.d.CephObjectStoreDriverImpl] 
(Bucket-Usage-1:[ctx-8842af26]) (logid:b3759390) "Skipping bucket [emtpybucket] 
because RGW usage information is unavailable."
   
   looking at @Damans227 comment, that would make sense - unfortunately, at the 
moment i can't upload 1024 GB for testing to check your finding - but i could 
try to change the fix code and multiply
   usage.getRgwMain().getSize_kb() * 1024
   to save bytes instead if kbytes and re-check.
   
   I checked as well the number on the bucket detail page - it's showing in 
kbyte indeed.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to