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:59:00 UTC

git commit: updated refs/heads/master to fa38a7a

Updated Branches:
  refs/heads/master e08f64e6a -> fa38a7a40


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


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

Branch: refs/heads/master
Commit: fa38a7a409720a8c639b17f4f3a44e1fb0c45f08
Parents: e08f64e
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:28:30 2013 +0530

----------------------------------------------------------------------
 .../admin/router/UpgradeRouterTemplateCmd.java  | 12 +++++------
 .../VirtualNetworkApplianceManagerImpl.java     | 21 ++++++++++++--------
 2 files changed, 18 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/fa38a7a4/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 3a20a51..27fffc9 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
@@ -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() {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/fa38a7a4/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 2e8cde3..9ea3638 100755
--- a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
+++ b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
@@ -4088,16 +4088,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) {
+        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();