You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by mt...@apache.org on 2015/01/30 07:43:41 UTC

[1/2] git commit: updated refs/heads/master to 5f16bf7

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 <mi...@solidfire.com>
Authored: Thu Jan 29 18:40:17 2015 -0700
Committer: Mike Tutkowski <mi...@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;


[2/2] git commit: updated refs/heads/master to 5f16bf7

Posted by mt...@apache.org.
When canceling maintenance mode, the logic was looking at the id field of the work object instead of the id field of the VM object.

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

Branch: refs/heads/master
Commit: 5f16bf746bdb98f4efdef0f17fed0a192a03f3cb
Parents: 31f67c2
Author: Mike Tutkowski <mi...@solidfire.com>
Authored: Thu Jan 29 23:11:29 2015 -0700
Committer: Mike Tutkowski <mi...@solidfire.com>
Committed: Thu Jan 29 23:11:29 2015 -0700

----------------------------------------------------------------------
 server/src/com/cloud/storage/StoragePoolAutomationImpl.java | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5f16bf74/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 e086467..92ed114 100644
--- a/server/src/com/cloud/storage/StoragePoolAutomationImpl.java
+++ b/server/src/com/cloud/storage/StoragePoolAutomationImpl.java
@@ -371,13 +371,14 @@ public class StoragePoolAutomationImpl implements StoragePoolAutomation {
 
                 // if the instance is of type user vm, call the user vm manager
                 if (vmInstance.getType().equals(VirtualMachine.Type.User)) {
-                    UserVmVO userVm = userVmDao.findById(vmInstance.getId());
                     // check if the vm has a root volume. If not, remove the item from the queue, the vm should be
                     // started only when it has at least one root volume attached to it
                     // don't allow to start vm that doesn't have a root volume
-                    if (volumeDao.findByInstanceAndType(work.getId(), Volume.Type.ROOT).isEmpty()) {
+                    if (volumeDao.findByInstanceAndType(vmInstance.getId(), Volume.Type.ROOT).isEmpty()) {
                         _storagePoolWorkDao.remove(work.getId());
                     } else {
+                        UserVmVO userVm = userVmDao.findById(vmInstance.getId());
+
                         vmMgr.advanceStart(userVm.getUuid(), null, null);
                         work.setStartedAfterMaintenance(true);
                         _storagePoolWorkDao.update(work.getId(), work);