Skip to content

Commit 3deb7dd

Browse files
committed
CLOUDSTACK-5272: return unlimit if max.account.* or max.project.* is set to negative
(cherry picked from commit 888ddd7)
1 parent 8970c95 commit 3deb7dd

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

‎server/src/com/cloud/resourcelimit/ResourceLimitManagerImpl.java‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,9 @@ public long findCorrectResourceLimitForAccount(Account account, ResourceType typ
284284
value = accountResourceLimitMap.get(type);
285285
}
286286
if (value != null) {
287+
if (value < 0) { // return unlimit if value is set to negative
288+
return max;
289+
}
287290
// convert the value from GiB to bytes in case of primary or secondary storage.
288291
if (type == ResourceType.primary_storage || type == ResourceType.secondary_storage) {
289292
value = value * ResourceType.bytesToGiB;
@@ -318,6 +321,9 @@ public long findCorrectResourceLimitForAccount(short accountType, Long limit, Re
318321
value = accountResourceLimitMap.get(type);
319322
}
320323
if (value != null) {
324+
if (value < 0) { // return unlimit if value is set to negative
325+
return max;
326+
}
321327
if (type == ResourceType.primary_storage || type == ResourceType.secondary_storage) {
322328
value = value * ResourceType.bytesToGiB;
323329
}

0 commit comments

Comments
 (0)