Skip to content

Commit de06a9a

Browse files
committed
#4378: look for host in same cluster in vm migration
1 parent 37e570f commit de06a9a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5635,7 +5635,7 @@ public VirtualMachine migrateVirtualMachine(Long vmId, Host destinationHost) thr
56355635
vm.setLastHostId(null); // Do not check last host
56365636
final VirtualMachineProfile profile = new VirtualMachineProfileImpl(vm);
56375637
final Host host = _hostDao.findById(srcHostId);
5638-
final DataCenterDeployment plan = new DataCenterDeployment(host.getDataCenterId(), null, null, null, null, null);
5638+
final DataCenterDeployment plan = new DataCenterDeployment(host.getDataCenterId(), host.getPodId(), host.getClusterId(), null, null, null);
56395639
ExcludeList excludes = new ExcludeList();
56405640
excludes.addHost(srcHostId);
56415641
try {
@@ -5652,7 +5652,7 @@ public VirtualMachine migrateVirtualMachine(Long vmId, Host destinationHost) thr
56525652

56535653
// If no suitable destination found then throw exception
56545654
if (dest == null) {
5655-
throw new RuntimeException("Unable to find suitable destination to migrate VM " + vm.getInstanceName());
5655+
throw new CloudRuntimeException("Unable to find suitable destination to migrate VM " + vm.getInstanceName());
56565656
}
56575657

56585658
UserVmVO uservm = _vmDao.findById(vmId);
@@ -7296,4 +7296,4 @@ private void checkUnmanagingVMVolumes(UserVmVO vm, List<VolumeVO> volumes) {
72967296
}
72977297
}
72987298
}
7299-
}
7299+
}

0 commit comments

Comments
 (0)