davidjumani commented on a change in pull request #4375:
URL: https://github.com/apache/cloudstack/pull/4375#discussion_r504605112



##########
File path: server/src/main/java/com/cloud/server/ManagementServerImpl.java
##########
@@ -1278,33 +1277,24 @@ private HypervisorType getHypervisorType(VMInstanceVO 
vm, StoragePool srcVolumeP
         final Map<Host, Boolean> requiresStorageMotion = new HashMap<Host, 
Boolean>();
         DataCenterDeployment plan = null;
         if (canMigrateWithStorage) {
-            allHostsPair = searchForServers(startIndex, pageSize, null, 
hostType, null, srcHost.getDataCenterId(), null, null, null, keyword, null, 
null, srcHost.getHypervisorType(),
-                    srcHost.getHypervisorVersion());
+            allHostsPair = searchForServers(startIndex, pageSize, null, 
hostType, null, srcHost.getDataCenterId(), null, null, null, keyword,
+                null, null, srcHost.getHypervisorType(), 
srcHost.getHypervisorVersion(), srcHost.getId());
             allHosts = allHostsPair.first();
-            allHosts.remove(srcHost);
 
             for (final VolumeVO volume : volumes) {
                 StoragePool storagePool = 
_poolDao.findById(volume.getPoolId());
                 Long volClusterId = storagePool.getClusterId();
 
-                for (Iterator<HostVO> iterator = allHosts.iterator(); 
iterator.hasNext();) {
-                    final Host host = iterator.next();
-
+                for (HostVO host : allHosts) {
                     if (volClusterId != null) {
                         if (storagePool.isLocal() || 
!host.getClusterId().equals(volClusterId) || usesLocal) {
-                            if (storagePool.isManaged()) {
-                                // At the time being, we do not support 
storage migration of a volume from managed storage unless the managed storage
-                                // is at the zone level and the source and 
target storage pool is the same.
-                                // If the source and target storage pool is 
the same and it is managed, then we still have to perform a storage migration
-                                // because we need to create a new target 
volume and copy the contents of the source volume into it before deleting the
-                                // source volume.
-                                iterator.remove();
-                            } else {
-                                if (hasSuitablePoolsForVolume(volume, host, 
vmProfile)) {
-                                    requiresStorageMotion.put(host, true);
-                                } else {
-                                    iterator.remove();
-                                }
+                            // At the time being, we do not support storage 
migration of a volume from managed storage unless the managed storage

Review comment:
       Changed to use a cloned list `hostsWithStorageMigration` instead, but 
reutrning the original allHosts list to not mess up the pagination




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to