cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alena1...@apache.org
Subject git commit: updated refs/heads/master to bb6fddf
Date Thu, 27 Feb 2014 01:03:18 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/master a6f17675d -> bb6fddf43


listVirtualMachines API: ability to search by service offering the vm is created from
listVolumes API: ability to search by disk offering the volume is created from


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

Branch: refs/heads/master
Commit: bb6fddf434d9bc8aee6ee74e74652c39cb6e335e
Parents: a6f1767
Author: Alena Prokharchyk <alena.prokharchyk@citrix.com>
Authored: Wed Feb 26 16:48:27 2014 -0800
Committer: Alena Prokharchyk <alena.prokharchyk@citrix.com>
Committed: Wed Feb 26 16:56:33 2014 -0800

----------------------------------------------------------------------
 .../cloudstack/api/command/user/vm/ListVMsCmd.java  | 11 +++++++++--
 .../api/command/user/volume/ListVolumesCmd.java     | 11 +++++++++--
 .../src/com/cloud/api/query/QueryManagerImpl.java   | 16 ++++++++++++++++
 server/src/com/cloud/server/Criteria.java           |  1 +
 4 files changed, 35 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/bb6fddf4/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 54f735d..3c0c8b0 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,8 +20,6 @@ import java.util.ArrayList;
 import java.util.EnumSet;
 import java.util.List;
 
-import org.apache.log4j.Logger;
-
 import org.apache.cloudstack.affinity.AffinityGroupResponse;
 import org.apache.cloudstack.api.APICommand;
 import org.apache.cloudstack.api.ApiCommandJobType;
@@ -35,11 +33,13 @@ import org.apache.cloudstack.api.response.IsoVmResponse;
 import org.apache.cloudstack.api.response.ListResponse;
 import org.apache.cloudstack.api.response.NetworkResponse;
 import org.apache.cloudstack.api.response.PodResponse;
+import org.apache.cloudstack.api.response.ServiceOfferingResponse;
 import org.apache.cloudstack.api.response.StoragePoolResponse;
 import org.apache.cloudstack.api.response.TemplateResponse;
 import org.apache.cloudstack.api.response.UserVmResponse;
 import org.apache.cloudstack.api.response.VpcResponse;
 import org.apache.cloudstack.api.response.ZoneResponse;
+import org.apache.log4j.Logger;
 
 import com.cloud.exception.InvalidParameterValueException;
 
