Skip to content

Commit c2b4dc2

Browse files
committed
[Vmware to KVM Migration] Preserve boot type and boot mode of instances to be migrated
1 parent 823080c commit c2b4dc2

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

server/src/main/java/org/apache/cloudstack/vm/UnmanagedVMsManagerImpl.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1113,7 +1113,8 @@ private UserVm importVirtualMachineInternal(final UnmanagedInstanceTO unmanagedI
11131113
final VirtualMachineTemplate template, final String displayName, final String hostName, final Account caller, final Account owner, final Long userId,
11141114
final ServiceOfferingVO serviceOffering, final Map<String, Long> dataDiskOfferingMap,
11151115
final Map<String, Long> nicNetworkMap, final Map<String, Network.IpAddresses> callerNicIpAddressMap,
1116-
final Map<String, String> details, final boolean migrateAllowed, final boolean forced, final boolean isImportUnmanagedFromSameHypervisor) {
1116+
final Map<String, String> details, final boolean migrateAllowed, final boolean forced, final boolean isImportUnmanagedFromSameHypervisor,
1117+
final String bootType, final String bootMode) {
11171118
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].",
11181119
unmanagedInstance, instanceName, zone, cluster, host, template, serviceOffering, dataDiskOfferingMap, nicNetworkMap, details));
11191120
UserVm userVm = null;
@@ -1188,6 +1189,10 @@ private UserVm importVirtualMachineInternal(final UnmanagedInstanceTO unmanagedI
11881189
allDetails.put(VmDetailConstants.KVM_VNC_PASSWORD, unmanagedInstance.getVncPassword());
11891190
}
11901191

1192+
if (StringUtils.isNotBlank(bootType) && bootType.equalsIgnoreCase("uefi") && StringUtils.isNotBlank(bootMode)) {
1193+
allDetails.put("UEFI", bootMode);
1194+
}
1195+
11911196
VirtualMachine.PowerState powerState = VirtualMachine.PowerState.PowerOff;
11921197
if (unmanagedInstance.getPowerState().equals(UnmanagedInstanceTO.PowerState.PowerOn)) {
11931198
powerState = VirtualMachine.PowerState.PowerOn;
@@ -1564,7 +1569,8 @@ private UserVm importUnmanagedInstanceFromHypervisor(DataCenter zone, Cluster cl
15641569
template, displayName, hostName, CallContext.current().getCallingAccount(), owner, userId,
15651570
serviceOffering, dataDiskOfferingMap,
15661571
nicNetworkMap, nicIpAddressMap,
1567-
details, migrateAllowed, forced, true);
1572+
details, migrateAllowed, forced, true,
1573+
unmanagedInstance.getBootType(), unmanagedInstance.getBootMode());
15681574
break;
15691575
}
15701576
if (userVm != null) {
@@ -1684,7 +1690,8 @@ protected UserVm importUnmanagedInstanceFromVmwareToKvm(DataCenter zone, Cluster
16841690
template, displayName, hostName, caller, owner, userId,
16851691
serviceOffering, dataDiskOfferingMap,
16861692
nicNetworkMap, nicIpAddressMap,
1687-
details, false, forced, false);
1693+
details, false, forced, false,
1694+
sourceVMwareInstance.getBootType(), sourceVMwareInstance.getBootMode());
16881695
long timeElapsedInSecs = (System.currentTimeMillis() - importStartTime) / 1000;
16891696
logger.debug(String.format("VMware VM %s imported successfully to CloudStack instance %s (%s), Time taken: %d secs, OVF files imported from %s, Source VMware VM details - OS: %s, PowerState: %s, Disks: %s, NICs: %s",
16901697
sourceVMName, instanceName, displayName, timeElapsedInSecs, (ovfTemplateOnConvertLocation != null)? "MS" : "KVM Host", sourceVMwareInstance.getOperatingSystem(), sourceVMwareInstance.getPowerState(), sourceVMwareInstance.getDisks(), sourceVMwareInstance.getNics()));

ui/src/components/view/InfoCard.vue

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -728,6 +728,18 @@
728728
<span v-else>{{ resource.webhookname || resource.webhookid }}</span>
729729
</div>
730730
</div>
731+
<div class="resource-detail-item" v-if="resource.boottype">
732+
<div class="resource-detail-item__label">{{ $t('label.boottype') }}</div>
733+
<div class="resource-detail-item__details">
734+
<span>{{ resource.boottype }}</span>
735+
</div>
736+
</div>
737+
<div class="resource-detail-item" v-if="resource.bootmode">
738+
<div class="resource-detail-item__label">{{ $t('label.bootmode') }}</div>
739+
<div class="resource-detail-item__details">
740+
<span>{{ resource.bootmode }}</span>
741+
</div>
742+
</div>
731743
<div class="resource-detail-item" v-if="resource.managementserverid">
732744
<div class="resource-detail-item__label">{{ $t('label.management.servers') }}</div>
733745
<div class="resource-detail-item__details">

0 commit comments

Comments
 (0)