Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
7c04d06
VMware: add support for 8.0b (8.0.0.2)
weizhouapache Mar 29, 2023
186812e
VMware 8: add new guest os mappings in VirtualMachineGuestOsIdentifier
weizhouapache Mar 31, 2023
ae48f0d
VMware: get guest os mappings of parent version
weizhouapache Mar 31, 2023
746133f
VMware8: remove guest os mappings for 8.0.0.2
weizhouapache Mar 31, 2023
4e5dd95
VMware8: fix code smells
weizhouapache Mar 31, 2023
bd093f8
vmware: remove annotations in VmwareVmImplementerTest which caused 0.…
weizhouapache Apr 6, 2023
e13699b
VMware8: add a unit test case
weizhouapache Apr 14, 2023
a25b3a3
VMware: add support for 8.0c (8.0.0.3)
weizhouapache Apr 17, 2023
bee5705
VMware8: move to CloudStackVersion.getVMwareParentVersion
weizhouapache Apr 24, 2023
d6cd854
VMware: add support for 8.0u1 (8.0.1.0)
weizhouapache Apr 24, 2023
503d6eb
Copy engine/schema/src/main/java/com/cloud/upgrade/GuestOsMapper.java…
weizhouapache Apr 24, 2023
a9b6803
Copy engine/schema/src/main/java/com/cloud/storage/dao/GuestOSHypervi…
weizhouapache Apr 24, 2023
4facd6f
VMware: ignore the last number in VMware versions
weizhouapache Apr 24, 2023
f6be497
VMware: copy guest os mapping from 8.0 to 8.0.1
weizhouapache Apr 25, 2023
f813c9a
VMware: add unit tests in VmwareVmImplementerTest.java
weizhouapache Apr 25, 2023
d6cfa42
Copy engine/schema/src/test/java/com/cloud/upgrade/GuestOsMapperTest.…
weizhouapache Apr 25, 2023
d0b9b26
Merge remote-tracking branch 'apache/4.18' into 4.18.1-add-support-vm…
weizhouapache Apr 27, 2023
8de66f3
VMware8: retry vm poweron if fails due to exception "File system spec…
weizhouapache Apr 27, 2023
a2fcf0d
VMware: extract to method powerOnVM
weizhouapache Apr 27, 2023
9c00c8c
vmware: fix mistake in logs
weizhouapache Apr 27, 2023
6923d97
Merge remote-tracking branch 'apache/4.18' into 4.18.1-add-support-vm…
weizhouapache May 31, 2023
b1c08fd
vmware8: use curl instead of wget to fix test failures
weizhouapache May 31, 2023
c3c44ba
Merge remote-tracking branch 'apache/4.18' into 4.18.1-add-support-vm…
weizhouapache May 31, 2023
3caa0e7
Merge remote-tracking branch 'apache/4.18' into 4.18.1-add-support-vm…
weizhouapache Jun 19, 2023
8f9b180
Merge remote-tracking branch 'apache/4.18' into 4.18.1-add-support-vm…
weizhouapache Jun 23, 2023
4f7ba08
Merge remote-tracking branch 'apache/4.18' into 4.18.1-add-support-vm…
weizhouapache Jun 27, 2023
cd0ae4a
Merge remote-tracking branch 'apache/4.18' into 4.18.1-add-support-vm…
weizhouapache Jul 7, 2023
51a674e
Merge branch '4.18' into 4.18.1-add-support-vmware-8.0b
weizhouapache Jul 25, 2023
ef03da5
Merge branch '4.18' into 4.18.1-add-support-vmware-8.0b
weizhouapache Jul 26, 2023
90fe245
Merge remote-tracking branch 'apache/4.18' into 4.18.1-add-support-vm…
weizhouapache Jul 27, 2023
dc16479
VMware: correct guest OS names in hypervisor mappings for VMware 8.0
weizhouapache Jul 27, 2023
e838579
VMware: add Ubuntu 20.04 and 22.04 support for vmware 7.0+
weizhouapache Jul 27, 2023
59fb606
PR7380: only add guest os mappings for Ubuntu 20.04
weizhouapache Jul 27, 2023
7d5f3c7
PR7380: Correct RHEL9 guest os names and others for VMware 8.0
weizhouapache Jul 27, 2023
6126f95
PR7380: correct guest os names on 8.0.0.1 as well
weizhouapache Jul 27, 2023
7e56053
Merge branch '4.18' into 4.18.1-add-support-vmware-8.0b
weizhouapache Aug 4, 2023
06d9952
Merge branch '4.18' into 4.18.1-add-support-vmware-8.0b
weizhouapache Aug 11, 2023
fc07405
PR7380: remove Windows 12 and Windows Server 2025 which are not relea…
weizhouapache Aug 11, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,17 @@
// under the License.
package com.cloud.upgrade.dao;

import com.cloud.hypervisor.Hypervisor;
import com.cloud.storage.GuestOSHypervisorMapping;
import com.cloud.upgrade.GuestOsMapper;
import com.cloud.upgrade.SystemVmTemplateRegistration;
import com.cloud.utils.exception.CloudRuntimeException;
import org.apache.log4j.Logger;

