diff --git a/server/src/com/cloud/api/ApiDBUtils.java b/server/src/com/cloud/api/ApiDBUtils.java index 21d713c6d35..1409961b167 100755 --- a/server/src/com/cloud/api/ApiDBUtils.java +++ b/server/src/com/cloud/api/ApiDBUtils.java @@ -713,8 +713,8 @@ public class ApiDBUtils { return _resourceLimitMgr.findCorrectResourceLimitForAccount(account, type); } - public static long findCorrectResourceLimit(Long limit, short accountType, ResourceType type) { - return _resourceLimitMgr.findCorrectResourceLimitForAccount(accountType, limit, type); + public static long findCorrectResourceLimit(Long limit, long accountId, ResourceType type) { + return _resourceLimitMgr.findCorrectResourceLimitForAccount(accountId, limit, type); } public static long getResourceCount(ResourceType type, long accountId) { diff --git a/server/src/com/cloud/api/query/dao/AccountJoinDaoImpl.java b/server/src/com/cloud/api/query/dao/AccountJoinDaoImpl.java index 16af8026302..dc65687d7e6 100644 --- a/server/src/com/cloud/api/query/dao/AccountJoinDaoImpl.java +++ b/server/src/com/cloud/api/query/dao/AccountJoinDaoImpl.java @@ -80,7 +80,7 @@ public class AccountJoinDaoImpl extends GenericDaoBase impl setResourceLimits(account, accountIsAdmin, accountResponse); //get resource limits for projects - long projectLimit = ApiDBUtils.findCorrectResourceLimit(account.getProjectLimit(), account.getType(), ResourceType.project); + long projectLimit = ApiDBUtils.findCorrectResourceLimit(account.getProjectLimit(), account.getId(), ResourceType.project); String projectLimitDisplay = (accountIsAdmin || projectLimit == -1) ? "Unlimited" : String.valueOf(projectLimit); long projectTotal = (account.getProjectTotal() == null) ? 0 : account.getProjectTotal(); String projectAvail = (accountIsAdmin || projectLimit == -1) ? "Unlimited" : String.valueOf(projectLimit - projectTotal); @@ -115,7 +115,7 @@ public class AccountJoinDaoImpl extends GenericDaoBase impl @Override public void setResourceLimits(AccountJoinVO account, boolean accountIsAdmin, ResourceLimitAndCountResponse response) { // Get resource limits and counts - long vmLimit = ApiDBUtils.findCorrectResourceLimit(account.getVmLimit(), account.getType(), ResourceType.user_vm); + long vmLimit = ApiDBUtils.findCorrectResourceLimit(account.getVmLimit(), account.getId(), ResourceType.user_vm); String vmLimitDisplay = (accountIsAdmin || vmLimit == -1) ? "Unlimited" : String.valueOf(vmLimit); long vmTotal = (account.getVmTotal() == null) ? 0 : account.getVmTotal(); String vmAvail = (accountIsAdmin || vmLimit == -1) ? "Unlimited" : String.valueOf(vmLimit - vmTotal);