Skip to content

Commit 888ddd7

Browse files
committed
CLOUDSTACK-5272: return unlimit if max.account.* or max.project.* is set to negative
1 parent fe101f3 commit 888ddd7

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
@@ -280,6 +280,9 @@ public long findCorrectResourceLimitForAccount(Account account, ResourceType typ
280280
value = accountResourceLimitMap.get(type);
281281
}
282282
if (value != null) {
283+
if (value < 0) { // return unlimit if value is set to negative
284+
return max;
285+
}
283286
// convert the value from GiB to bytes in case of primary or secondary storage.
284287
if (type == ResourceType.primary_storage || type == ResourceType.secondary_storage) {
285288
value = value * ResourceType.bytesToGiB;
@@ -314,6 +317,9 @@ public long findCorrectResourceLimitForAccount(short accountType, Long limit, Re
314317
value = accountResourceLimitMap.get(type);
315318
}
316319
if (value != null) {
320+
if (value < 0) { // return unlimit if value is set to negative
321+
return max;
322+
}
317323
if (type == ResourceType.primary_storage || type == ResourceType.secondary_storage) {
318324
value = value * ResourceType.bytesToGiB;
319325
}

0 commit comments

Comments
 (0)