Updated Branches:
  refs/heads/master b2f0a0bce -> 8b237eb0a

CLOUDSTACK-5272: return unlimit if max.account.* or max.project.* is set to 
negative
(cherry picked from commit 888ddd724aabbd22d675fe2bba873971888e1a8a)


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

Branch: refs/heads/master
Commit: e0fbc3f14753a9d596dc0a23ec1758603b01e322
Parents: b2f0a0b
Author: Wei Zhou <w.z...@leaseweb.com>
Authored: Tue Nov 26 14:05:18 2013 +0100
Committer: Wei Zhou <w.z...@leaseweb.com>
Committed: Tue Nov 26 14:43:23 2013 +0100

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


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e0fbc3f1/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 9b46627..ed4c480 100755
--- a/server/src/com/cloud/resourcelimit/ResourceLimitManagerImpl.java
+++ b/server/src/com/cloud/resourcelimit/ResourceLimitManagerImpl.java
@@ -283,6 +283,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;
@@ -316,6 +319,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