cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jessicaw...@apache.org
Subject git commit: updated refs/heads/master to cdd459b
Date Wed, 24 Apr 2013 17:38:39 GMT
Updated Branches:
  refs/heads/master b7f5197c8 -> cdd459bb0


CLOUDSTACK-2120: mixed zone management - (1) extend listVirtualMachines API to to take in
zonetype. (2) UI: populate Instances 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/cdd459bb
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/cdd459bb
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/cdd459bb

Branch: refs/heads/master
Commit: cdd459bb0bfb502df056a553a42735d4bd8f0e31
Parents: b7f5197
Author: Jessica Wang <jessicawang@apache.org>
Authored: Wed Apr 24 10:35:47 2013 -0700
Committer: Jessica Wang <jessicawang@apache.org>
Committed: Wed Apr 24 10:38:28 2013 -0700

----------------------------------------------------------------------
 .../cloudstack/api/command/user/vm/ListVMsCmd.java |    7 +++
 .../src/com/cloud/api/query/QueryManagerImpl.java  |   14 ++++-
 server/src/com/cloud/server/Criteria.java          |    1 +
 ui/scripts/instances.js                            |   38 +++++----------
 4 files changed, 32 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cdd459bb/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 dae9df3..d93d657 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
@@ -79,6 +79,9 @@ public class ListVMsCmd extends BaseListTaggedResourcesCmd {
             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")
+    private String zoneType;
+    
     @Parameter(name=ApiConstants.FOR_VIRTUAL_NETWORK, type=CommandType.BOOLEAN,
             description="list by network type; true if need to list vms using Virtual Network,
false otherwise")
     private Boolean forVirtualNetwork;
@@ -147,6 +150,10 @@ public class ListVMsCmd extends BaseListTaggedResourcesCmd {
         return zoneId;
     }
 
+    public String getZoneType() {
+        return zoneType;
+    }
+    
     public Boolean getForVirtualNetwork() {
         return forVirtualNetwork;
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cdd459bb/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 2298252..d0b4237 100644
--- a/server/src/com/cloud/api/query/QueryManagerImpl.java
+++ b/server/src/com/cloud/api/query/QueryManagerImpl.java
@@ -632,6 +632,7 @@ public class QueryManagerImpl extends ManagerBase implements QueryService
{
         c.addCriteria(Criteria.NAME, cmd.getInstanceName());
         c.addCriteria(Criteria.STATE, cmd.getState());
         c.addCriteria(Criteria.DATACENTERID, cmd.getZoneId());
+        c.addCriteria(Criteria.DATACENTERTYPE, cmd.getZoneType());
         c.addCriteria(Criteria.GROUPID, cmd.getGroupId());
         c.addCriteria(Criteria.FOR_VIRTUAL_NETWORK, cmd.getForVirtualNetwork());
         c.addCriteria(Criteria.NETWORKID, cmd.getNetworkId());
@@ -680,7 +681,8 @@ public class QueryManagerImpl extends ManagerBase implements QueryService
{
         Object name = c.getCriteria(Criteria.NAME);
         Object state = c.getCriteria(Criteria.STATE);
         Object notState = c.getCriteria(Criteria.NOTSTATE);
-        Object zone = c.getCriteria(Criteria.DATACENTERID);
+        Object zoneId = c.getCriteria(Criteria.DATACENTERID);
+        Object zoneType = c.getCriteria(Criteria.DATACENTERTYPE);
         Object pod = c.getCriteria(Criteria.PODID);
         Object hostId = c.getCriteria(Criteria.HOSTID);
         Object hostName = c.getCriteria(Criteria.HOSTNAME);
@@ -703,6 +705,7 @@ public class QueryManagerImpl extends ManagerBase implements QueryService
{
         sb.and("stateNEQ", sb.entity().getState(), SearchCriteria.Op.NEQ);
         sb.and("stateNIN", sb.entity().getState(), SearchCriteria.Op.NIN);
         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);
         sb.and("hypervisorType", sb.entity().getHypervisorType(), SearchCriteria.Op.EQ);
         sb.and("hostIdEQ", sb.entity().getHostId(), SearchCriteria.Op.EQ);
@@ -809,13 +812,18 @@ public class QueryManagerImpl extends ManagerBase implements QueryService
{
             sc.setParameters("stateNIN", "Destroyed", "Expunging");
         }
 
-        if (zone != null) {
-            sc.setParameters("dataCenterId", zone);
+        if (zoneId != null) {
+            sc.setParameters("dataCenterId", zoneId);
 
             if (state == null) {
                 sc.setParameters("stateNEQ", "Destroyed");
             }
         }
+        
+        if (zoneType != null) {
+        	sc.setParameters("dataCenterType", zoneType);
+        }
+        
         if (pod != null) {
             sc.setParameters("podId", pod);
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cdd459bb/server/src/com/cloud/server/Criteria.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/server/Criteria.java b/server/src/com/cloud/server/Criteria.java
index d54aaf5..cbe022a 100755
--- a/server/src/com/cloud/server/Criteria.java
+++ b/server/src/com/cloud/server/Criteria.java
@@ -32,6 +32,7 @@ public class Criteria {
 	public static final String NOTSTATE = "notState";
 	public static final String STATE = "state";
 	public static final String DATACENTERID = "dataCenterId";
+	public static final String DATACENTERTYPE = "dataCenterType";
 	public static final String DESCRIPTION = "description";
 	public static final String PODID = "podId";
 	public static final String CLUSTERID = "clusterId";

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cdd459bb/ui/scripts/instances.js
----------------------------------------------------------------------
diff --git a/ui/scripts/instances.js b/ui/scripts/instances.js
index 3a43c60..0c4c7d2 100644
--- a/ui/scripts/instances.js
+++ b/ui/scripts/instances.js
@@ -194,38 +194,26 @@
 				}
 
         if("hosts" in args.context) {
-					$.extend(data, {
-					  hostid: args.context.hosts[0].id
-					});
-				}
-
+	  $.extend(data, {
+	    hostid: args.context.hosts[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('listVirtualMachines'),
           data: data,
           success: function(json) {
-            var items = json.listvirtualmachinesresponse.virtualmachine;
-           // Code for hiding "Expunged VMs"
-           /* if(items != null) {
-            var i=0;
-            for( i=0;i< items.length;i++){
-              if(items[i].state == 'Expunging')
-                args.response.success ({
-
-              });
-            else {
+            var items = json.listvirtualmachinesresponse.virtualmachine;           
             args.response.success({
               actionFilter: vmActionfilter,
-              data: items[i]
-             });
-            }
-           }
-          }
-          else {*/
-             args.response.success({
-              actionFilter: vmActionfilter,
               data: items
-             });
-
+            });
           }
         });
       },


Mime
View raw message