Alena,

Should the line
 sb.and("zoneId", sb.entity().getZoneId(), SearchCriteria.Op.LIKE);
be  SearchCriteria.Op.EQ ?




2014-01-30 <alena1...@apache.org>

> Updated Branches:
>   refs/heads/master 13e6c2fe7 -> cb073e063
>
>
> listAutoscaleVmProfiles: added zoneId to the list of optional api
> parameters
>
>
> Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
> Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/cb073e06
> Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/cb073e06
> Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/cb073e06
>
> Branch: refs/heads/master
> Commit: cb073e063450097f348fd2afd4006487ca99919a
> Parents: 13e6c2f
> Author: Alena Prokharchyk <alena.prokharc...@citrix.com>
> Authored: Thu Jan 30 11:57:12 2014 -0800
> Committer: Alena Prokharchyk <alena.prokharc...@citrix.com>
> Committed: Thu Jan 30 12:36:56 2014 -0800
>
> ----------------------------------------------------------------------
>  .../command/user/autoscale/ListAutoScaleVmProfilesCmd.java   | 8 ++++++++
>  server/src/com/cloud/network/as/AutoScaleManagerImpl.java    | 6 ++++++
>  2 files changed, 14 insertions(+)
> ----------------------------------------------------------------------
>
>
>
> http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cb073e06/api/src/org/apache/cloudstack/api/command/user/autoscale/ListAutoScaleVmProfilesCmd.java
> ----------------------------------------------------------------------
> diff --git
> a/api/src/org/apache/cloudstack/api/command/user/autoscale/ListAutoScaleVmProfilesCmd.java
> b/api/src/org/apache/cloudstack/api/command/user/autoscale/ListAutoScaleVmProfilesCmd.java
> index 34c2543..5b4a46e 100644
> ---
> a/api/src/org/apache/cloudstack/api/command/user/autoscale/ListAutoScaleVmProfilesCmd.java
> +++
> b/api/src/org/apache/cloudstack/api/command/user/autoscale/ListAutoScaleVmProfilesCmd.java
> @@ -27,6 +27,7 @@ import
> org.apache.cloudstack.api.response.AutoScaleVmProfileResponse;
>  import org.apache.cloudstack.api.response.ListResponse;
>  import org.apache.cloudstack.api.response.ServiceOfferingResponse;
>  import org.apache.cloudstack.api.response.TemplateResponse;
> +import org.apache.cloudstack.api.response.ZoneResponse;
>  import org.apache.log4j.Logger;
>
>  import com.cloud.network.as.AutoScaleVmProfile;
> @@ -53,6 +54,9 @@ public class ListAutoScaleVmProfilesCmd extends
> BaseListProjectAndAccountResourc
>      @Parameter(name = ApiConstants.OTHER_DEPLOY_PARAMS, type =
> CommandType.STRING, description = "the otherdeployparameters of the
> autoscale vm profile")
>      private String otherDeployParams;
>
> +    @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID,
> entityType = ZoneResponse.class, since = "4.4", description = "availability
> zone for the auto deployed virtual machine")
> +    private Long zoneId;
> +
>      // ///////////////////////////////////////////////////
>      // ///////////////// Accessors ///////////////////////
>      // ///////////////////////////////////////////////////
> @@ -73,10 +77,14 @@ public class ListAutoScaleVmProfilesCmd extends
> BaseListProjectAndAccountResourc
>          return serviceOffId;
>      }
>
> +    public Long getZoneId() {
> +        return zoneId;
> +    }
>      // ///////////////////////////////////////////////////
>      // ///////////// API Implementation///////////////////
>      // ///////////////////////////////////////////////////
>
> +
>      @Override
>      public String getCommandName() {
>          return s_name;
>
>
> http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cb073e06/server/src/com/cloud/network/as/AutoScaleManagerImpl.java
> ----------------------------------------------------------------------
> diff --git a/server/src/com/cloud/network/as/AutoScaleManagerImpl.java
> b/server/src/com/cloud/network/as/AutoScaleManagerImpl.java
> index 7492c9a..7eeec9c 100644
> --- a/server/src/com/cloud/network/as/AutoScaleManagerImpl.java
> +++ b/server/src/com/cloud/network/as/AutoScaleManagerImpl.java
> @@ -438,6 +438,7 @@ public class AutoScaleManagerImpl<Type> extends
> ManagerBase implements AutoScale
>          Long templateId = cmd.getTemplateId();
>          String otherDeployParams = cmd.getOtherDeployParams();
>          Long serviceOffId = cmd.getServiceOfferingId();
> +        Long zoneId = cmd.getZoneId();
>
>          SearchWrapper<AutoScaleVmProfileVO> searchWrapper = new
> SearchWrapper<AutoScaleVmProfileVO>(_autoScaleVmProfileDao,
> AutoScaleVmProfileVO.class, cmd, cmd.getId());
>          SearchBuilder<AutoScaleVmProfileVO> sb =
> searchWrapper.getSearchBuilder();
> @@ -446,6 +447,7 @@ public class AutoScaleManagerImpl<Type> extends
> ManagerBase implements AutoScale
>          sb.and("templateId", sb.entity().getTemplateId(),
> SearchCriteria.Op.EQ);
>          sb.and("serviceOfferingId", sb.entity().getServiceOfferingId(),
> SearchCriteria.Op.EQ);
>          sb.and("otherDeployParams", sb.entity().getOtherDeployParams(),
> SearchCriteria.Op.LIKE);
> +        sb.and("zoneId", sb.entity().getZoneId(), SearchCriteria.Op.LIKE);
>          SearchCriteria<AutoScaleVmProfileVO> sc =
> searchWrapper.buildSearchCriteria();
>
>          if (id != null) {
> @@ -462,6 +464,10 @@ public class AutoScaleManagerImpl<Type> extends
> ManagerBase implements AutoScale
>              sc.setParameters("serviceOfferingId", serviceOffId);
>          }
>
> +        if (zoneId != null) {
> +            sc.setParameters("zoneId", zoneId);
> +        }
> +
>          return searchWrapper.search();
>      }
>
>
>

Reply via email to