Updated Branches: refs/heads/master d4477ba8d -> 9e7356c68
CLOUDSTACK-3016: remove zonetype parameter from listSnapshots API. Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/9e7356c6 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/9e7356c6 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/9e7356c6 Branch: refs/heads/master Commit: 9e7356c686d098185e2481338e4e4169dcb95813 Parents: d4477ba Author: Jessica Wang <[email protected]> Authored: Mon Jun 17 14:58:51 2013 -0700 Committer: Jessica Wang <[email protected]> Committed: Mon Jun 17 15:00:44 2013 -0700 ---------------------------------------------------------------------- .../command/user/snapshot/ListSnapshotsCmd.java | 11 ++----- .../storage/snapshot/SnapshotManagerImpl.java | 34 +++++++------------- 2 files changed, 13 insertions(+), 32 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9e7356c6/api/src/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotsCmd.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotsCmd.java b/api/src/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotsCmd.java index e4ae769..611b127 100644 --- a/api/src/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotsCmd.java @@ -59,9 +59,6 @@ public class ListSnapshotsCmd extends BaseListTaggedResourcesCmd { @Parameter(name=ApiConstants.VOLUME_ID, type=CommandType.UUID, entityType = VolumeResponse.class, description="the ID of the disk volume") private Long volumeId; - - @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.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, description = "list snapshots by zone id") private Long zoneId; @@ -90,14 +87,10 @@ public class ListSnapshotsCmd extends BaseListTaggedResourcesCmd { return volumeId; } - public String getZoneType() { - return zoneType; - } - public Long getZoneId() { return zoneId; - } - + } + ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9e7356c6/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java b/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java index 02e3428..c720169 100755 --- a/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java +++ b/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java @@ -58,7 +58,6 @@ import com.cloud.configuration.Resource.ResourceType; import com.cloud.configuration.dao.ConfigurationDao; import com.cloud.dc.ClusterVO; import com.cloud.dc.DataCenter; -import com.cloud.dc.DataCenterVO; import com.cloud.dc.dao.ClusterDao; import com.cloud.dc.dao.DataCenterDao; import com.cloud.domain.dao.DomainDao; @@ -572,7 +571,6 @@ public class SnapshotManagerImpl extends ManagerBase implements SnapshotManager, String keyword = cmd.getKeyword(); String snapshotTypeStr = cmd.getSnapshotType(); String intervalTypeStr = cmd.getIntervalType(); - String zoneType = cmd.getZoneType(); Map<String, String> tags = cmd.getTags(); Long zoneId = cmd.getZoneId(); @@ -606,23 +604,17 @@ public class SnapshotManagerImpl extends ManagerBase implements SnapshotManager, sb.and("dataCenterId", sb.entity().getDataCenterId(), SearchCriteria.Op.EQ); if (tags != null && !tags.isEmpty()) { - SearchBuilder<ResourceTagVO> tagSearch = _resourceTagDao.createSearchBuilder(); - for (int count=0; count < tags.size(); count++) { - tagSearch.or().op("key" + String.valueOf(count), tagSearch.entity().getKey(), SearchCriteria.Op.EQ); - tagSearch.and("value" + String.valueOf(count), tagSearch.entity().getValue(), SearchCriteria.Op.EQ); - tagSearch.cp(); - } - tagSearch.and("resourceType", tagSearch.entity().getResourceType(), SearchCriteria.Op.EQ); - sb.groupBy(sb.entity().getId()); - sb.join("tagSearch", tagSearch, sb.entity().getId(), tagSearch.entity().getResourceId(), JoinBuilder.JoinType.INNER); - } + SearchBuilder<ResourceTagVO> tagSearch = _resourceTagDao.createSearchBuilder(); + for (int count=0; count < tags.size(); count++) { + tagSearch.or().op("key" + String.valueOf(count), tagSearch.entity().getKey(), SearchCriteria.Op.EQ); + tagSearch.and("value" + String.valueOf(count), tagSearch.entity().getValue(), SearchCriteria.Op.EQ); + tagSearch.cp(); + } + tagSearch.and("resourceType", tagSearch.entity().getResourceType(), SearchCriteria.Op.EQ); + sb.groupBy(sb.entity().getId()); + sb.join("tagSearch", tagSearch, sb.entity().getId(), tagSearch.entity().getResourceId(), JoinBuilder.JoinType.INNER); + } - if(zoneType != null) { - SearchBuilder<DataCenterVO> zoneSb = _dcDao.createSearchBuilder(); - zoneSb.and("zoneNetworkType", zoneSb.entity().getNetworkType(), SearchCriteria.Op.EQ); - sb.join("zoneSb", zoneSb, sb.entity().getDataCenterId(), zoneSb.entity().getId(), JoinBuilder.JoinType.INNER); - } - SearchCriteria<SnapshotVO> sc = sb.create(); _accountMgr.buildACLSearchCriteria(sc, domainId, isRecursive, permittedAccounts, listProjectResourcesCriteria); @@ -640,14 +632,10 @@ public class SnapshotManagerImpl extends ManagerBase implements SnapshotManager, } } - if(zoneType != null) { - sc.setJoinParameters("zoneSb", "zoneNetworkType", zoneType); - } - if (zoneId != null) { sc.setParameters("dataCenterId", zoneId); } - + if (name != null) { sc.setParameters("name", "%" + name + "%"); }
