|
30 | 30 | import java.util.Date; |
31 | 31 | import java.util.HashMap; |
32 | 32 | import java.util.HashSet; |
| 33 | +import java.util.Iterator; |
33 | 34 | import java.util.List; |
34 | 35 | import java.util.Map; |
35 | 36 | import java.util.Set; |
|
373 | 374 | import org.apache.cloudstack.api.command.user.vmsnapshot.ListVMSnapshotCmd; |
374 | 375 | import org.apache.cloudstack.api.command.user.vmsnapshot.RevertToVMSnapshotCmd; |
375 | 376 | import org.apache.cloudstack.api.command.user.volume.*; |
376 | | -import org.apache.cloudstack.api.command.user.volume.AttachVolumeCmd; |
377 | | -import org.apache.cloudstack.api.command.user.volume.CreateVolumeCmd; |
378 | | -import org.apache.cloudstack.api.command.user.volume.DeleteVolumeCmd; |
379 | | -import org.apache.cloudstack.api.command.user.volume.DetachVolumeCmd; |
380 | | -import org.apache.cloudstack.api.command.user.volume.ExtractVolumeCmd; |
381 | | -import org.apache.cloudstack.api.command.user.volume.ListVolumesCmd; |
382 | | -import org.apache.cloudstack.api.command.user.volume.MigrateVolumeCmd; |
383 | | -import org.apache.cloudstack.api.command.user.volume.ResizeVolumeCmd; |
384 | | -import org.apache.cloudstack.api.command.user.volume.UploadVolumeCmd; |
385 | 377 | import org.apache.cloudstack.api.command.user.vpc.CreateStaticRouteCmd; |
386 | 378 | import org.apache.cloudstack.api.command.user.vpc.CreateVPCCmd; |
387 | 379 | import org.apache.cloudstack.api.command.user.vpc.DeleteStaticRouteCmd; |
@@ -1184,10 +1176,11 @@ public Pair<List<? extends Host>, Integer> searchForServers(ListHostsCmd cmd) { |
1184 | 1176 | allHosts.remove(srcHost); |
1185 | 1177 |
|
1186 | 1178 | // Check if the host has storage pools for all the volumes of the vm to be migrated. |
1187 | | - for (Host host : allHosts) { |
| 1179 | + for (Iterator<HostVO> iterator = allHosts.iterator(); iterator.hasNext();) { |
| 1180 | + Host host = iterator.next(); |
1188 | 1181 | Map<Volume, List<StoragePool>> volumePools = findSuitablePoolsForVolumes(vmProfile, host); |
1189 | 1182 | if (volumePools.isEmpty()) { |
1190 | | - allHosts.remove(host); |
| 1183 | + iterator.remove(); |
1191 | 1184 | } else { |
1192 | 1185 | if (!host.getClusterId().equals(srcHost.getClusterId()) || usesLocal) { |
1193 | 1186 | requiresStorageMotion.put(host, true); |
|
0 commit comments