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


##########
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:
   thanks @bernardodemarco, that covers it



-- 
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