import java.io.InputStream;
import java.sql.Connection;
import java.util.ArrayList;
import java.util.List;

public class Upgrade41800to41810 implements DbUpgrade, DbUpgradeSystemVmTemplate {
final static Logger LOG = Logger.getLogger(Upgrade41800to41810.class);
Expand Down Expand Up @@ -55,6 +60,7 @@ public InputStream[] getPrepareScripts() {

@Override
public void performDataMigration(Connection conn) {
updateGuestOsMappings();
}

@Override
Expand Down Expand Up @@ -82,4 +88,84 @@ public void updateSystemVmTemplates(Connection conn) {
throw new CloudRuntimeException("Failed to find / register SystemVM template(s)");
}
}

private void updateGuestOsMappings() {
LOG.debug("Updating guest OS mappings");

GuestOsMapper guestOsMapper = new GuestOsMapper();
List<GuestOSHypervisorMapping> mappings = new ArrayList<>();

final String hypervisorVMware = Hypervisor.HypervisorType.VMware.name();
final String hypervisorVersionVmware8 = "8.0";

// Add support for almalinux_64Guest from VMware 8.0
mappings.add(new GuestOSHypervisorMapping(hypervisorVMware, hypervisorVersionVmware8, "almalinux_64Guest"));
guestOsMapper.addGuestOsAndHypervisorMappings(1, "AlmaLinux (64-bit)", mappings);
mappings.clear();

// Add support for darwin22_64Guest from VMware 8.0
mappings.add(new GuestOSHypervisorMapping(hypervisorVMware, hypervisorVersionVmware8, "darwin22_64Guest"));
guestOsMapper.addGuestOsAndHypervisorMappings(7, "macOS 13 (64-bit)", mappings);
mappings.clear();

// Add support for darwin23_64Guest from VMware 8.0
mappings.add(new GuestOSHypervisorMapping(hypervisorVMware, hypervisorVersionVmware8, "darwin23_64Guest"));
guestOsMapper.addGuestOsAndHypervisorMappings(7, "macOS 14 (64-bit)", mappings);
mappings.clear();

// Add support for debian12_64Guest from VMware 8.0
mappings.add(new GuestOSHypervisorMapping(hypervisorVMware, hypervisorVersionVmware8, "debian12_64Guest"));
guestOsMapper.addGuestOsAndHypervisorMappings(2, "Debian GNU/Linux 12 (64-bit)", mappings);
mappings.clear();

// Add support for debian12Guest from VMware 8.0
mappings.add(new GuestOSHypervisorMapping(hypervisorVMware, hypervisorVersionVmware8, "debian12Guest"));
guestOsMapper.addGuestOsAndHypervisorMappings(2, "Debian GNU/Linux 12 (32-bit)", mappings);
mappings.clear();

// Add support for freebsd14_64Guest from VMware 8.0
mappings.add(new GuestOSHypervisorMapping(hypervisorVMware, hypervisorVersionVmware8, "freebsd14_64Guest"));
guestOsMapper.addGuestOsAndHypervisorMappings(9, "FreeBSD 14 (64-bit)", mappings);
mappings.clear();

// Add support for freebsd14Guest from VMware 8.0
mappings.add(new GuestOSHypervisorMapping(hypervisorVMware, hypervisorVersionVmware8, "freebsd14Guest"));
guestOsMapper.addGuestOsAndHypervisorMappings(9, "FreeBSD 14 (32-bit)", mappings);
mappings.clear();

// Add support for other6xLinux64Guest from VMware 8.0
mappings.add(new GuestOSHypervisorMapping(hypervisorVMware, hypervisorVersionVmware8, "other6xLinux64Guest"));
guestOsMapper.addGuestOsAndHypervisorMappings(7, "Linux 6.x Kernel (64-bit)", mappings);
mappings.clear();

// Add support for other6xLinuxGuest from VMware 8.0
mappings.add(new GuestOSHypervisorMapping(hypervisorVMware, hypervisorVersionVmware8, "other6xLinuxGuest"));
guestOsMapper.addGuestOsAndHypervisorMappings(7, "Linux 6.x Kernel (32-bit)", mappings);
mappings.clear();

// Add support for rockylinux_64Guest from VMware 8.0
mappings.add(new GuestOSHypervisorMapping(hypervisorVMware, hypervisorVersionVmware8, "rockylinux_64Guest"));
guestOsMapper.addGuestOsAndHypervisorMappings(1, "Rocky Linux (64-bit)", mappings);
mappings.clear();

// Add support for vmkernel8Guest from VMware 8.0
mappings.add(new GuestOSHypervisorMapping(hypervisorVMware, hypervisorVersionVmware8, "vmkernel8Guest"));
guestOsMapper.addGuestOsAndHypervisorMappings(7, "VMware ESXi 8.0", mappings);
mappings.clear();

// Add support for windows11_64Guest from VMware 8.0
mappings.add(new GuestOSHypervisorMapping(hypervisorVMware, hypervisorVersionVmware8, "windows11_64Guest"));
guestOsMapper.addGuestOsAndHypervisorMappings(6, "Windows 11 (64-bit)", mappings);
mappings.clear();

// Add support for windows12_64Guest from VMware 8.0
mappings.add(new GuestOSHypervisorMapping(hypervisorVMware, hypervisorVersionVmware8, "windows12_64Guest"));
guestOsMapper.addGuestOsAndHypervisorMappings(6, "Windows 12 (64-bit)", mappings);
mappings.clear();

// Add support for windows2022srvNext_64Guest from VMware 8.0
mappings.add(new GuestOSHypervisorMapping(hypervisorVMware, hypervisorVersionVmware8, "windows2022srvNext_64Guest"));
guestOsMapper.addGuestOsAndHypervisorMappings(6, "Windows Server 2025 (64-bit)", mappings);
mappings.clear();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@
-- Schema upgrade from 4.18.0.0 to 4.18.1.0
--;

-- Add support for VMware 8.0b (8.0.0.2)
INSERT IGNORE INTO `cloud`.`hypervisor_capabilities` (uuid, hypervisor_type, hypervisor_version, max_guests_limit, security_group_enabled, max_data_volumes_limit, max_hosts_per_cluster, storage_motion_supported, vm_snapshot_enabled) values (UUID(), 'VMware', '8.0.0.2', 1024, 0, 59, 64, 1, 1);

Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
import com.cloud.vm.dao.NicDao;
import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
import org.apache.cloudstack.storage.image.deployasis.DeployAsIsHelper;
import org.apache.cloudstack.utils.CloudStackVersion;
import org.apache.commons.lang.BooleanUtils;
import org.apache.log4j.Logger;

Expand Down Expand Up @@ -166,6 +167,13 @@ VirtualMachineTO implement(VirtualMachineProfile vm, VirtualMachineTO to, long c
GuestOSHypervisorVO guestOsMapping = null;
if (host != null) {
guestOsMapping = guestOsHypervisorDao.findByOsIdAndHypervisor(guestOS.getId(), Hypervisor.HypervisorType.VMware.toString(), host.getHypervisorVersion());
if (guestOsMapping == null) {
LOGGER.debug(String.format("Cannot find guest os mappings for guest os \"%s\" on VMware %s", guestOS.getDisplayName(), host.getHypervisorVersion()));
String parentVersion = getParentVersion(host.getHypervisorVersion());
if (parentVersion != null) {
guestOsMapping = guestOsHypervisorDao.findByOsIdAndHypervisor(guestOS.getId(), Hypervisor.HypervisorType.VMware.toString(), parentVersion);
}
}
}
if (guestOsMapping == null || host == null) {
to.setPlatformEmulator(null);
Expand All @@ -182,6 +190,23 @@ VirtualMachineTO implement(VirtualMachineProfile vm, VirtualMachineTO to, long c
return to;
}

/**
* Get the parent version of VMware hypervisor version
*/
String getParentVersion(String hypervisorVersion) {
try {
CloudStackVersion version = CloudStackVersion.parse(hypervisorVersion);
String parentVersion = String.format("%s.%s", version.getMajorRelease(), version.getMinorRelease());
if (version.getPatchRelease() != 0) {
parentVersion = String.format("%s.%s", parentVersion, version.getPatchRelease());
}
return parentVersion;
} catch (Exception ex) {
LOGGER.debug("Failed to get guest os mappings from the parent version: " + ex.getMessage());
}
return null;
}

/**
* Set the information relevant for deploy-as-is VMs on the VM TO
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import java.util.HashMap;
import java.util.Map;

import org.apache.cloudstack.framework.config.ConfigKey;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
Expand All @@ -32,17 +32,12 @@
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
import org.mockito.Spy;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.support.AnnotationConfigContextLoader;

import com.cloud.agent.api.to.VirtualMachineTO;
import com.cloud.vm.VmDetailConstants;

@RunWith(PowerMockRunner.class)
@PrepareForTest({ConfigKey.class, VmwareVmImplementer.class})
@ContextConfiguration(loader = AnnotationConfigContextLoader.class)
public class VmwareVmImplementerTest {

@Spy
Expand Down Expand Up @@ -145,4 +140,21 @@ public void testEnableNestedVirtualizationCaseGlobalNVFalseGlobalNVPVMFalseLocal
executeAndVerifyTest(false, false, "false", false);
}

private void verifyGetParentVersion(String hypervisorVersion, String expectedParentVersion) {
if (expectedParentVersion == null) {
Assert.assertNull(implementer.getParentVersion(hypervisorVersion));
} else {
Assert.assertEquals(implementer.getParentVersion(hypervisorVersion), expectedParentVersion);
}
}
@Test
public void testGetParentVersion() {
verifyGetParentVersion(null, null);
verifyGetParentVersion("6.5", null);
verifyGetParentVersion("6.7.3", "6.7.3");
verifyGetParentVersion("7.0.3.0", "7.0.3");
verifyGetParentVersion("8.0", null);
verifyGetParentVersion("8.0.0.2", "8.0");
verifyGetParentVersion("8.0.1.0", "8.0.1");
}
}