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

(cherry picked from commit 888ddd724a)
This commit is contained in:
Wei Zhou 2013-11-26 14:05:18 +01:00
parent 8970c95154
commit 3deb7dd6f5
1 changed files with 6 additions and 0 deletions

View File

@ -284,6 +284,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;
@ -318,6 +321,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;
}