summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManuel Bentele2021-05-10 09:51:43 +0200
committerManuel Bentele2021-05-10 09:51:43 +0200
commit15b7fb9f9e6770696f568b0239d2ffec34000e56 (patch)
treef7c8f178bc1a3056b3a682c26d18ada2aa72616b
parentOptimize OS detection for Libvirt/QEMU virtualization configurations (diff)
downloadmaster-sync-shared-15b7fb9f9e6770696f568b0239d2ffec34000e56.tar.gz
master-sync-shared-15b7fb9f9e6770696f568b0239d2ffec34000e56.tar.xz
master-sync-shared-15b7fb9f9e6770696f568b0239d2ffec34000e56.zip
Fix HDD detection in VirtualBox configurations newer or equal than v1.17
-rw-r--r--src/main/java/org/openslx/virtualization/Version.java32
-rw-r--r--src/main/java/org/openslx/virtualization/configuration/VirtualizationConfigurationVirtualBox.java5
-rw-r--r--src/main/java/org/openslx/virtualization/configuration/VirtualizationConfigurationVirtualboxFileFormat.java55
-rw-r--r--src/test/java/org/openslx/virtualization/VersionTest.java26
-rw-r--r--src/test/java/org/openslx/virtualization/configuration/VirtualizationConfigurationTestResources.java18
-rw-r--r--src/test/java/org/openslx/virtualization/configuration/VirtualizationConfigurationVirtualBoxTest.java144
-rw-r--r--src/test/resources/virtualbox/xml/virtualbox_default-ubuntu_v1-15.vbox155
-rw-r--r--src/test/resources/virtualbox/xml/virtualbox_default-ubuntu_v1-16.vbox59
-rw-r--r--src/test/resources/virtualbox/xml/virtualbox_default-ubuntu_v1-17.vbox59
-rw-r--r--src/test/resources/virtualbox/xml/virtualbox_default-ubuntu_v1-18.vbox56
10 files changed, 605 insertions, 4 deletions
diff --git a/src/main/java/org/openslx/virtualization/Version.java b/src/main/java/org/openslx/virtualization/Version.java
index 698e22e..fbd1bda 100644
--- a/src/main/java/org/openslx/virtualization/Version.java
+++ b/src/main/java/org/openslx/virtualization/Version.java
@@ -201,6 +201,28 @@ public class Version implements Comparable<Version>
}
/**
+ * Checks if this version is smaller than a specified {@code version}.
+ *
+ * @param version for comparison.
+ * @return state whether this version is smaller than the specified {@code version} or not.
+ */
+ public boolean isSmallerThan( Version version )
+ {
+ return ( this.compareTo( version ) < 0 ) ? true : false;
+ }
+
+ /**
+ * Checks if this version is greater than a specified {@code version}.
+ *
+ * @param version for comparison.
+ * @return state whether this version is greater than the specified {@code version} or not.
+ */
+ public boolean isGreaterThan( Version version )
+ {
+ return ( this.compareTo( version ) > 0 ) ? true : false;
+ }
+
+ /**
* Creates a new version parsed from a {@link String}.
*
* The version consists of a major and a minor version parsed from the specified {@link String}.
@@ -238,6 +260,16 @@ public class Version implements Comparable<Version>
}
@Override
+ public String toString()
+ {
+ if ( this.getName() == null || this.getName().isEmpty() ) {
+ return String.format( "%d.%d", this.getMajor(), this.getMinor() );
+ } else {
+ return String.format( "%d.%d %s", this.getMajor(), this.getMinor(), this.getName() );
+ }
+ }
+
+ @Override
public boolean equals( Object obj )
{
if ( obj == null ) {
diff --git a/src/main/java/org/openslx/virtualization/configuration/VirtualizationConfigurationVirtualBox.java b/src/main/java/org/openslx/virtualization/configuration/VirtualizationConfigurationVirtualBox.java
index 8225af1..81b9af8 100644
--- a/src/main/java/org/openslx/virtualization/configuration/VirtualizationConfigurationVirtualBox.java
+++ b/src/main/java/org/openslx/virtualization/configuration/VirtualizationConfigurationVirtualBox.java
@@ -382,6 +382,11 @@ public class VirtualizationConfigurationVirtualBox
{
}
+ public Version getConfigurationVersion()
+ {
+ return this.config.getVersion();
+ }
+
@Override
public Version getVirtualizerVersion()
{
diff --git a/src/main/java/org/openslx/virtualization/configuration/VirtualizationConfigurationVirtualboxFileFormat.java b/src/main/java/org/openslx/virtualization/configuration/VirtualizationConfigurationVirtualboxFileFormat.java
index 5b74e52..56e0844 100644
--- a/src/main/java/org/openslx/virtualization/configuration/VirtualizationConfigurationVirtualboxFileFormat.java
+++ b/src/main/java/org/openslx/virtualization/configuration/VirtualizationConfigurationVirtualboxFileFormat.java
@@ -7,6 +7,8 @@ import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
import javax.xml.XMLConstants;
import javax.xml.transform.stream.StreamSource;
@@ -20,6 +22,7 @@ import javax.xml.xpath.XPathExpressionException;
import org.apache.log4j.Logger;
import org.openslx.util.Util;
import org.openslx.util.XmlHelper;
+import org.openslx.virtualization.Version;
import org.openslx.virtualization.configuration.VirtualizationConfiguration.DriveBusType;
import org.openslx.virtualization.configuration.VirtualizationConfiguration.HardDisk;
import org.w3c.dom.DOMException;
@@ -43,6 +46,11 @@ public class VirtualizationConfigurationVirtualboxFileFormat
// XPath and DOM parsing related members
private Document doc = null;
+ /**
+ * Version of the configuration file format.
+ */
+ private Version version = null;
+
// list of nodes to automatically remove when reading the vbox file
private static String[] blacklist = {
"/VirtualBox/Machine/Hardware/GuestProperties",
@@ -53,6 +61,7 @@ public class VirtualizationConfigurationVirtualboxFileFormat
"/VirtualBox/Machine/Hardware/Network/Adapter[@enabled='true']/*",
"/VirtualBox/Machine/ExtraData",
"/VirtualBox/Machine/StorageControllers/StorageController/AttachedDevice[not(@type='HardDisk')]",
+ "/VirtualBox/Machine/Hardware/StorageControllers/StorageController/AttachedDevice[not(@type='HardDisk')]",
"/VirtualBox/Machine/MediaRegistry/FloppyImages",
"/VirtualBox/Machine/MediaRegistry/DVDImages" };
@@ -139,6 +148,7 @@ public class VirtualizationConfigurationVirtualboxFileFormat
throw new VirtualizationConfigurationException( "Machine doesn't have a name" );
}
try {
+ this.parseConfigurationVersion();
ensureHardwareUuid();
setOsType();
fixUsb(); // Since we now support selecting specific speed
@@ -154,6 +164,27 @@ public class VirtualizationConfigurationVirtualboxFileFormat
}
}
+ private void parseConfigurationVersion() throws XPathExpressionException, VirtualizationConfigurationException
+ {
+ final String versionText = XmlHelper.XPath.compile( "/VirtualBox/@version" ).evaluate( this.doc );
+
+ if ( versionText == null || versionText.isEmpty() ) {
+ throw new VirtualizationConfigurationException( "Configuration file does not contain any version number!" );
+ } else {
+ // parse version information from textual description
+ final Pattern versionPattern = Pattern.compile( "^(\\d+\\.\\d+).*$" );
+ final Matcher versionMatcher = versionPattern.matcher( versionText );
+
+ if ( versionMatcher.find() ) {
+ this.version = Version.valueOf( versionMatcher.group( 1 ) );
+ }
+
+ if ( this.version == null ) {
+ throw new VirtualizationConfigurationException( "Configuration file version number is not valid!" );
+ }
+ }
+ }
+
private void fixUsb()
{
NodeList list = findNodes( "/VirtualBox/Machine/Hardware/USB/Controllers/Controller" );
@@ -216,6 +247,11 @@ public class VirtualizationConfigurationVirtualboxFileFormat
}
}
+ public Version getVersion()
+ {
+ return this.version;
+ }
+
/**
* Self-explanatory.
*/
@@ -243,7 +279,14 @@ public class VirtualizationConfigurationVirtualboxFileFormat
continue;
String hddUuid = hdd.getAttribute( "uuid" );
hdd.setAttribute( "uuid", PlaceHolder.HDDUUID.toString() + i + "%" );
- NodeList images = findNodes( "/VirtualBox/Machine/StorageControllers/StorageController/AttachedDevice/Image" );
+ final NodeList images;
+ if ( this.getVersion().isSmallerThan( Version.valueOf( "1.17" ) ) ) {
+ images = findNodes( "/VirtualBox/Machine/StorageControllers/StorageController/AttachedDevice/Image" );
+ } else {
+ images = findNodes(
+ "/VirtualBox/Machine/Hardware/StorageControllers/StorageController/AttachedDevice/Image" );
+ }
+
for ( int j = 0; j < images.getLength(); j++ ) {
Element image = (Element)images.item( j );
if ( image == null )
@@ -340,7 +383,15 @@ public class VirtualizationConfigurationVirtualboxFileFormat
*/
public void setHdds() throws XPathExpressionException
{
- XPathExpression hddsExpr = XmlHelper.XPath.compile( "/VirtualBox/Machine/StorageControllers/StorageController/AttachedDevice[@type='HardDisk']/Image" );
+ final XPathExpression hddsExpr;
+ if ( this.getVersion().isSmallerThan( Version.valueOf( "1.17" ) ) ) {
+ hddsExpr = XmlHelper.XPath.compile(
+ "/VirtualBox/Machine/StorageControllers/StorageController/AttachedDevice[@type='HardDisk']/Image" );
+ } else {
+ hddsExpr = XmlHelper.XPath.compile(
+ "/VirtualBox/Machine/Hardware/StorageControllers/StorageController/AttachedDevice[@type='HardDisk']/Image" );
+ }
+
NodeList nodes = (NodeList)hddsExpr.evaluate( this.doc, XPathConstants.NODESET );
if ( nodes == null ) {
LOGGER.error( "Failed to find attached hard drives." );
diff --git a/src/test/java/org/openslx/virtualization/VersionTest.java b/src/test/java/org/openslx/virtualization/VersionTest.java
index 988437a..21464d9 100644
--- a/src/test/java/org/openslx/virtualization/VersionTest.java
+++ b/src/test/java/org/openslx/virtualization/VersionTest.java
@@ -92,8 +92,19 @@ public class VersionTest
}
@Test
- @DisplayName( "Test that version is larger than" )
- public void testVersionLargerThan()
+ @DisplayName( "Test that version is smaller than with helper method" )
+ public void testVersionSmallerThanMethod()
+ {
+ final Version versionOne = new Version( Short.valueOf( "2" ), Short.valueOf( "3" ) );
+ final Version versionTwo = new Version( Short.valueOf( "3" ), Short.valueOf( "2" ) );
+
+ assertTrue( versionOne.isSmallerThan( versionTwo ) );
+ assertFalse( versionTwo.isSmallerThan( versionOne ) );
+ }
+
+ @Test
+ @DisplayName( "Test that version is greater than" )
+ public void testVersionGreaterThan()
{
final Version versionOne = new Version( Short.valueOf( "3" ), Short.valueOf( "3" ) );
final Version versionTwo = new Version( Short.valueOf( "3" ), Short.valueOf( "2" ) );
@@ -103,6 +114,17 @@ public class VersionTest
}
@Test
+ @DisplayName( "Test that version is greater than with helper method" )
+ public void testVersionGreaterThanMethod()
+ {
+ final Version versionOne = new Version( Short.valueOf( "3" ), Short.valueOf( "3" ) );
+ final Version versionTwo = new Version( Short.valueOf( "3" ), Short.valueOf( "2" ) );
+
+ assertTrue( versionOne.isGreaterThan( versionTwo ) );
+ assertFalse( versionTwo.isGreaterThan( versionOne ) );
+ }
+
+ @Test
@DisplayName( "Test that versions are equal (compareTo)" )
public void testVersionEqualCompareTo()
{
diff --git a/src/test/java/org/openslx/virtualization/configuration/VirtualizationConfigurationTestResources.java b/src/test/java/org/openslx/virtualization/configuration/VirtualizationConfigurationTestResources.java
new file mode 100644
index 0000000..4dfd0b7
--- /dev/null
+++ b/src/test/java/org/openslx/virtualization/configuration/VirtualizationConfigurationTestResources.java
@@ -0,0 +1,18 @@
+package org.openslx.virtualization.configuration;
+
+import java.io.File;
+
+import org.openslx.virtualization.configuration.logic.ConfigurationLogicTestResources;
+
+public class VirtualizationConfigurationTestResources
+{
+ public static File getVmwareVmxFile( String vmwareVmxFileName )
+ {
+ return ConfigurationLogicTestResources.getVmwareVmxFile( vmwareVmxFileName );
+ }
+
+ public static File getVirtualBoxXmlFile( String virtualBoxXmlFileName )
+ {
+ return ConfigurationLogicTestResources.getVirtualBoxXmlFile( virtualBoxXmlFileName );
+ }
+}
diff --git a/src/test/java/org/openslx/virtualization/configuration/VirtualizationConfigurationVirtualBoxTest.java b/src/test/java/org/openslx/virtualization/configuration/VirtualizationConfigurationVirtualBoxTest.java
new file mode 100644
index 0000000..496c080
--- /dev/null
+++ b/src/test/java/org/openslx/virtualization/configuration/VirtualizationConfigurationVirtualBoxTest.java
@@ -0,0 +1,144 @@
+package org.openslx.virtualization.configuration;
+
+import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.params.provider.Arguments.arguments;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.List;
+import java.util.stream.Stream;
+
+import org.apache.log4j.Level;
+import org.apache.log4j.LogManager;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.params.provider.MethodSource;
+import org.openslx.virtualization.Version;
+import org.openslx.vm.disk.DiskImage.ImageFormat;
+
+public class VirtualizationConfigurationVirtualBoxTest
+{
+ @BeforeAll
+ public static void setUp()
+ {
+ // disable logging with log4j
+ LogManager.getRootLogger().setLevel( Level.OFF );
+ }
+
+ @ParameterizedTest
+ @DisplayName( "Test version from VM configuration" )
+ @MethodSource( "configAndVersionProvider" )
+ public void testVirtualizationConfigurationVirtualBoxGetConfigurationVersion( String configFileName,
+ Version configVersion )
+ throws IOException, VirtualizationConfigurationException
+ {
+ final File configFile = VirtualizationConfigurationTestResources.getVirtualBoxXmlFile( configFileName );
+ final VirtualizationConfigurationVirtualBox vmConfig = new VirtualizationConfigurationVirtualBox( null,
+ configFile );
+
+ assertEquals( configVersion, vmConfig.getConfigurationVersion() );
+
+ assertDoesNotThrow( () -> vmConfig.validate() );
+ }
+
+ @ParameterizedTest
+ @DisplayName( "Test display name from VM configuration" )
+ @MethodSource( "configAndVersionProvider" )
+ public void testVirtualizationConfigurationVirtualBoxGetDisplayName( String configFileName, Version configVersion )
+ throws IOException, VirtualizationConfigurationException
+ {
+ final File configFile = VirtualizationConfigurationTestResources.getVirtualBoxXmlFile( configFileName );
+ final VirtualizationConfigurationVirtualBox vmConfig = new VirtualizationConfigurationVirtualBox( null,
+ configFile );
+
+ final String displayName = vmConfig.getDisplayName();
+
+ assertEquals( VirtualizationConfigurationVirtualBoxTest.getVmName( configVersion ), displayName );
+
+ assertDoesNotThrow( () -> vmConfig.validate() );
+ }
+
+ @ParameterizedTest
+ @DisplayName( "Test machine snapshot state from VM configuration" )
+ @MethodSource( "configAndVersionProvider" )
+ public void testVirtualizationConfigurationVirtualBoxIsMachineSnapshot( String configFileName,
+ Version configVersion )
+ throws IOException, VirtualizationConfigurationException
+ {
+ final File configFile = VirtualizationConfigurationTestResources.getVirtualBoxXmlFile( configFileName );
+ final VirtualizationConfigurationVirtualBox vmConfig = new VirtualizationConfigurationVirtualBox( null,
+ configFile );
+
+ final boolean isVmSnapshot = vmConfig.isMachineSnapshot();
+
+ assertFalse( isVmSnapshot );
+
+ assertDoesNotThrow( () -> vmConfig.validate() );
+ }
+
+ @ParameterizedTest
+ @DisplayName( "Test supported image formats from VM configuration" )
+ @MethodSource( "configAndVersionProvider" )
+ public void testVirtualizationConfigurationVirtualBoxGetSupportedImageFormats( String configFileName,
+ Version configVersion )
+ throws IOException, VirtualizationConfigurationException
+ {
+ final File configFile = VirtualizationConfigurationTestResources.getVirtualBoxXmlFile( configFileName );
+ final VirtualizationConfigurationVirtualBox vmConfig = new VirtualizationConfigurationVirtualBox( null,
+ configFile );
+
+ final List<ImageFormat> supportedImageFormats = vmConfig.getVirtualizer().getSupportedImageFormats();
+
+ assertNotNull( supportedImageFormats );
+ assertEquals( 1, supportedImageFormats.size() );
+ assertTrue( supportedImageFormats.containsAll( Arrays.asList( ImageFormat.VDI ) ) );
+
+ assertDoesNotThrow( () -> vmConfig.validate() );
+ }
+
+ @ParameterizedTest
+ @DisplayName( "Test output of HDDs from VM configuration" )
+ @MethodSource( "configAndVersionProvider" )
+ public void testVirtualizationConfigurationVirtualBoxGetHdds( String configFileName, Version configVersion )
+ throws IOException, VirtualizationConfigurationException
+ {
+ final File configFile = VirtualizationConfigurationTestResources.getVirtualBoxXmlFile( configFileName );
+ final VirtualizationConfigurationVirtualBox vmConfig = new VirtualizationConfigurationVirtualBox( null,
+ configFile );
+
+ final List<VirtualizationConfiguration.HardDisk> hdds = vmConfig.getHdds();
+
+ final String imageFileName = VirtualizationConfigurationVirtualBoxTest.getVmName( configVersion ) + ".vdi";
+
+ assertNotNull( hdds );
+ assertEquals( 1, hdds.size() );
+ assertEquals( imageFileName, hdds.get( 0 ).diskImage );
+
+ assertDoesNotThrow( () -> vmConfig.validate() );
+ }
+
+ static String getVmName( Version version )
+ {
+ return "ubuntu_" + version.toString().replace( '.', '-' );
+ }
+
+ static Stream<Arguments> configAndVersionProvider()
+ {
+ return Stream.of(
+ arguments( "virtualbox_default-ubuntu_v1-15.vbox",
+ new Version( Short.valueOf( "1" ), Short.valueOf( "15" ) ) ),
+ arguments( "virtualbox_default-ubuntu_v1-16.vbox",
+ new Version( Short.valueOf( "1" ), Short.valueOf( "16" ) ) ),
+ arguments( "virtualbox_default-ubuntu_v1-17.vbox",
+ new Version( Short.valueOf( "1" ), Short.valueOf( "17" ) ) ),
+ arguments( "virtualbox_default-ubuntu_v1-18.vbox",
+ new Version( Short.valueOf( "1" ), Short.valueOf( "18" ) ) ) );
+ }
+}
diff --git a/src/test/resources/virtualbox/xml/virtualbox_default-ubuntu_v1-15.vbox b/src/test/resources/virtualbox/xml/virtualbox_default-ubuntu_v1-15.vbox
new file mode 100644
index 0000000..5e04478
--- /dev/null
+++ b/src/test/resources/virtualbox/xml/virtualbox_default-ubuntu_v1-15.vbox
@@ -0,0 +1,155 @@
+<?xml version="1.0"?>
+<!--
+** DO NOT EDIT THIS FILE.
+** If you make changes to this file while any VirtualBox related application
+** is running, your changes will be overwritten later, without taking effect.
+** Use VBoxManage or the VirtualBox Manager GUI to make changes.
+-->
+<VirtualBox xmlns="http://www.innotek.de/VirtualBox-settings" version="1.15-linux">
+ <Machine uuid="{7d500a79-35d6-4697-8946-54c56f32e49b}" name="ubuntu_1-15" OSType="Ubuntu_64" snapshotFolder="Snapshots" lastStateChange="2021-05-10T07:38:05Z">
+ <MediaRegistry>
+ <HardDisks>
+ <HardDisk uuid="{bc9c4416-33a0-4fd1-a950-cb9e02a2a84f}" location="ubuntu_1-15.vdi" format="VDI" type="Normal"/>
+ </HardDisks>
+ <DVDImages/>
+ <FloppyImages/>
+ </MediaRegistry>
+ <ExtraData>
+ <ExtraDataItem name="GUI/FirstRun" value="yes"/>
+ </ExtraData>
+ <Hardware version="2">
+ <CPU count="1" hotplug="false">
+ <HardwareVirtEx enabled="true"/>
+ <HardwareVirtExNestedPaging enabled="true"/>
+ <HardwareVirtExVPID enabled="true"/>
+ <HardwareVirtExUX enabled="true"/>
+ <PAE enabled="false"/>
+ <LongMode enabled="true"/>
+ <HardwareVirtExLargePages enabled="false"/>
+ <HardwareVirtForce enabled="false"/>
+ </CPU>
+ <Memory RAMSize="1024" PageFusion="false"/>
+ <HID Pointing="USBTablet" Keyboard="PS2Keyboard"/>
+ <HPET enabled="false"/>
+ <Chipset type="PIIX3"/>
+ <Paravirt provider="Default"/>
+ <Boot>
+ <Order position="1" device="Floppy"/>
+ <Order position="2" device="DVD"/>
+ <Order position="3" device="HardDisk"/>
+ <Order position="4" device="None"/>
+ </Boot>
+ <Display VRAMSize="12" monitorCount="1" accelerate3D="false" accelerate2DVideo="false"/>
+ <VideoCapture enabled="false" screens="18446744073709551615" horzRes="1024" vertRes="768" rate="512" fps="25" maxTime="0" maxSize="0"/>
+ <RemoteDisplay enabled="false" authType="Null"/>
+ <BIOS>
+ <ACPI enabled="true"/>
+ <IOAPIC enabled="true"/>
+ <Logo fadeIn="true" fadeOut="true" displayTime="0"/>
+ <BootMenu mode="MessageAndMenu"/>
+ <TimeOffset value="0"/>
+ <PXEDebug enabled="false"/>
+ </BIOS>
+ <USB>
+ <Controllers>
+ <Controller name="OHCI" type="OHCI"/>
+ </Controllers>
+ <DeviceFilters/>
+ </USB>
+ <Network>
+ <Adapter slot="0" enabled="true" MACAddress="080027461BE8" cable="true" speed="0" type="82540EM">
+ <DisabledModes/>
+ <NAT>
+ <DNS pass-domain="true" use-proxy="false" use-host-resolver="false"/>
+ <Alias logging="false" proxy-only="false" use-same-ports="false"/>
+ </NAT>
+ </Adapter>
+ <Adapter slot="1" enabled="false" MACAddress="080027F936E4" cable="true" speed="0" type="82540EM">
+ <DisabledModes>
+ <NAT>
+ <DNS pass-domain="true" use-proxy="false" use-host-resolver="false"/>
+ <Alias logging="false" proxy-only="false" use-same-ports="false"/>
+ </NAT>
+ </DisabledModes>
+ </Adapter>
+ <Adapter slot="2" enabled="false" MACAddress="080027C9EA98" cable="true" speed="0" type="82540EM">
+ <DisabledModes>
+ <NAT>
+ <DNS pass-domain="true" use-proxy="false" use-host-resolver="false"/>
+ <Alias logging="false" proxy-only="false" use-same-ports="false"/>
+ </NAT>
+ </DisabledModes>
+ </Adapter>
+ <Adapter slot="3" enabled="false" MACAddress="0800278F1EC6" cable="true" speed="0" type="82540EM">
+ <DisabledModes>
+ <NAT>
+ <DNS pass-domain="true" use-proxy="false" use-host-resolver="false"/>
+ <Alias logging="false" proxy-only="false" use-same-ports="false"/>
+ </NAT>
+ </DisabledModes>
+ </Adapter>
+ <Adapter slot="4" enabled="false" MACAddress="0800277492A6" cable="true" speed="0" type="82540EM">
+ <DisabledModes>
+ <NAT>
+ <DNS pass-domain="true" use-proxy="false" use-host-resolver="false"/>
+ <Alias logging="false" proxy-only="false" use-same-ports="false"/>
+ </NAT>
+ </DisabledModes>
+ </Adapter>
+ <Adapter slot="5" enabled="false" MACAddress="080027D0C026" cable="true" speed="0" type="82540EM">
+ <DisabledModes>
+ <NAT>
+ <DNS pass-domain="true" use-proxy="false" use-host-resolver="false"/>
+ <Alias logging="false" proxy-only="false" use-same-ports="false"/>
+ </NAT>
+ </DisabledModes>
+ </Adapter>
+ <Adapter slot="6" enabled="false" MACAddress="0800275202D0" cable="true" speed="0" type="82540EM">
+ <DisabledModes>
+ <NAT>
+ <DNS pass-domain="true" use-proxy="false" use-host-resolver="false"/>
+ <Alias logging="false" proxy-only="false" use-same-ports="false"/>
+ </NAT>
+ </DisabledModes>
+ </Adapter>
+ <Adapter slot="7" enabled="false" MACAddress="080027F02CB2" cable="true" speed="0" type="82540EM">
+ <DisabledModes>
+ <NAT>
+ <DNS pass-domain="true" use-proxy="false" use-host-resolver="false"/>
+ <Alias logging="false" proxy-only="false" use-same-ports="false"/>
+ </NAT>
+ </DisabledModes>
+ </Adapter>
+ </Network>
+ <UART/>
+ <LPT/>
+ <AudioAdapter controller="AC97" codec="AD1980" driver="Pulse" enabled="true"/>
+ <RTC localOrUTC="UTC"/>
+ <SharedFolders/>
+ <Clipboard mode="Disabled"/>
+ <DragAndDrop mode="Disabled"/>
+ <IO>
+ <IoCache enabled="true" size="5"/>
+ <BandwidthGroups/>
+ </IO>
+ <HostPci>
+ <Devices/>
+ </HostPci>
+ <EmulatedUSB>
+ <CardReader enabled="false"/>
+ </EmulatedUSB>
+ <Guest memoryBalloonSize="0"/>
+ <GuestProperties/>
+ </Hardware>
+ <StorageControllers>
+ <StorageController name="IDE" type="PIIX4" PortCount="2" useHostIOCache="true" Bootable="true">
+ <AttachedDevice passthrough="false" type="DVD" hotpluggable="false" port="1" device="0"/>
+ </StorageController>
+ <StorageController name="SATA" type="AHCI" PortCount="1" useHostIOCache="false" Bootable="true" IDE0MasterEmulationPort="0" IDE0SlaveEmulationPort="1" IDE1MasterEmulationPort="2" IDE1SlaveEmulationPort="3">
+ <AttachedDevice type="HardDisk" hotpluggable="false" port="0" device="0">
+ <Image uuid="{bc9c4416-33a0-4fd1-a950-cb9e02a2a84f}"/>
+ </AttachedDevice>
+ </StorageController>
+ </StorageControllers>
+ </Machine>
+</VirtualBox>
diff --git a/src/test/resources/virtualbox/xml/virtualbox_default-ubuntu_v1-16.vbox b/src/test/resources/virtualbox/xml/virtualbox_default-ubuntu_v1-16.vbox
new file mode 100644
index 0000000..04213e8
--- /dev/null
+++ b/src/test/resources/virtualbox/xml/virtualbox_default-ubuntu_v1-16.vbox
@@ -0,0 +1,59 @@
+<?xml version="1.0"?>
+<!--
+** DO NOT EDIT THIS FILE.
+** If you make changes to this file while any VirtualBox related application
+** is running, your changes will be overwritten later, without taking effect.
+** Use VBoxManage or the VirtualBox Manager GUI to make changes.
+-->
+<VirtualBox xmlns="http://www.virtualbox.org/" version="1.16-linux">
+ <Machine uuid="{0365b69f-e306-4c9f-9330-2fa30c104284}" name="ubuntu_1-16" OSType="Ubuntu_64" snapshotFolder="Snapshots" lastStateChange="2021-05-06T11:31:10Z">
+ <MediaRegistry>
+ <HardDisks>
+ <HardDisk uuid="{c4d2c45a-38b9-46aa-8c02-b843a9b2e584}" location="ubuntu_1-16.vdi" format="VDI" type="Normal"/>
+ </HardDisks>
+ </MediaRegistry>
+ <ExtraData>
+ <ExtraDataItem name="GUI/FirstRun" value="yes"/>
+ </ExtraData>
+ <Hardware>
+ <CPU>
+ <PAE enabled="false"/>
+ <LongMode enabled="true"/>
+ <X2APIC enabled="true"/>
+ <HardwareVirtExLargePages enabled="false"/>
+ </CPU>
+ <Memory RAMSize="1024"/>
+ <HID Pointing="USBTablet"/>
+ <Paravirt provider="KVM"/>
+ <Display controller="VMSVGA" VRAMSize="16"/>
+ <VideoCapture file="." fps="25"/>
+ <BIOS>
+ <IOAPIC enabled="true"/>
+ <SmbiosUuidLittleEndian enabled="true"/>
+ </BIOS>
+ <USB>
+ <Controllers>
+ <Controller name="OHCI" type="OHCI"/>
+ </Controllers>
+ </USB>
+ <Network>
+ <Adapter slot="0" enabled="true" MACAddress="080027197AB1" type="82540EM">
+ <NAT/>
+ </Adapter>
+ </Network>
+ <AudioAdapter codec="AD1980" driver="Pulse" enabled="true" enabledIn="false"/>
+ <RTC localOrUTC="UTC"/>
+ <Clipboard/>
+ </Hardware>
+ <StorageControllers>
+ <StorageController name="IDE" type="PIIX4" PortCount="2" useHostIOCache="true" Bootable="true">
+ <AttachedDevice passthrough="false" type="DVD" hotpluggable="false" port="1" device="0"/>
+ </StorageController>
+ <StorageController name="SATA" type="AHCI" PortCount="1" useHostIOCache="false" Bootable="true" IDE0MasterEmulationPort="0" IDE0SlaveEmulationPort="1" IDE1MasterEmulationPort="2" IDE1SlaveEmulationPort="3">
+ <AttachedDevice type="HardDisk" hotpluggable="false" port="0" device="0">
+ <Image uuid="{c4d2c45a-38b9-46aa-8c02-b843a9b2e584}"/>
+ </AttachedDevice>
+ </StorageController>
+ </StorageControllers>
+ </Machine>
+</VirtualBox>
diff --git a/src/test/resources/virtualbox/xml/virtualbox_default-ubuntu_v1-17.vbox b/src/test/resources/virtualbox/xml/virtualbox_default-ubuntu_v1-17.vbox
new file mode 100644
index 0000000..d9218ab
--- /dev/null
+++ b/src/test/resources/virtualbox/xml/virtualbox_default-ubuntu_v1-17.vbox
@@ -0,0 +1,59 @@
+<?xml version="1.0"?>
+<!--
+** DO NOT EDIT THIS FILE.
+** If you make changes to this file while any VirtualBox related application
+** is running, your changes will be overwritten later, without taking effect.
+** Use VBoxManage or the VirtualBox Manager GUI to make changes.
+-->
+<VirtualBox xmlns="http://www.virtualbox.org/" version="1.17-linux">
+ <Machine uuid="{faa9db88-8476-4f5b-a385-21a90767c5ad}" name="ubuntu_1-17" OSType="Ubuntu_64" snapshotFolder="Snapshots" lastStateChange="2021-05-06T11:27:05Z">
+ <MediaRegistry>
+ <HardDisks>
+ <HardDisk uuid="{3777e167-c8ec-4084-b0fc-2325824a7660}" location="ubuntu_1-17.vdi" format="VDI" type="Normal"/>
+ </HardDisks>
+ </MediaRegistry>
+ <ExtraData>
+ <ExtraDataItem name="GUI/FirstRun" value="yes"/>
+ </ExtraData>
+ <Hardware>
+ <CPU>
+ <PAE enabled="false"/>
+ <NestedHWVirt enabled="true"/>
+ <LongMode enabled="true"/>
+ <X2APIC enabled="true"/>
+ <HardwareVirtExLargePages enabled="false"/>
+ </CPU>
+ <Memory RAMSize="1024"/>
+ <HID Pointing="USBTablet"/>
+ <Display controller="VMSVGA" VRAMSize="16"/>
+ <VideoCapture file="." fps="25"/>
+ <BIOS>
+ <IOAPIC enabled="true"/>
+ <SmbiosUuidLittleEndian enabled="true"/>
+ </BIOS>
+ <USB>
+ <Controllers>
+ <Controller name="OHCI" type="OHCI"/>
+ </Controllers>
+ </USB>
+ <Network>
+ <Adapter slot="0" enabled="true" MACAddress="080027BBAEF6" type="82540EM">
+ <NAT/>
+ </Adapter>
+ </Network>
+ <AudioAdapter codec="AD1980" driver="Pulse" enabled="true" enabledOut="true"/>
+ <RTC localOrUTC="UTC"/>
+ <Clipboard/>
+ <StorageControllers>
+ <StorageController name="IDE" type="PIIX4" PortCount="2" useHostIOCache="true" Bootable="true">
+ <AttachedDevice passthrough="false" type="DVD" hotpluggable="false" port="1" device="0"/>
+ </StorageController>
+ <StorageController name="SATA" type="AHCI" PortCount="1" useHostIOCache="false" Bootable="true" IDE0MasterEmulationPort="0" IDE0SlaveEmulationPort="1" IDE1MasterEmulationPort="2" IDE1SlaveEmulationPort="3">
+ <AttachedDevice type="HardDisk" hotpluggable="false" port="0" device="0">
+ <Image uuid="{3777e167-c8ec-4084-b0fc-2325824a7660}"/>
+ </AttachedDevice>
+ </StorageController>
+ </StorageControllers>
+ </Hardware>
+ </Machine>
+</VirtualBox>
diff --git a/src/test/resources/virtualbox/xml/virtualbox_default-ubuntu_v1-18.vbox b/src/test/resources/virtualbox/xml/virtualbox_default-ubuntu_v1-18.vbox
new file mode 100644
index 0000000..6d70339
--- /dev/null
+++ b/src/test/resources/virtualbox/xml/virtualbox_default-ubuntu_v1-18.vbox
@@ -0,0 +1,56 @@
+<?xml version="1.0"?>
+<!--
+** DO NOT EDIT THIS FILE.
+** If you make changes to this file while any VirtualBox related application
+** is running, your changes will be overwritten later, without taking effect.
+** Use VBoxManage or the VirtualBox Manager GUI to make changes.
+-->
+<VirtualBox xmlns="http://www.virtualbox.org/" version="1.18-linux">
+ <Machine uuid="{3ef92a60-062e-4ada-94e3-827f09bcf318}" name="ubuntu_1-18" OSType="Ubuntu_64" snapshotFolder="Snapshots" lastStateChange="2021-05-06T11:24:30Z">
+ <MediaRegistry>
+ <HardDisks>
+ <HardDisk uuid="{fac02189-02c8-4673-a11c-78d4ac111850}" location="ubuntu_1-18.vdi" format="VDI" type="Normal"/>
+ </HardDisks>
+ </MediaRegistry>
+ <Hardware>
+ <CPU>
+ <PAE enabled="false"/>
+ <LongMode enabled="true"/>
+ <X2APIC enabled="true"/>
+ <HardwareVirtExLargePages enabled="false"/>
+ </CPU>
+ <Memory RAMSize="1024"/>
+ <HID Pointing="USBTablet"/>
+ <Display controller="VMSVGA" VRAMSize="16"/>
+ <VideoCapture file="." fps="25"/>
+ <BIOS>
+ <IOAPIC enabled="true"/>
+ <SmbiosUuidLittleEndian enabled="true"/>
+ </BIOS>
+ <USB>
+ <Controllers>
+ <Controller name="OHCI" type="OHCI"/>
+ </Controllers>
+ </USB>
+ <Network>
+ <Adapter slot="0" enabled="true" MACAddress="08002780D6EF" type="82540EM">
+ <NAT/>
+ </Adapter>
+ </Network>
+ <AudioAdapter codec="AD1980" driver="Pulse" enabled="true" enabledOut="true"/>
+ <RTC localOrUTC="UTC"/>
+ <Clipboard/>
+ <GuestProperties>
+ <GuestProperty name="/VirtualBox/HostInfo/GUI/LanguageID" value="en_US" timestamp="1620300317680387000" flags=""/>
+ </GuestProperties>
+ <StorageControllers>
+ <StorageController name="SATA" type="AHCI" PortCount="1" useHostIOCache="false" Bootable="true" IDE0MasterEmulationPort="0" IDE0SlaveEmulationPort="1" IDE1MasterEmulationPort="2" IDE1SlaveEmulationPort="3">
+ <AttachedDevice type="HardDisk" hotpluggable="false" port="0" device="0">
+ <Image uuid="{fac02189-02c8-4673-a11c-78d4ac111850}"/>
+ </AttachedDevice>
+ </StorageController>
+ <StorageController name="IDE" type="VirtioSCSI" PortCount="1" useHostIOCache="false" Bootable="true"/>
+ </StorageControllers>
+ </Hardware>
+ </Machine>
+</VirtualBox>