cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mtutkow...@apache.org
Subject [1/2] git commit: updated refs/heads/master to 5f16bf7
Date Fri, 30 Jan 2015 06:43:41 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/master 326a175c0 -> 5f16bf746


If the HypervisorType of a storage pool is Any, we need to retrieve hosts in the given zone
for each HypervisorType.


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

Branch: refs/heads/master
Commit: 31f67c2b3cb46359dbe1ff279141f8031a88e564
Parents: 326a175
Author: Mike Tutkowski <mike.tutkowski@solidfire.com>
Authored: Thu Jan 29 18:40:17 2015 -0700
Committer: Mike Tutkowski <mike.tutkowski@solidfire.com>
Committed: Thu Jan 29 19:18:04 2015 -0700

----------------------------------------------------------------------
 .../src/com/cloud/resource/ResourceManager.java      |  2 ++
 .../src/com/cloud/resource/ResourceManagerImpl.java  | 11 +++++++++++
 .../com/cloud/storage/StoragePoolAutomationImpl.java | 15 +++++++++++++--
 .../com/cloud/resource/MockResourceManagerImpl.java  |  6 ++++++
 4 files changed, 32 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/31f67c2b/engine/components-api/src/com/cloud/resource/ResourceManager.java
----------------------------------------------------------------------
diff --git a/engine/components-api/src/com/cloud/resource/ResourceManager.java b/engine/components-api/src/com/cloud/resource/ResourceManager.java
index 4f43adb..849387e 100644
--- a/engine/components-api/src/com/cloud/resource/ResourceManager.java
+++ b/engine/components-api/src/com/cloud/resource/ResourceManager.java
@@ -105,6 +105,8 @@ public interface ResourceManager extends ResourceService {
 
     public List<HostVO> listAllUpAndEnabledHostsInOneZoneByHypervisor(HypervisorType
type, long dcId);
 
+    public List<HostVO> listAllUpAndEnabledHostsInOneZone(long dcId);
+
     public List<HostVO> listAllHostsInOneZoneByType(Host.Type type, long dcId);
 
     public List<HostVO> listAllHostsInAllZonesByType(Type type);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/31f67c2b/server/src/com/cloud/resource/ResourceManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/resource/ResourceManagerImpl.java b/server/src/com/cloud/resource/ResourceManagerImpl.java
index b0215e7..d6dbff9 100644
--- a/server/src/com/cloud/resource/ResourceManagerImpl.java
+++ b/server/src/com/cloud/resource/ResourceManagerImpl.java
@@ -2532,6 +2532,17 @@ public class ResourceManagerImpl extends ManagerBase implements ResourceManager,
     }
 
     @Override
+    public List<HostVO> listAllUpAndEnabledHostsInOneZone(long dcId) {
+        QueryBuilder<HostVO> sc = QueryBuilder.create(HostVO.class);
+
+        sc.and(sc.entity().getDataCenterId(), Op.EQ, dcId);
+        sc.and(sc.entity().getStatus(), Op.EQ, Status.Up);
+        sc.and(sc.entity().getResourceState(), Op.EQ, ResourceState.Enabled);
+
+        return sc.list();
+    }
+
+    @Override
     public boolean isHostGpuEnabled(long hostId) {
         SearchCriteria<HostGpuGroupsVO> sc = _gpuAvailability.create();
         sc.setParameters("hostId", hostId);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/31f67c2b/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 59bd2a5..e086467 100644
--- a/server/src/com/cloud/storage/StoragePoolAutomationImpl.java
+++ b/server/src/com/cloud/storage/StoragePoolAutomationImpl.java
@@ -38,6 +38,7 @@ import com.cloud.agent.api.ModifyStoragePoolCommand;
 import com.cloud.alert.AlertManager;
 import com.cloud.host.HostVO;
 import com.cloud.host.Status;
+import com.cloud.hypervisor.Hypervisor.HypervisorType;
 import com.cloud.resource.ResourceManager;
 import com.cloud.server.ManagementServer;
 import com.cloud.storage.dao.StoragePoolHostDao;
@@ -128,7 +129,12 @@ public class StoragePoolAutomationImpl implements StoragePoolAutomation
{
             // 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());
+                if (HypervisorType.Any.equals(pool.getHypervisor())) {
+                    hosts = _resourceMgr.listAllUpAndEnabledHostsInOneZone(pool.getDataCenterId());
+                }
+                else {
+                    hosts = _resourceMgr.listAllUpAndEnabledHostsInOneZoneByHypervisor(pool.getHypervisor(),
pool.getDataCenterId());
+                }
             } else {
                 hosts = _resourceMgr.listHostsInClusterByStatus(pool.getClusterId(), Status.Up);
             }
@@ -290,7 +296,12 @@ public class StoragePoolAutomationImpl implements StoragePoolAutomation
{
         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());
+            if (HypervisorType.Any.equals(pool.getHypervisor())) {
+                hosts = _resourceMgr.listAllUpAndEnabledHostsInOneZone(pool.getDataCenterId());
+            }
+            else {
+                hosts = _resourceMgr.listAllUpAndEnabledHostsInOneZoneByHypervisor(poolVO.getHypervisor(),
pool.getDataCenterId());
+            }
         } else {
             hosts = _resourceMgr.listHostsInClusterByStatus(pool.getClusterId(), Status.Up);
         }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/31f67c2b/server/test/com/cloud/resource/MockResourceManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/resource/MockResourceManagerImpl.java b/server/test/com/cloud/resource/MockResourceManagerImpl.java
index 2646af0..fd10276 100644
--- a/server/test/com/cloud/resource/MockResourceManagerImpl.java
+++ b/server/test/com/cloud/resource/MockResourceManagerImpl.java
@@ -553,6 +553,12 @@ public class MockResourceManagerImpl extends ManagerBase implements ResourceMana
     }
 
     @Override
+    public List<HostVO> listAllUpAndEnabledHostsInOneZone(long dcId) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
     public boolean releaseHostReservation(Long hostId) {
         // TODO Auto-generated method stub
         return false;


Mime
View raw message