You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ki...@apache.org on 2013/12/12 13:58:01 UTC

git commit: updated refs/heads/4.3 to 6a63fb4

Updated Branches:
  refs/heads/4.3 b52a641de -> 6a63fb446


Upgrade router template by accountName and domainId instead of accountId


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

Branch: refs/heads/4.3
Commit: 6a63fb4461c9b9a55359eb88240b3e6deeb722f7
Parents: b52a641
Author: Kishan Kavala <ki...@cloud.com>
Authored: Thu Dec 12 12:08:21 2013 +0530
Committer: Kishan Kavala <ki...@cloud.com>
Committed: Thu Dec 12 18:18:21 2013 +0530

----------------------------------------------------------------------
 .../admin/router/UpgradeRouterTemplateCmd.java   |  8 ++++----
 .../VirtualNetworkApplianceManagerImpl.java      | 19 ++++++++++++-------
 2 files changed, 16 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6a63fb44/api/src/org/apache/cloudstack/api/command/admin/router/UpgradeRouterTemplateCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/router/UpgradeRouterTemplateCmd.java b/api/src/org/apache/cloudstack/api/command/admin/router/UpgradeRouterTemplateCmd.java
index 1db22bc..8cce262 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/router/UpgradeRouterTemplateCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/router/UpgradeRouterTemplateCmd.java
@@ -69,9 +69,9 @@ public class UpgradeRouterTemplateCmd extends org.apache.cloudstack.api.BaseCmd
             description="upgrades all routers within the specified zone")
     private Long zoneId;
 
-    @Parameter(name=ApiConstants.ACCOUNT_ID, type=CommandType.UUID, entityType = AccountResponse.class,
+    @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING,
             description="upgrades all routers owned by the specified account")
-    private Long accountId;
+    private String account;
 
     @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.UUID, entityType=DomainResponse.class,
             description="upgrades all routers owned by the specified domain")
@@ -97,8 +97,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() {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6a63fb44/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
index faf47c1..4b030e8 100755
--- a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
+++ b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
@@ -4025,16 +4025,21 @@ 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){
+            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++;
-            routers = _routerDao.listByDomain(domainId);
         }
 
         Long clusterId = cmd.getClusterId();