@@ -112,6 +112,9 @@ public class ListVMsCmd extends BaseListTaggedResourcesCmd {
     @Parameter(name = ApiConstants.AFFINITY_GROUP_ID, type = CommandType.UUID, entityType
= AffinityGroupResponse.class, description = "list vms by affinity group")
     private Long affinityGroupId;
 
+    @Parameter(name = ApiConstants.SERVICE_OFFERING_ID, type = CommandType.UUID, entityType
= ServiceOfferingResponse.class, description = "list by the service offering", since = "4.4")
+    private Long serviceOffId;
+
     /////////////////////////////////////////////////////
     /////////////////// Accessors ///////////////////////
     /////////////////////////////////////////////////////
@@ -140,6 +143,10 @@ public class ListVMsCmd extends BaseListTaggedResourcesCmd {
         return state;
     }
 
+    public Long getServiceOfferingId() {
+        return serviceOffId;
+    }
+
     public Long getZoneId() {
         return zoneId;
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/bb6fddf4/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 8c998a5..92afff4 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
@@ -16,14 +16,13 @@
 // under the License.
 package org.apache.cloudstack.api.command.user.volume;
 
-import org.apache.log4j.Logger;
-
 import org.apache.cloudstack.acl.RoleType;
 import org.apache.cloudstack.api.APICommand;
 import org.apache.cloudstack.api.ApiCommandJobType;
 import org.apache.cloudstack.api.ApiConstants;
 import org.apache.cloudstack.api.BaseListTaggedResourcesCmd;
 import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.response.DiskOfferingResponse;
 import org.apache.cloudstack.api.response.HostResponse;
 import org.apache.cloudstack.api.response.ListResponse;
 import org.apache.cloudstack.api.response.PodResponse;
@@ -31,6 +30,7 @@ import org.apache.cloudstack.api.response.StoragePoolResponse;
 import org.apache.cloudstack.api.response.UserVmResponse;
 import org.apache.cloudstack.api.response.VolumeResponse;
 import org.apache.cloudstack.api.response.ZoneResponse;
+import org.apache.log4j.Logger;
 
 @APICommand(name = "listVolumes", description = "Lists all volumes.", responseObject = VolumeResponse.class,
         requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
@@ -72,6 +72,9 @@ public class ListVolumesCmd extends BaseListTaggedResourcesCmd {
                authorized = {RoleType.Admin})
     private Long storageId;
 
+    @Parameter(name = ApiConstants.DISK_OFFERING_ID, type = CommandType.UUID, entityType
= DiskOfferingResponse.class, description = "list volumes by disk offering")
+    private Long diskOfferingId;
+
     /////////////////////////////////////////////////////
     /////////////////// Accessors ///////////////////////
     /////////////////////////////////////////////////////
@@ -92,6 +95,10 @@ public class ListVolumesCmd extends BaseListTaggedResourcesCmd {
         return podId;
     }
 
+    public Long getDiskOfferingId() {
+        return diskOfferingId;
+    }
+
     public String getType() {
         return type;
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/bb6fddf4/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 4d5a42f..6e2b36c 100644
--- a/server/src/com/cloud/api/query/QueryManagerImpl.java
+++ b/server/src/com/cloud/api/query/QueryManagerImpl.java
@@ -735,6 +735,7 @@ public class QueryManagerImpl extends ManagerBase implements QueryService
{
         c.addCriteria(Criteria.ISO_ID, cmd.getIsoId());
         c.addCriteria(Criteria.VPC_ID, cmd.getVpcId());
         c.addCriteria(Criteria.AFFINITY_GROUP_ID, cmd.getAffinityGroupId());
+        c.addCriteria(Criteria.SERVICE_OFFERING_ID, cmd.getServiceOfferingId());
 
         if (domainId != null) {
             c.addCriteria(Criteria.DOMAINID, domainId);
@@ -791,6 +792,7 @@ public class QueryManagerImpl extends ManagerBase implements QueryService
{
         Object isoId = c.getCriteria(Criteria.ISO_ID);
         Object vpcId = c.getCriteria(Criteria.VPC_ID);
         Object affinityGroupId = c.getCriteria(Criteria.AFFINITY_GROUP_ID);
+        Object serviceOffId = c.getCriteria(Criteria.SERVICE_OFFERING_ID);
 
         sb.and("displayName", sb.entity().getDisplayName(), SearchCriteria.Op.LIKE);
         sb.and("id", sb.entity().getId(), SearchCriteria.Op.EQ);
@@ -807,6 +809,10 @@ public class QueryManagerImpl extends ManagerBase implements QueryService
{
         sb.and("isoId", sb.entity().getIsoId(), SearchCriteria.Op.EQ);
         sb.and("instanceGroupId", sb.entity().getInstanceGroupId(), SearchCriteria.Op.EQ);
 
+        if (serviceOffId != null) {
+            sb.and("serviceOfferingId", sb.entity().getServiceOfferingId(), SearchCriteria.Op.EQ);
+        }
+
         if (groupId != null && (Long)groupId != -1) {
             sb.and("instanceGroupId", sb.entity().getInstanceGroupId(), SearchCriteria.Op.EQ);
         }
@@ -862,6 +868,10 @@ public class QueryManagerImpl extends ManagerBase implements QueryService
{
             sc.addAnd("displayName", SearchCriteria.Op.SC, ssc);
         }
 
+        if (serviceOffId != null) {
+            sc.setParameters("serviceOfferingId", serviceOffId);
+        }
+
         if (id != null) {
             sc.setParameters("id", id);
         }
@@ -1612,6 +1622,7 @@ public class QueryManagerImpl extends ManagerBase implements QueryService
{
         Map<String, String> tags = cmd.getTags();
         boolean isRootAdmin = _accountMgr.isRootAdmin(caller.getType());
         Long storageId = cmd.getStorageId();
+        Long diskOffId = cmd.getDiskOfferingId();
 
         Long zoneId = cmd.getZoneId();
         Long podId = null;
@@ -1645,6 +1656,7 @@ public class QueryManagerImpl extends ManagerBase implements QueryService
{
         sb.and("dataCenterId", sb.entity().getDataCenterId(), SearchCriteria.Op.EQ);
         sb.and("podId", sb.entity().getPodId(), SearchCriteria.Op.EQ);
         sb.and("storageId", sb.entity().getPoolId(), SearchCriteria.Op.EQ);
+        sb.and("diskOfferingId", sb.entity().getDiskOfferingId(), SearchCriteria.Op.EQ);
         // Only return volumes that are not destroyed
         sb.and("state", sb.entity().getState(), SearchCriteria.Op.NEQ);
         sb.and("systemUse", sb.entity().isSystemUse(), SearchCriteria.Op.NEQ);
@@ -1685,6 +1697,10 @@ public class QueryManagerImpl extends ManagerBase implements QueryService
{
             sc.addAnd("tagKey", SearchCriteria.Op.SC, tagSc);
         }
 
+        if (diskOffId != null) {
+            sc.setParameters("diskOfferingId", diskOffId);
+        }
+
         if (id != null) {
             sc.setParameters("id", id);
         }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/bb6fddf4/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 6ff8a28..de29e3e 100755
--- a/server/src/com/cloud/server/Criteria.java
+++ b/server/src/com/cloud/server/Criteria.java
@@ -84,6 +84,7 @@ public class Criteria {
     public static final String ISO_ID = "isoid";
     public static final String VPC_ID = "vpcId";
     public static final String AFFINITY_GROUP_ID = "affinitygroupid";
+    public static final String SERVICE_OFFERING_ID = "serviceofferingid";
 
     public Criteria(String orderBy, Boolean ascending, Long offset, Long limit) {
         this.offset = offset;


Mime
View raw message