From 888ddd724aabbd22d675fe2bba873971888e1a8a Mon Sep 17 00:00:00 2001 From: Wei Zhou Date: Tue, 26 Nov 2013 14:05:18 +0100 Subject: [PATCH] CLOUDSTACK-5272: return unlimit if max.account.* or max.project.* is set to negative --- .../com/cloud/resourcelimit/ResourceLimitManagerImpl.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/server/src/com/cloud/resourcelimit/ResourceLimitManagerImpl.java b/server/src/com/cloud/resourcelimit/ResourceLimitManagerImpl.java index c18c06a3792..96b5b544644 100755 --- a/server/src/com/cloud/resourcelimit/ResourceLimitManagerImpl.java +++ b/server/src/com/cloud/resourcelimit/ResourceLimitManagerImpl.java @@ -280,6 +280,9 @@ public class ResourceLimitManagerImpl extends ManagerBase implements ResourceLim value = accountResourceLimitMap.get(type); } if (value != null) { + if (value < 0) { // return unlimit if value is set to negative + return max; + } // convert the value from GiB to bytes in case of primary or secondary storage. if (type == ResourceType.primary_storage || type == ResourceType.secondary_storage) { value = value * ResourceType.bytesToGiB; @@ -314,6 +317,9 @@ public class ResourceLimitManagerImpl extends ManagerBase implements ResourceLim value = accountResourceLimitMap.get(type); } if (value != null) { + if (value < 0) { // return unlimit if value is set to negative + return max; + } if (type == ResourceType.primary_storage || type == ResourceType.secondary_storage) { value = value * ResourceType.bytesToGiB; }