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/07/02 20:22:48 UTC

git commit: updated refs/heads/4.2 to deaf10c

Updated Branches:
  refs/heads/4.2 724be3f5f -> deaf10cad


CLOUDSTACK-3089 [ZWPS] NPE while cancelling the Storage Maintenance

Signed-off-by: Edison Su <su...@gmail.com>


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

Branch: refs/heads/4.2
Commit: deaf10cad22a8fcf42663276df66365dea1ee3c7
Parents: 724be3f
Author: Rajesh Battala <ra...@citrix.com>
Authored: Fri Jun 28 14:31:33 2013 +0530
Committer: Edison Su <su...@gmail.com>
Committed: Tue Jul 2 11:22:18 2013 -0700

----------------------------------------------------------------------
 .../cloud/storage/StoragePoolAutomationImpl.java  | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/deaf10ca/server/src/com/cloud/storage/StoragePoolAutomationImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/StoragePoolAutomationImpl.java b/server/src/com/cloud/storage/StoragePoolAutomationImpl.java
index b2cb1f5..f6b39f1 100644
--- a/server/src/com/cloud/storage/StoragePoolAutomationImpl.java
+++ b/server/src/com/cloud/storage/StoragePoolAutomationImpl.java
@@ -23,12 +23,7 @@ import java.util.List;
 
 import javax.inject.Inject;
 
-import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
-import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreLifeCycle;
-import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager;
-import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreProvider;
-import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreProviderManager;
-import org.apache.cloudstack.engine.subsystem.api.storage.Scope;
+import org.apache.cloudstack.engine.subsystem.api.storage.*;
 import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
 import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
 import org.apache.log4j.Logger;
@@ -137,6 +132,7 @@ public class StoragePoolAutomationImpl implements StoragePoolAutomation {
             //Handeling the Zone wide and cluster wide primay storage
             List<HostVO> hosts = new ArrayList<HostVO>();
             // if the storage scope is ZONE wide, then get all the hosts for which hypervisor ZWSP created to send Modifystoragepoolcommand
+            //TODO: if it's zone wide, this code will list a lot of hosts in the zone, which may cause performance/OOM issue.
             if (pool.getScope().equals(ScopeType.ZONE)) {
                 hosts = _resourceMgr.listAllUpAndEnabledHostsInOneZoneByHypervisor(pool.getHypervisor() , pool.getDataCenterId());
             } else {
@@ -366,8 +362,16 @@ public class StoragePoolAutomationImpl implements StoragePoolAutomation {
                 .findById(store.getId());
         StoragePool pool = (StoragePool)store;
 
-        List<HostVO> hosts = _resourceMgr.listHostsInClusterByStatus(
+        //Handeling the Zone wide and cluster wide primay storage
+        List<HostVO> hosts = new ArrayList<HostVO>();
+        // if the storage scope is ZONE wide, then get all the hosts for which hypervisor ZWSP created to send Modifystoragepoolcommand
+        if (poolVO.getScope().equals(ScopeType.ZONE)) {
+            hosts = _resourceMgr.listAllUpAndEnabledHostsInOneZoneByHypervisor(poolVO.getHypervisor(), pool.getDataCenterId());
+        } else {
+            hosts = _resourceMgr.listHostsInClusterByStatus(
                 pool.getClusterId(), Status.Up);
+        }
+
         if (hosts == null || hosts.size() == 0) {
             return true;
         }