diff --git a/server/src/com/cloud/api/commands/ListDomainChildrenCmd.java b/server/src/com/cloud/api/commands/ListDomainChildrenCmd.java index 10d0a01e5a3..9533b299685 100644 --- a/server/src/com/cloud/api/commands/ListDomainChildrenCmd.java +++ b/server/src/com/cloud/api/commands/ListDomainChildrenCmd.java @@ -47,7 +47,7 @@ public class ListDomainChildrenCmd extends BaseListCmd { @Parameter(name=ApiConstants.IS_RECURSIVE, type=CommandType.BOOLEAN, description="to return the entire tree, use the value \"true\". To return the first level children, use the value \"false\".") private Boolean recursive; - @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="list children domain by parent domain name.") + @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="list children domains by name") private String domainName; ///////////////////////////////////////////////////// diff --git a/server/src/com/cloud/user/AccountManagerImpl.java b/server/src/com/cloud/user/AccountManagerImpl.java index 4a22bedd11e..91141ea9af9 100755 --- a/server/src/com/cloud/user/AccountManagerImpl.java +++ b/server/src/com/cloud/user/AccountManagerImpl.java @@ -486,7 +486,6 @@ public class AccountManagerImpl implements AccountManager, AccountService { @Override public ResourceLimitVO updateResourceLimit(UpdateResourceLimitCmd cmd) { - Account account = UserContext.current().getAccount(); String accountName = cmd.getAccountName(); Long domainId = cmd.getDomainId(); @@ -509,12 +508,12 @@ public class AccountManagerImpl implements AccountManager, AccountService { } catch (ArrayIndexOutOfBoundsException e) { throw new InvalidParameterValueException("Please specify a valid resource type."); } - - /* - if (accountName==null && domainId != null && !domainId.equals(DomainVO.ROOT_DOMAIN)) { - throw new ServerApiException(BaseCmd.PARAM_ERROR, "Resource limits must be made for an account or the ROOT domain."); + + + // Either a domainId or an accountId must be passed in, but not both. + if ((domainId == null) && (accountName == null)) { + throw new InvalidParameterValueException("Either a domainId or domainId/account must be passed in."); } - */ if (account != null) { if (domainId != null) { @@ -544,13 +543,13 @@ public class AccountManagerImpl implements AccountManager, AccountService { } } } - } else if (domainId == null) { - domainId = DomainVO.ROOT_DOMAIN; // for system commands, default to root domain if domain is not specified - } + } - if (domainId == null) { - throw new InvalidParameterValueException("Unable to update resource limit, unable to determine domain in which to update limit."); - } else if (accountName != null) { + + if (accountName != null) { + if (domainId == null) { + throw new InvalidParameterValueException("domainId parameter is required if account is specified"); + } Account userAccount = _accountDao.findActiveAccount(accountName, domainId); if (userAccount == null) { throw new InvalidParameterValueException("unable to find account by name " + account.getAccountName() + " in domain with id " + domainId); @@ -560,10 +559,7 @@ public class AccountManagerImpl implements AccountManager, AccountService { if (accountId != null) domainId = null; - // Either a domainId or an accountId must be passed in, but not both. - if ((domainId == null) && (accountId == null)) { - throw new InvalidParameterValueException("Either a domainId or domainId/accountId must be passed in."); - } + // Check if the domain or account exists and is valid if (accountId != null) {