You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by je...@apache.org on 2013/04/24 20:27:10 UTC

git commit: updated refs/heads/master to d893ba8

Updated Branches:
  refs/heads/master 435f4bceb -> d893ba881


CLOUDSTACK-2120: mixed zone management - (1) extend listVolumes API to to take in zonetype. (2) UI: populate Volumes list page with instances whose zonetype matches selected option in zone type dropdown on top menu.


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

Branch: refs/heads/master
Commit: d893ba881b6ea00de00910a0d5f259b1397e16de
Parents: 435f4bc
Author: Jessica Wang <je...@apache.org>
Authored: Wed Apr 24 11:26:43 2013 -0700
Committer: Jessica Wang <je...@apache.org>
Committed: Wed Apr 24 11:26:58 2013 -0700

----------------------------------------------------------------------
 .../cloudstack/api/command/user/vm/ListVMsCmd.java |    3 +--
 .../api/command/user/volume/ListVolumesCmd.java    |    7 +++++++
 .../src/com/cloud/api/query/QueryManagerImpl.java  |    5 +++++
 ui/scripts/storage.js                              |   12 +++++++++---
 4 files changed, 22 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d893ba88/api/src/org/apache/cloudstack/api/command/user/vm/ListVMsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/ListVMsCmd.java b/api/src/org/apache/cloudstack/api/command/user/vm/ListVMsCmd.java
index d93d657..b2a2ce0 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vm/ListVMsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vm/ListVMsCmd.java
@@ -75,8 +75,7 @@ public class ListVMsCmd extends BaseListTaggedResourcesCmd {
     @Parameter(name=ApiConstants.STATE, type=CommandType.STRING, description="state of the virtual machine")
     private String state;
 
-    @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.UUID, entityType=ZoneResponse.class,
-            description="the availability zone ID")
+    @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.UUID, entityType=ZoneResponse.class, description="the availability zone ID")
     private Long zoneId;
 
     @Parameter(name=ApiConstants.ZONE_TYPE, type=CommandType.STRING, description="the network type of the zone that the virtual machine belongs to")

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d893ba88/api/src/org/apache/cloudstack/api/command/user/volume/ListVolumesCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/volume/ListVolumesCmd.java b/api/src/org/apache/cloudstack/api/command/user/volume/ListVolumesCmd.java
index 4c78eed..91316b0 100644
--- a/api/src/org/apache/cloudstack/api/command/user/volume/ListVolumesCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/volume/ListVolumesCmd.java
@@ -67,6 +67,9 @@ public class ListVolumesCmd extends BaseListTaggedResourcesCmd {
             description="the ID of the availability zone")
     private Long zoneId;
 
+    @Parameter(name=ApiConstants.ZONE_TYPE, type=CommandType.STRING, description="the network type of the zone that the virtual machine belongs to")
+    private String zoneType;
+    
     /////////////////////////////////////////////////////
     /////////////////// Accessors ///////////////////////
     /////////////////////////////////////////////////////
@@ -100,6 +103,10 @@ public class ListVolumesCmd extends BaseListTaggedResourcesCmd {
         return zoneId;
     }
 
+    public String getZoneType() {
+        return zoneType;
+    }
+    
     /////////////////////////////////////////////////////
     /////////////// API Implementation///////////////////
     /////////////////////////////////////////////////////

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d893ba88/server/src/com/cloud/api/query/QueryManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/query/QueryManagerImpl.java b/server/src/com/cloud/api/query/QueryManagerImpl.java
index d0b4237..ea260c3 100644
--- a/server/src/com/cloud/api/query/QueryManagerImpl.java
+++ b/server/src/com/cloud/api/query/QueryManagerImpl.java
@@ -1522,6 +1522,7 @@ public class QueryManagerImpl extends ManagerBase implements QueryService {
         Map<String, String> tags = cmd.getTags();
 
         Long zoneId = cmd.getZoneId();
+        String zoneType = cmd.getZoneType();
         Long podId = null;
         if (_accountMgr.isAdmin(caller.getType())) {
             podId = cmd.getPodId();
@@ -1549,6 +1550,7 @@ public class QueryManagerImpl extends ManagerBase implements QueryService {
         sb.and("volumeType", sb.entity().getVolumeType(), SearchCriteria.Op.LIKE);
         sb.and("instanceId", sb.entity().getVmId(), SearchCriteria.Op.EQ);
         sb.and("dataCenterId", sb.entity().getDataCenterId(), SearchCriteria.Op.EQ);
+        sb.and("dataCenterType", sb.entity().getDataCenterType(), SearchCriteria.Op.EQ);
         sb.and("podId", sb.entity().getPodId(), SearchCriteria.Op.EQ);
         // Only return volumes that are not destroyed
         sb.and("state", sb.entity().getState(), SearchCriteria.Op.NEQ);
@@ -1608,6 +1610,9 @@ public class QueryManagerImpl extends ManagerBase implements QueryService {
         if (zoneId != null) {
             sc.setParameters("dataCenterId", zoneId);
         }
+        if (zoneType != null) {
+        	sc.setParameters("dataCenterType", zoneType);
+        }
         if (podId != null) {
             sc.setParameters("podId", podId);
         }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d893ba88/ui/scripts/storage.js
----------------------------------------------------------------------
diff --git a/ui/scripts/storage.js b/ui/scripts/storage.js
index 1acc9c7..cf40769 100644
--- a/ui/scripts/storage.js
+++ b/ui/scripts/storage.js
@@ -398,12 +398,18 @@
            
             if(args.context != null) {
               if("instances" in args.context) {
-							  $.extend(data, {
-								  virtualMachineId: args.context.instances[0].id
-								});
+		$.extend(data, {
+		  virtualMachineId: args.context.instances[0].id
+		});
               }
             }
 
+            if(args.context.zoneType != null && args.context.zoneType.length > 0) { //Basic type or Advanced type
+              $.extend(data, {
+                zonetype: args.context.zoneType
+              });
+            }
+
             $.ajax({
               url: createURL('listVolumes'),
               data: data,