Skip to content

Commit 4e22e64

Browse files
committed
#4378: Remove last host from excludes list
1 parent eadffe9 commit 4e22e64

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
@@ -5729,14 +5729,12 @@ public VirtualMachine migrateVirtualMachine(Long vmId, Host destinationHost) thr
57295729

57305730
DeployDestination dest = null;
57315731
if (destinationHost == null) {
5732+
vm.setLastHostId(null); // Last host does not have higher priority in vm migration
57325733
final VirtualMachineProfile profile = new VirtualMachineProfileImpl(vm);
57335734
final Host host = _hostDao.findById(srcHostId);
57345735
final DataCenterDeployment plan = new DataCenterDeployment(host.getDataCenterId(), host.getPodId(), host.getClusterId(), null, null, null);
57355736
ExcludeList excludes = new ExcludeList();
57365737
excludes.addHost(srcHostId);
5737-
if (vm.getLastHostId() != null && vm.getLastHostId() != srcHostId) {
5738-
excludes.addHost(vm.getLastHostId());
5739-
}
57405738
try {
57415739
dest = _planningMgr.planDeployment(profile, plan, excludes, null);
57425740
} catch (final AffinityConflictException e2) {

0 commit comments

Comments
 (0)