Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
return bucketsusage;

return bucketsUsage;
} catch (Exception e) {
throw new CloudRuntimeException(e);
}
Expand Down
Loading