Updated Branches:
  refs/heads/4.2 fe101f30a -> 888ddd724

CLOUDSTACK-5272: return unlimit if max.account.* or max.project.* is set to 
negative


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/888ddd72
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/888ddd72
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/888ddd72

Branch: refs/heads/4.2
Commit: 888ddd724aabbd22d675fe2bba873971888e1a8a
Parents: fe101f3
Author: Wei Zhou <[email protected]>
Authored: Tue Nov 26 14:05:18 2013 +0100
Committer: Wei Zhou <[email protected]>
Committed: Tue Nov 26 14:05:18 2013 +0100

----------------------------------------------------------------------
 .../src/com/cloud/resourcelimit/ResourceLimitManagerImpl.java  | 6 ++++++
 1 file changed, 6 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/888ddd72/server/src/com/cloud/resourcelimit/ResourceLimitManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/resourcelimit/ResourceLimitManagerImpl.java 
b/server/src/com/cloud/resourcelimit/ResourceLimitManagerImpl.java
index c18c06a..96b5b54 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;
                 }

Reply via email to