Skip to content

Commit 3aa0954

Browse files
committed
Fix bucket quota checks
1 parent 79f83db commit 3aa0954

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

server/src/main/java/org/apache/cloudstack/storage/object/BucketApiServiceImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,8 @@ public Bucket createBucket(CreateBucketCmd cmd) {
176176
if (objectStoreVO.getTotalSize() != null && objectStoreVO.getTotalSize() != 0 && objectStoreVO.getAllocatedSize() != null) {
177177
Long allocatedSize = objectStoreVO.getAllocatedSize() / Resource.ResourceType.bytesToGiB;
178178
Long totalSize = objectStoreVO.getTotalSize() / Resource.ResourceType.bytesToGiB;
179-
if (cmd.getQuota() + objectStoreVO.getAllocatedSize() > objectStoreVO.getTotalSize()) {
180-
logger.error("Object store {}'s allocated size has reached the total size limit of {}GiB.", objectStoreVO.getName(), (objectStoreVO.getTotalSize() / Resource.ResourceType.bytesToGiB));
179+
if (cmd.getQuota() + allocatedSize > totalSize) {
180+
logger.error("Object store {}'s allocated size has reached the total size limit of {}GiB.", objectStoreVO.getName(), totalSize);
181181
throw new CloudRuntimeException("Not enough space in object store to create the bucket");
182182
}
183183
}

0 commit comments

Comments
 (0)