Skip to content

Commit e4758ae

Browse files
committed
#4378: Remove last host from excludes list
1 parent 3bc3773 commit e4758ae

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

server/src/main/java/com/cloud/vm/UserVmManagerImpl.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5632,14 +5632,12 @@ public VirtualMachine migrateVirtualMachine(Long vmId, Host destinationHost) thr
56325632

56335633
DeployDestination dest = null;
56345634
if (destinationHost == null) {
5635+
vm.setLastHostId(null); // Last host does not have higher priority in vm migration
56355636
final VirtualMachineProfile profile = new VirtualMachineProfileImpl(vm);
56365637
final Host host = _hostDao.findById(srcHostId);
56375638
final DataCenterDeployment plan = new DataCenterDeployment(host.getDataCenterId(), host.getPodId(), host.getClusterId(), null, null, null);
56385639
ExcludeList excludes = new ExcludeList();
56395640
excludes.addHost(srcHostId);
5640-
if (vm.getLastHostId() != null && vm.getLastHostId() != srcHostId) {
5641-
excludes.addHost(vm.getLastHostId());
5642-
}
56435641
try {
56445642
dest = _planningMgr.planDeployment(profile, plan, excludes, null);
56455643
} catch (final AffinityConflictException e2) {

0 commit comments

Comments
 (0)