You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ed...@apache.org on 2013/06/20 03:18:09 UTC

[48/51] [abbrv] git commit: updated refs/heads/object_store to 9aec9c6

CLOUDSTACK-1405: add scope type in liststoragepoolcmd


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

Branch: refs/heads/object_store
Commit: 11b9d5ff6442aafede62502a59b035f52b28c633
Parents: fde6637
Author: Edison Su <su...@gmail.com>
Authored: Wed Jun 19 14:08:12 2013 -0700
Committer: Edison Su <su...@gmail.com>
Committed: Wed Jun 19 14:09:49 2013 -0700

----------------------------------------------------------------------
 .../api/command/admin/storage/ListStoragePoolsCmd.java  |  8 ++++++++
 server/src/com/cloud/api/query/QueryManagerImpl.java    | 12 ++++++++++++
 2 files changed, 20 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/11b9d5ff/api/src/org/apache/cloudstack/api/command/admin/storage/ListStoragePoolsCmd.java
----------------------------------------------------------------------
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 85a3c22..f33b987 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;
+    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/11b9d5ff/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 ad29cda..c851e3b 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<List<StoragePoolJoinVO>, 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<List<StoragePoolJoinVO>, Integer> uniquePoolPair = _poolJoinDao.searchAndCount(sc, searchFilter);