cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From prachida...@apache.org
Subject git commit: updated refs/heads/master to ff4a487
Date Fri, 19 Apr 2013 17:51:13 GMT
Updated Branches:
  refs/heads/master fc08c2372 -> ff4a4876c


Adding affinitygroupid search parameter to listVMsCmd


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

Branch: refs/heads/master
Commit: ff4a4876c767cec15e4248821cc48bb01bf55051
Parents: fc08c23
Author: Prachi Damle <prachi@cloud.com>
Authored: Fri Apr 19 10:49:04 2013 -0700
Committer: Prachi Damle <prachi@cloud.com>
Committed: Fri Apr 19 10:49:37 2013 -0700

----------------------------------------------------------------------
 .../org/apache/cloudstack/api/ApiConstants.java    |    1 +
 .../cloudstack/api/command/user/vm/ListVMsCmd.java |    9 +++++++
 .../src/com/cloud/api/query/QueryManagerImpl.java  |   18 +++++++++++---
 server/src/com/cloud/server/Criteria.java          |   11 +++++----
 4 files changed, 30 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ff4a4876/api/src/org/apache/cloudstack/api/ApiConstants.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/ApiConstants.java b/api/src/org/apache/cloudstack/api/ApiConstants.java
index edaaeb3..d73f309 100755
--- a/api/src/org/apache/cloudstack/api/ApiConstants.java
+++ b/api/src/org/apache/cloudstack/api/ApiConstants.java
@@ -479,6 +479,7 @@ public class ApiConstants {
     public static final String AFFINITY_GROUP_IDS = "affinitygroupids";
     public static final String AFFINITY_GROUP_NAMES = "affinitygroupnames";
     public static final String ASA_INSIDE_PORT_PROFILE = "insideportprofile";
+    public static final String AFFINITY_GROUP_ID = "affinitygroupid";
 
     public enum HostDetails {
         all, capacity, events, stats, min;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ff4a4876/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 08f9457..dae9df3 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
@@ -20,6 +20,7 @@ import java.util.ArrayList;
 import java.util.EnumSet;
 import java.util.List;
 
+import org.apache.cloudstack.affinity.AffinityGroupResponse;
 import org.apache.cloudstack.api.APICommand;
 import org.apache.cloudstack.api.ApiConstants;
 import org.apache.cloudstack.api.ApiConstants.VMDetails;
@@ -110,6 +111,10 @@ public class ListVMsCmd extends BaseListTaggedResourcesCmd {
     @Parameter(name=ApiConstants.VPC_ID, type=CommandType.UUID, entityType=VpcResponse.class,
             description="list vms by vpc")
     private Long vpcId;
+
+    @Parameter(name = ApiConstants.AFFINITY_GROUP_ID, type = CommandType.UUID, entityType
= AffinityGroupResponse.class, description = "list vms by affinity group")
+    private Long affinityGroupId;
+
     /////////////////////////////////////////////////////
     /////////////////// Accessors ///////////////////////
     /////////////////////////////////////////////////////
@@ -174,6 +179,10 @@ public class ListVMsCmd extends BaseListTaggedResourcesCmd {
         return vpcId;
     }
 
+    public Long getAffinityGroupId() {
+        return affinityGroupId;
+    }
+
     public EnumSet<VMDetails> getDetails() throws InvalidParameterValueException {
         EnumSet<VMDetails> dv;
         if (viewDetails==null || viewDetails.size() <=0){

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ff4a4876/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 3114ea5..2298252 100644
--- a/server/src/com/cloud/api/query/QueryManagerImpl.java
+++ b/server/src/com/cloud/api/query/QueryManagerImpl.java
@@ -638,6 +638,7 @@ public class QueryManagerImpl extends ManagerBase implements QueryService
{
         c.addCriteria(Criteria.TEMPLATE_ID, cmd.getTemplateId());
         c.addCriteria(Criteria.ISO_ID, cmd.getIsoId());
         c.addCriteria(Criteria.VPC_ID, cmd.getVpcId());
+        c.addCriteria(Criteria.AFFINITY_GROUP_ID, cmd.getAffinityGroupId());
 
         if (domainId != null) {
             c.addCriteria(Criteria.DOMAINID, domainId);
@@ -693,6 +694,7 @@ public class QueryManagerImpl extends ManagerBase implements QueryService
{
         Object templateId = c.getCriteria(Criteria.TEMPLATE_ID);
         Object isoId = c.getCriteria(Criteria.ISO_ID);
         Object vpcId = c.getCriteria(Criteria.VPC_ID);
+        Object affinityGroupId = c.getCriteria(Criteria.AFFINITY_GROUP_ID);
 
         sb.and("displayName", sb.entity().getDisplayName(), SearchCriteria.Op.LIKE);
         sb.and("id", sb.entity().getId(), SearchCriteria.Op.EQ);
@@ -733,6 +735,10 @@ public class QueryManagerImpl extends ManagerBase implements QueryService
{
             sb.and("poolId", sb.entity().getPoolId(), SearchCriteria.Op.EQ);
         }
 
+        if (affinityGroupId != null) {
+            sb.and("affinityGroupId", sb.entity().getAffinityGroupId(), SearchCriteria.Op.EQ);
+        }
+
         // populate the search criteria with the values passed in
         SearchCriteria<UserVmJoinVO> sc = sb.create();
 
@@ -830,6 +836,10 @@ public class QueryManagerImpl extends ManagerBase implements QueryService
{
             sc.setParameters("poolId", storageId);
         }
 
+        if (affinityGroupId != null) {
+            sc.setParameters("affinityGroupId", affinityGroupId);
+        }
+
         // search vm details by ids
         Pair<List<UserVmJoinVO>, Integer> uniqueVmPair =  _userVmJoinDao.searchAndCount(sc,
searchFilter);
         Integer count = uniqueVmPair.second();
@@ -1976,14 +1986,14 @@ public class QueryManagerImpl extends ManagerBase implements QueryService
{
                 domainRecord = _domainDao.findById(domainRecord.getParent());
                 domainIds.add(domainRecord.getId());
             }
-            
+
             SearchCriteria<DiskOfferingJoinVO> spc = _diskOfferingJoinDao.createSearchCriteria();
 
             spc.addOr("domainId", SearchCriteria.Op.IN, domainIds.toArray());
             spc.addOr("domainId", SearchCriteria.Op.NULL); // include public offering as
where
             sc.addAnd("domainId", SearchCriteria.Op.SC, spc);
             sc.addAnd("systemUse", SearchCriteria.Op.EQ, false); // non-root users should
not see system offering at all
-            
+
         }
 
          if (keyword != null) {
@@ -2001,7 +2011,7 @@ public class QueryManagerImpl extends ManagerBase implements QueryService
{
         if (name != null) {
             sc.addAnd("name", SearchCriteria.Op.EQ, name);
         }
-        
+
         // FIXME: disk offerings should search back up the hierarchy for
         // available disk offerings...
         /*
@@ -2081,7 +2091,7 @@ public class QueryManagerImpl extends ManagerBase implements QueryService
{
        // boolean includePublicOfferings = false;
         if ((caller.getType() == Account.ACCOUNT_TYPE_NORMAL || caller.getType() == Account.ACCOUNT_TYPE_DOMAIN_ADMIN)
                 || caller.getType() == Account.ACCOUNT_TYPE_RESOURCE_DOMAIN_ADMIN) {
-            // For non-root users. 
+            // For non-root users.
             if (isSystem) {
                 throw new InvalidParameterValueException("Only root admins can access system's
offering");
             }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ff4a4876/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 35186f8..d54aaf5 100755
--- a/server/src/com/cloud/server/Criteria.java
+++ b/server/src/com/cloud/server/Criteria.java
@@ -19,7 +19,7 @@ package com.cloud.server;
 import java.util.HashMap;
 
 public class Criteria {
-	
+
 	private Long offset;
 	private Long limit;
 	private String orderBy;
@@ -82,6 +82,7 @@ public class Criteria {
     public static final String TEMPLATE_ID = "templateid";
     public static final String ISO_ID = "isoid";
     public static final String VPC_ID = "vpcId";
+    public static final String AFFINITY_GROUP_ID = "affinitygroupid";
 
 	public Criteria(String orderBy, Boolean ascending, Long offset, Long limit) {
 		this.offset = offset;
@@ -90,7 +91,7 @@ public class Criteria {
 		this.ascending = ascending;
 		criteria = new HashMap<String, Object>();
 	}
-	
+
 	public Criteria() {
 		criteria = new HashMap<String, Object>();
 		this.ascending = false;
@@ -99,11 +100,11 @@ public class Criteria {
 	public Long getOffset() {
 		return offset;
 	}
-	
+
 	public void addCriteria(String name, Object val) {
 		criteria.put(name, val);
 	}
-	
+
 	public Object getCriteria(String name) {
 		return criteria.get(name);
 	}
@@ -135,5 +136,5 @@ public class Criteria {
 	public void setAscending(Boolean ascending) {
 		this.ascending = ascending;
 	}
-	
+
 }


Mime
View raw message