This is an automated email from the ASF dual-hosted git repository.
shwstppr pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudstack.git
The following commit(s) were added to refs/heads/main by this push:
new 64f4480ef41 Fix Vmware to KVM migration (#8485)
64f4480ef41 is described below
commit 64f4480ef4155e946ac257f78879e9c8002afe3d
Author: Nicolas Vazquez <[email protected]>
AuthorDate: Thu Jan 11 03:32:02 2024 -0300
Fix Vmware to KVM migration (#8485)
This PR fixes the Vmware to KVM migration issue on main branch
Fixes: #8473
---
.../java/org/apache/cloudstack/vm/UnmanagedVMsManagerImpl.java | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git
a/server/src/main/java/org/apache/cloudstack/vm/UnmanagedVMsManagerImpl.java
b/server/src/main/java/org/apache/cloudstack/vm/UnmanagedVMsManagerImpl.java
index 85f2119b4ca..3179bf12fea 100644
--- a/server/src/main/java/org/apache/cloudstack/vm/UnmanagedVMsManagerImpl.java
+++ b/server/src/main/java/org/apache/cloudstack/vm/UnmanagedVMsManagerImpl.java
@@ -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) {