diff --git a/api/src/org/apache/cloudstack/api/command/admin/storage/ListStoragePoolsCmd.java b/api/src/org/apache/cloudstack/api/command/admin/storage/ListStoragePoolsCmd.java index 85a3c22a3e2..f33b9877662 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/storage/ListStoragePoolsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/storage/ListStoragePoolsCmd.java @@ -64,6 +64,10 @@ public class ListStoragePoolsCmd extends BaseListCmd { description="the ID of the storage pool") private Long id; + @Parameter(name=ApiConstants.SCOPE, type=CommandType.STRING, entityType = StoragePoolResponse.class, + description="the ID of the storage pool") + private String scope; + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -115,4 +119,8 @@ public class ListStoragePoolsCmd extends BaseListCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } + + public String getScope() { + return scope; + } } diff --git a/server/src/com/cloud/api/query/QueryManagerImpl.java b/server/src/com/cloud/api/query/QueryManagerImpl.java index ad29cda576b..c851e3bcf8c 100644 --- a/server/src/com/cloud/api/query/QueryManagerImpl.java +++ b/server/src/com/cloud/api/query/QueryManagerImpl.java @@ -55,6 +55,7 @@ import org.apache.cloudstack.api.command.user.volume.ListResourceDetailsCmd; import org.apache.cloudstack.api.command.user.volume.ListVolumesCmd; import org.apache.cloudstack.api.command.user.zone.ListZonesByCmd; import org.apache.cloudstack.api.response.*; +import org.apache.cloudstack.engine.subsystem.api.storage.ScopeType; import org.apache.cloudstack.query.QueryService; import org.apache.log4j.Logger; import org.springframework.stereotype.Component; @@ -1862,6 +1863,14 @@ public class QueryManagerImpl extends ManagerBase implements QueryService { } private Pair, Integer> searchForStoragePoolsInternal(ListStoragePoolsCmd cmd) { + ScopeType scopeType = null; + if (cmd.getScope() != null) { + try { + scopeType = Enum.valueOf(ScopeType.class, cmd.getScope().toUpperCase()); + } catch (Exception e) { + throw new InvalidParameterValueException("Invalid scope type: " + cmd.getScope()); + } + } Long zoneId = _accountMgr.checkAccessAndSpecifyAuthority(UserContext.current().getCaller(), cmd.getZoneId()); Object id = cmd.getId(); @@ -1922,6 +1931,9 @@ public class QueryManagerImpl extends ManagerBase implements QueryService { if (cluster != null) { sc.setParameters("clusterId", cluster); } + if (scopeType != null) { + sc.setParameters("scope", scopeType.toString()); + } // search Pool details by ids Pair, Integer> uniquePoolPair = _poolJoinDao.searchAndCount(sc, searchFilter);