Upgrade router template by accountName and domainId instead of accountId

Conflicts:
	api/src/org/apache/cloudstack/api/command/admin/router/UpgradeRouterTemplateCmd.java
	server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
This commit is contained in:
Kishan Kavala 2013-12-12 12:08:21 +05:30
parent e08f64e6ae
commit fa38a7a409
2 changed files with 18 additions and 15 deletions

View File

@ -65,11 +65,9 @@ public class UpgradeRouterTemplateCmd extends org.apache.cloudstack.api.BaseCmd
@Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, description = "upgrades all routers within the specified zone")
private Long zoneId;
@Parameter(name = ApiConstants.ACCOUNT_ID,
type = CommandType.UUID,
entityType = AccountResponse.class,
description = "upgrades all routers owned by the specified account")
private Long accountId;
@Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING,
description="upgrades all routers owned by the specified account")
private String account;
@Parameter(name = ApiConstants.DOMAIN_ID,
type = CommandType.UUID,
@ -97,8 +95,8 @@ public class UpgradeRouterTemplateCmd extends org.apache.cloudstack.api.BaseCmd
return zoneId;
}
public Long getAccountId() {
return accountId;
public String getAccount() {
return account;
}
public Long getDomainId() {

View File

@ -4088,17 +4088,22 @@ public class VirtualNetworkApplianceManagerImpl extends ManagerBase implements V
}
}
Long accountId = cmd.getAccountId();
if (accountId != null) {
params++;
routers = _routerDao.listBy(accountId);
}
Long domainId = cmd.getDomainId();
if (domainId != null) {
params++;
if(domainId != null){
String accountName = cmd.getAccount();
//List by account, if account Name is specified along with domainId
if(accountName != null){
Account account = _accountMgr.getActiveAccountByName(accountName, domainId);
if(account == null){
throw new InvalidParameterValueException("Account :"+accountName+" does not exist in domain: "+domainId);
}
routers = _routerDao.listBy(account.getId());
} else {
//List by domainId, account name not specified
routers = _routerDao.listByDomain(domainId);
}
params++;
}
Long clusterId = cmd.getClusterId();
if (clusterId != null) {