mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Fix Vmware to KVM migration (#8485)
This PR fixes the Vmware to KVM migration issue on main branch Fixes: #8473
This commit is contained in:
parent
c43b7c04f4
commit
64f4480ef4
@ -1064,7 +1064,7 @@ public class UnmanagedVMsManagerImpl implements UnmanagedVMsManager {
|
||||
final VirtualMachineTemplate template, final String displayName, final String hostName, final Account caller, final Account owner, final Long userId,
|
||||
final ServiceOfferingVO serviceOffering, final Map<String, Long> dataDiskOfferingMap,
|
||||
final Map<String, Long> nicNetworkMap, final Map<String, Network.IpAddresses> callerNicIpAddressMap,
|
||||
final Map<String, String> details, final boolean migrateAllowed, final boolean forced) {
|
||||
final Map<String, String> details, final boolean migrateAllowed, final boolean forced, final boolean isImportUnmanagedFromSameHypervisor) {
|
||||
LOGGER.debug(LogUtils.logGsonWithoutException("Trying to import VM [%s] with name [%s], in zone [%s], cluster [%s], and host [%s], using template [%s], service offering [%s], disks map [%s], NICs map [%s] and details [%s].",
|
||||
unmanagedInstance, instanceName, zone, cluster, host, template, serviceOffering, dataDiskOfferingMap, nicNetworkMap, details));
|
||||
UserVm userVm = null;
|
||||
@ -1112,7 +1112,7 @@ public class UnmanagedVMsManagerImpl implements UnmanagedVMsManager {
|
||||
}
|
||||
}
|
||||
allDetails.put(VmDetailConstants.ROOT_DISK_CONTROLLER, rootDisk.getController());
|
||||
if (cluster.getHypervisorType() != Hypervisor.HypervisorType.VMware) {
|
||||
if (cluster.getHypervisorType() == Hypervisor.HypervisorType.KVM && isImportUnmanagedFromSameHypervisor) {
|
||||
allDetails.put(VmDetailConstants.ROOT_DISK_SIZE, String.valueOf(rootDisk.getCapacity() / Resource.ResourceType.bytesToGiB));
|
||||
}
|
||||
|
||||
@ -1512,7 +1512,7 @@ public class UnmanagedVMsManagerImpl implements UnmanagedVMsManager {
|
||||
template, displayName, hostName, CallContext.current().getCallingAccount(), owner, userId,
|
||||
serviceOffering, dataDiskOfferingMap,
|
||||
nicNetworkMap, nicIpAddressMap,
|
||||
details, migrateAllowed, forced);
|
||||
details, migrateAllowed, forced, true);
|
||||
break;
|
||||
}
|
||||
if (userVm != null) {
|
||||
@ -1582,7 +1582,7 @@ public class UnmanagedVMsManagerImpl implements UnmanagedVMsManager {
|
||||
template, displayName, hostName, caller, owner, userId,
|
||||
serviceOffering, dataDiskOfferingMap,
|
||||
nicNetworkMap, nicIpAddressMap,
|
||||
details, false, forced);
|
||||
details, false, forced, false);
|
||||
LOGGER.debug(String.format("VM %s imported successfully", sourceVM));
|
||||
return userVm;
|
||||
} catch (CloudRuntimeException e) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user