summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManuel Bentele2021-08-16 11:18:28 +0200
committerManuel Bentele2021-08-16 11:18:28 +0200
commit5ad7be90c16016b182fe01f8c20c2abdd1a14cf4 (patch)
treee31188b2c568ddf2707dd8bbc7ae548f812506f3
parent[run-virt-docker] update plugin (diff)
downloadmltk-5ad7be90c16016b182fe01f8c20c2abdd1a14cf4.tar.gz
mltk-5ad7be90c16016b182fe01f8c20c2abdd1a14cf4.tar.xz
mltk-5ad7be90c16016b182fe01f8c20c2abdd1a14cf4.zip
[qemu] Add Intel GVT-g (mdev) support to run-virt Java tool
-rw-r--r--core/modules/qemu/runvirt-plugin-qemu/src/main/java/org/openslx/runvirt/plugin/qemu/App.java2
-rw-r--r--core/modules/qemu/runvirt-plugin-qemu/src/main/java/org/openslx/runvirt/plugin/qemu/cmdln/CommandLineArgs.java23
-rw-r--r--core/modules/qemu/runvirt-plugin-qemu/src/main/java/org/openslx/runvirt/plugin/qemu/configuration/TransformationSpecificQemuMdevPassthroughIntel.java125
-rw-r--r--core/modules/qemu/runvirt-plugin-qemu/src/test/java/org/openslx/runvirt/plugin/qemu/AppTest.java8
-rw-r--r--core/modules/qemu/runvirt-plugin-qemu/src/test/java/org/openslx/runvirt/plugin/qemu/cmdln/CommandLineArgsTest.java51
-rw-r--r--core/modules/qemu/runvirt-plugin-qemu/src/test/java/org/openslx/runvirt/plugin/qemu/configuration/TransformationSpecificQemuMdevPassthroughIntelTest.java133
-rw-r--r--core/modules/qemu/runvirt-plugin-qemu/src/test/java/org/openslx/runvirt/plugin/qemu/configuration/TransformationTestUtils.java5
7 files changed, 341 insertions, 6 deletions
diff --git a/core/modules/qemu/runvirt-plugin-qemu/src/main/java/org/openslx/runvirt/plugin/qemu/App.java b/core/modules/qemu/runvirt-plugin-qemu/src/main/java/org/openslx/runvirt/plugin/qemu/App.java
index 5d6bb136..4da9e9e8 100644
--- a/core/modules/qemu/runvirt-plugin-qemu/src/main/java/org/openslx/runvirt/plugin/qemu/App.java
+++ b/core/modules/qemu/runvirt-plugin-qemu/src/main/java/org/openslx/runvirt/plugin/qemu/App.java
@@ -27,6 +27,7 @@ import org.openslx.runvirt.plugin.qemu.configuration.TransformationGenericUuid;
import org.openslx.runvirt.plugin.qemu.configuration.TransformationSpecificQemuArchitecture;
import org.openslx.runvirt.plugin.qemu.configuration.TransformationSpecificQemuGpuPassthroughNvidia;
import org.openslx.runvirt.plugin.qemu.configuration.TransformationSpecificQemuGraphics;
+import org.openslx.runvirt.plugin.qemu.configuration.TransformationSpecificQemuMdevPassthroughIntel;
import org.openslx.runvirt.plugin.qemu.virtualization.LibvirtHypervisorQemu;
import org.openslx.runvirt.plugin.qemu.virtualization.LibvirtHypervisorQemu.QemuSessionType;
import org.openslx.runvirt.viewer.Viewer;
@@ -144,6 +145,7 @@ public class App
transformationManager.register( new TransformationSpecificQemuArchitecture( hypervisorQemu ), true );
transformationManager.register( new TransformationSpecificQemuGraphics( hypervisorQemu ), true );
transformationManager.register( new TransformationSpecificQemuSerialDevices( hypervisorQemu ), true );
+ transformationManager.register( new TransformationSpecificQemuMdevPassthroughIntel( hypervisorQemu ), false );
transformationManager.register( new TransformationSpecificQemuGpuPassthroughNvidia( hypervisorQemu ), false );
}
diff --git a/core/modules/qemu/runvirt-plugin-qemu/src/main/java/org/openslx/runvirt/plugin/qemu/cmdln/CommandLineArgs.java b/core/modules/qemu/runvirt-plugin-qemu/src/main/java/org/openslx/runvirt/plugin/qemu/cmdln/CommandLineArgs.java
index 589dd197..cc989c75 100644
--- a/core/modules/qemu/runvirt-plugin-qemu/src/main/java/org/openslx/runvirt/plugin/qemu/cmdln/CommandLineArgs.java
+++ b/core/modules/qemu/runvirt-plugin-qemu/src/main/java/org/openslx/runvirt/plugin/qemu/cmdln/CommandLineArgs.java
@@ -397,6 +397,26 @@ public class CommandLineArgs
}
/**
+ * Returns the argument of the command line option {@link CmdLnOption#VM_ILMDEVID0}.
+ *
+ * @return argument of the command line option {@link CmdLnOption#VM_ILMDEVID0}.
+ */
+ public String getVmIlMdevId0()
+ {
+ return this.getArgument( CmdLnOption.VM_ILMDEVID0 );
+ }
+
+ /**
+ * Returns the state whether a passthrough of an Intel mediated device (virtual GPU) is required.
+ *
+ * @return state whether a passthrough of an Intel mediated device (virtual GPU) is required.
+ */
+ public boolean isIntelMdevPassthroughEnabled()
+ {
+ return this.getVmIlMdevId0() != null;
+ }
+
+ /**
* Command line options for the run-virt QEMU plugin (command line tool).
*
* @author Manuel Bentele
@@ -429,7 +449,8 @@ public class CommandLineArgs
VM_FSTGT1 ( 'w', "vmfstgt1", 1, "Target directory for second file system passthrough (shared folder)" ),
VM_NVGPUIDS0( 'y', "vmnvgpuids0", 2, "PCI device description and address for passthrough of the first Nvidia GPU. " +
"The argument follow the pattern: " +
- "\"<VENDOR ID>:<PRODUCT ID>,<PCI DOMAIN>:<PCI DEVICE>:<PCI DEVICE>.<PCI FUNCTION>\"" );
+ "\"<VENDOR ID>:<PRODUCT ID>,<PCI DOMAIN>:<PCI DEVICE>:<PCI DEVICE>.<PCI FUNCTION>\"" ),
+ VM_ILMDEVID0( 'z', "vmilmdevid0", 1, "Mediated device UUID for passthrough of the first Intel mediated device (virtual GPU)." );
// @formatter:on
/**
diff --git a/core/modules/qemu/runvirt-plugin-qemu/src/main/java/org/openslx/runvirt/plugin/qemu/configuration/TransformationSpecificQemuMdevPassthroughIntel.java b/core/modules/qemu/runvirt-plugin-qemu/src/main/java/org/openslx/runvirt/plugin/qemu/configuration/TransformationSpecificQemuMdevPassthroughIntel.java
new file mode 100644
index 00000000..0a0da1a4
--- /dev/null
+++ b/core/modules/qemu/runvirt-plugin-qemu/src/main/java/org/openslx/runvirt/plugin/qemu/configuration/TransformationSpecificQemuMdevPassthroughIntel.java
@@ -0,0 +1,125 @@
+package org.openslx.runvirt.plugin.qemu.configuration;
+
+import org.openslx.libvirt.capabilities.Capabilities;
+import org.openslx.libvirt.domain.Domain;
+import org.openslx.libvirt.domain.device.Hostdev;
+import org.openslx.libvirt.domain.device.HostdevMdev;
+import org.openslx.libvirt.domain.device.HostdevMdev.Model;
+import org.openslx.libvirt.domain.device.HostdevMdevDeviceAddress;
+import org.openslx.libvirt.domain.device.Video;
+import org.openslx.runvirt.plugin.qemu.cmdln.CommandLineArgs;
+import org.openslx.runvirt.plugin.qemu.virtualization.LibvirtHypervisorQemu;
+import org.openslx.runvirt.virtualization.LibvirtHypervisorException;
+import org.openslx.virtualization.configuration.transformation.TransformationException;
+import org.openslx.virtualization.configuration.transformation.TransformationSpecific;
+
+/**
+ * Specific Intel mediated device (Intel GVT-g) passthrough transformation for Libvirt/QEMU
+ * virtualization configurations.
+ *
+ * @author Manuel Bentele
+ * @version 1.0
+ */
+public class TransformationSpecificQemuMdevPassthroughIntel
+ extends TransformationSpecific<Domain, CommandLineArgs, LibvirtHypervisorQemu>
+{
+ /**
+ * Name of the configuration transformation.
+ */
+ private static final String NAME = "QEMU mediated device passthrough [Intel]";
+
+ /**
+ * Creates a new Intel mediated device passthrough transformation for Libvirt/QEMU virtualization
+ * configurations.
+ *
+ * @param hypervisor Libvirt/QEMU hypervisor.
+ */
+ public TransformationSpecificQemuMdevPassthroughIntel( LibvirtHypervisorQemu hypervisor )
+ {
+ super( TransformationSpecificQemuMdevPassthroughIntel.NAME, hypervisor );
+ }
+
+ /**
+ * Validates a virtualization configuration and input arguments for this transformation.
+ *
+ * @param config virtualization configuration for the validation.
+ * @param args input arguments for the validation.
+ * @throws TransformationException validation has failed.
+ */
+ private void validateInputs( Domain config, CommandLineArgs args ) throws TransformationException
+ {
+ if ( config == null || args == null ) {
+ throw new TransformationException( "Virtualization configuration or input arguments are missing!" );
+ }
+ }
+
+ /**
+ * Queries and returns the capabilities of the Libvirt/QEMU hypervisor.
+ *
+ * @return capabilities of the Libvirt/QEMU hypervisor.
+ * @throws TransformationException failed to query and return the capabilities of the
+ * Libvirt/QEMU hypervisor.
+ */
+ protected Capabilities getCapabilities() throws TransformationException
+ {
+ Capabilities capabilities = null;
+
+ try {
+ capabilities = this.getVirtualizer().getCapabilites();
+ } catch ( LibvirtHypervisorException e ) {
+ final String errorMsg = new String(
+ "Failed to retrieve host capabilities from QEMU virtualizer: " + e.getLocalizedMessage() );
+ throw new TransformationException( errorMsg );
+ }
+
+ return capabilities;
+ }
+
+ @Override
+ public void transform( Domain config, CommandLineArgs args ) throws TransformationException
+ {
+ // validate configuration and input arguments
+ this.validateInputs( config, args );
+
+ // check if passthrough of an Intel mediated device (virtual GPU) takes place
+ if ( args.isIntelMdevPassthroughEnabled() ) {
+ // validate submitted mediated device UUID
+ final HostdevMdevDeviceAddress mdevDeviceAddress = HostdevMdevDeviceAddress.valueOf( args.getVmIlMdevId0() );
+ if ( mdevDeviceAddress == null ) {
+ final String errorMsg = "UUID of the Intel mediated device (virtual GPU) address is invalid!";
+ throw new TransformationException( errorMsg );
+ }
+
+ // check if IOMMU support is available on the host
+ if ( !this.getCapabilities().hasHostIommuSupport() ) {
+ final String errorMsg = "IOMMU support is not available on the hypervisor but required for Intel mediated device (virtual GPU) passthrough!";
+ throw new TransformationException( errorMsg );
+ }
+
+ // remove all existing hostdev devices
+ // otherwise the Intel specific QEMU options with index 0 do not work
+ for ( final Hostdev hostdevDevice : config.getHostdevDevices() ) {
+ hostdevDevice.remove();
+ }
+
+ // passthrough Intel mediated device (virtual GPU)
+ final HostdevMdev mdevDevice = config.addHostdevMdevDevice();
+ mdevDevice.setManaged( false );
+ mdevDevice.setModel( Model.VFIO_PCI );
+ mdevDevice.setDisplayOn( true );
+ mdevDevice.setMemoryFramebufferOn( true );
+ mdevDevice.setSource( mdevDeviceAddress );
+
+ // set Intel specific QEMU options that are not handeled by Libvirt yet
+ config.addQemuCmdlnArgument( "-set" );
+ config.addQemuCmdlnArgument( "device.hostdev0.x-igd-opregion=on" );
+ config.addQemuCmdlnArgument( "-set" );
+ config.addQemuCmdlnArgument( "device.hostdev0.driver=vfio-pci-nohotplug" );
+
+ // disable all software video devices by disable them
+ for ( Video videoDevice : config.getVideoDevices() ) {
+ videoDevice.disable();
+ }
+ }
+ }
+}
diff --git a/core/modules/qemu/runvirt-plugin-qemu/src/test/java/org/openslx/runvirt/plugin/qemu/AppTest.java b/core/modules/qemu/runvirt-plugin-qemu/src/test/java/org/openslx/runvirt/plugin/qemu/AppTest.java
index d0eef82a..a8618878 100644
--- a/core/modules/qemu/runvirt-plugin-qemu/src/test/java/org/openslx/runvirt/plugin/qemu/AppTest.java
+++ b/core/modules/qemu/runvirt-plugin-qemu/src/test/java/org/openslx/runvirt/plugin/qemu/AppTest.java
@@ -63,7 +63,7 @@ public class AppTest
assertTrue( shortHelpOptionCorrectOutput.contains( App.APP_DESC ) );
// test that no error was logged and output is available
- assertEquals( 2503, shortHelpOptionCorrectOutput.length() );
+ assertEquals( 2655, shortHelpOptionCorrectOutput.length() );
assertEquals( 0, shortHelpOptionCorrectErrOutput.length() );
}
@@ -91,7 +91,7 @@ public class AppTest
assertTrue( longHelpOptionCorrectOutput.contains( App.APP_DESC ) );
// test that no error was logged and output is available
- assertEquals( 2503, longHelpOptionCorrectOutput.length() );
+ assertEquals( 2655, longHelpOptionCorrectOutput.length() );
assertEquals( 0, longHelpOptionCorrectErrOutput.length() );
}
@@ -119,7 +119,7 @@ public class AppTest
assertTrue( shortHelpOptionIncorrectOutput.contains( App.APP_DESC ) );
// test that error was logged and output is available
- assertEquals( 2503, shortHelpOptionIncorrectOutput.length() );
+ assertEquals( 2655, shortHelpOptionIncorrectOutput.length() );
assertEquals( 0, shortHelpOptionIncorrectErrOutput.length() );
}
@@ -147,7 +147,7 @@ public class AppTest
assertTrue( longHelpOptionIncorrectOutput.contains( App.APP_DESC ) );
// test that error was logged and output is available
- assertEquals( 2503, longHelpOptionIncorrectOutput.length() );
+ assertEquals( 2655, longHelpOptionIncorrectOutput.length() );
assertEquals( 0, longHelpOptionIncorrectErrOutput.length() );
}
diff --git a/core/modules/qemu/runvirt-plugin-qemu/src/test/java/org/openslx/runvirt/plugin/qemu/cmdln/CommandLineArgsTest.java b/core/modules/qemu/runvirt-plugin-qemu/src/test/java/org/openslx/runvirt/plugin/qemu/cmdln/CommandLineArgsTest.java
index 77522bd6..dc863088 100644
--- a/core/modules/qemu/runvirt-plugin-qemu/src/test/java/org/openslx/runvirt/plugin/qemu/cmdln/CommandLineArgsTest.java
+++ b/core/modules/qemu/runvirt-plugin-qemu/src/test/java/org/openslx/runvirt/plugin/qemu/cmdln/CommandLineArgsTest.java
@@ -2,6 +2,7 @@ package org.openslx.runvirt.plugin.qemu.cmdln;
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.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
@@ -31,6 +32,7 @@ public class CommandLineArgsTest
private static final String CMDLN_TEST_MAC = "02:42:8e:77:1b:e6";
private static final String CMDLN_TEST_NVGPU_DESC = "10de:0ff9";
private static final String CMDLN_TEST_NVGPU_ADDR = "0000:00:01.0";
+ private static final String CMDLN_TEST_ILMDEV_ID = "25f672e0-5456-4ed3-b2fc-aeaf2e508301";
// @formatter:on
@Test
@@ -749,4 +751,53 @@ public class CommandLineArgsTest
assertTrue( cmdLn1.isNvidiaGpuPassthroughEnabled() );
assertFalse( cmdLn2.isNvidiaGpuPassthroughEnabled() );
}
+
+ @Test
+ @DisplayName( "Test the parsing of Intel mediated device ID for the first virtual GPU passthrough (short version)" )
+ public void testCmdlnOptionVmIlMdevId0Short() throws CommandLineArgsException
+ {
+ final String[] args = {
+ CMDLN_PREFIX_OPTION_SHORT + CmdLnOption.VM_ILMDEVID0.getShortOption(),
+ CMDLN_TEST_ILMDEV_ID
+ };
+
+ CommandLineArgs cmdLn = new CommandLineArgs( args );
+
+ final String intelMdevId = cmdLn.getVmIlMdevId0();
+ assertNotNull( intelMdevId );
+ assertEquals( CMDLN_TEST_ILMDEV_ID, intelMdevId );
+ }
+
+ @Test
+ @DisplayName( "Test the parsing of Intel mediated device ID for the first virtual GPU passthrough (long version)" )
+ public void testCmdlnOptionVmIlMdevId0Long() throws CommandLineArgsException
+ {
+ final String[] args = {
+ CMDLN_PREFIX_OPTION_LONG + CmdLnOption.VM_ILMDEVID0.getLongOption(),
+ CMDLN_TEST_ILMDEV_ID
+ };
+
+ CommandLineArgs cmdLn = new CommandLineArgs( args );
+
+ final String intelMdevId = cmdLn.getVmIlMdevId0();
+ assertNotNull( intelMdevId );
+ assertEquals( CMDLN_TEST_ILMDEV_ID, intelMdevId );
+ }
+
+ @Test
+ @DisplayName( "Test whether a Intel mediated device passthrough is enabled" )
+ public void testIsIntelMdevPassthroughEnabled() throws CommandLineArgsException
+ {
+ final String[] args1 = {
+ CMDLN_PREFIX_OPTION_LONG + CmdLnOption.VM_ILMDEVID0.getLongOption(),
+ CMDLN_TEST_ILMDEV_ID
+ };
+ final String[] args2 = {};
+
+ CommandLineArgs cmdLn1 = new CommandLineArgs( args1 );
+ CommandLineArgs cmdLn2 = new CommandLineArgs( args2 );
+
+ assertTrue( cmdLn1.isIntelMdevPassthroughEnabled() );
+ assertFalse( cmdLn2.isIntelMdevPassthroughEnabled() );
+ }
}
diff --git a/core/modules/qemu/runvirt-plugin-qemu/src/test/java/org/openslx/runvirt/plugin/qemu/configuration/TransformationSpecificQemuMdevPassthroughIntelTest.java b/core/modules/qemu/runvirt-plugin-qemu/src/test/java/org/openslx/runvirt/plugin/qemu/configuration/TransformationSpecificQemuMdevPassthroughIntelTest.java
new file mode 100644
index 00000000..ca478ba1
--- /dev/null
+++ b/core/modules/qemu/runvirt-plugin-qemu/src/test/java/org/openslx/runvirt/plugin/qemu/configuration/TransformationSpecificQemuMdevPassthroughIntelTest.java
@@ -0,0 +1,133 @@
+package org.openslx.runvirt.plugin.qemu.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.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
+
+import java.io.InputStream;
+import java.util.List;
+
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.api.Test;
+import org.openslx.libvirt.capabilities.Capabilities;
+import org.openslx.libvirt.domain.Domain;
+import org.openslx.libvirt.domain.device.HostdevMdev;
+import org.openslx.libvirt.domain.device.HostdevMdev.Model;
+import org.openslx.libvirt.domain.device.HostdevMdevDeviceAddress;
+import org.openslx.libvirt.domain.device.Video;
+import org.openslx.libvirt.xml.LibvirtXmlDocumentException;
+import org.openslx.libvirt.xml.LibvirtXmlSerializationException;
+import org.openslx.libvirt.xml.LibvirtXmlTestResources;
+import org.openslx.libvirt.xml.LibvirtXmlValidationException;
+import org.openslx.runvirt.plugin.qemu.cmdln.CommandLineArgs;
+import org.openslx.virtualization.configuration.transformation.TransformationException;
+
+class TransformationSpecificQemuMdevPassthroughIntelStub extends TransformationSpecificQemuMdevPassthroughIntel
+{
+ final String capabilityFileName;
+
+ public TransformationSpecificQemuMdevPassthroughIntelStub( String capabilityFileName )
+ {
+ super( null );
+
+ this.capabilityFileName = capabilityFileName;
+ }
+
+ @Override
+ protected Capabilities getCapabilities() throws TransformationException
+ {
+ final InputStream capabilityContent = LibvirtXmlTestResources.getLibvirtXmlStream( this.capabilityFileName );
+ Capabilities capabilites = null;
+
+ try {
+ capabilites = new Capabilities( capabilityContent );
+ } catch ( LibvirtXmlDocumentException | LibvirtXmlSerializationException | LibvirtXmlValidationException e ) {
+ fail( "Could not create stub for getCapabilities(): " + e.getLocalizedMessage() );
+ }
+
+ return capabilites;
+ }
+}
+
+public class TransformationSpecificQemuMdevPassthroughIntelTest
+{
+ @Test
+ @DisplayName( "Test transformation of VM mediated device passthrough configuration if mediated device passthrough is required" )
+ public void testTransformationSpecificQemuMdevPassthroughIntel() throws TransformationException
+ {
+ final TransformationSpecificQemuMdevPassthroughIntelStub transformation;
+ transformation = new TransformationSpecificQemuMdevPassthroughIntelStub( "qemu-kvm_capabilities_default.xml" );
+ final Domain config = TransformationTestUtils.getDefaultDomain();
+ final CommandLineArgs args = TransformationTestUtils.getDefaultCmdLnArgs();
+
+ transformation.transform( config, args );
+
+ final List<HostdevMdev> mdevDevices = config.getHostdevMdevDevices();
+ assertNotNull( mdevDevices );
+ assertEquals( 1, mdevDevices.size() );
+
+ final HostdevMdev mdevDevice = mdevDevices.get( 0 );
+ assertFalse( mdevDevice.isManaged() );
+ assertTrue( mdevDevice.isDisplayOn() );
+ assertTrue( mdevDevice.isMemoryFramebufferOn() );
+ assertEquals( Model.VFIO_PCI, mdevDevice.getModel() );
+ assertEquals( HostdevMdevDeviceAddress.valueOf( TransformationTestUtils.DEFAULT_VM_ILMDEVID0 ),
+ mdevDevice.getSource() );
+
+ final List<String> qemuCmdlnArguments = config.getQemuCmdlnArguments();
+ assertNotNull( qemuCmdlnArguments );
+ boolean qemuCmdlnIgdOpRegion = false;
+ boolean qemuCmdlnVfioNoHotplug = false;
+ for ( final String qemuCmdlnArgument : qemuCmdlnArguments ) {
+ if ( "device.hostdev0.x-igd-opregion=on".equals( qemuCmdlnArgument ) ) {
+ qemuCmdlnIgdOpRegion = true;
+ } else if ( "device.hostdev0.driver=vfio-pci-nohotplug".equals( qemuCmdlnArgument ) ) {
+ qemuCmdlnVfioNoHotplug = true;
+ }
+ }
+ assertTrue( qemuCmdlnIgdOpRegion && qemuCmdlnVfioNoHotplug );
+
+ final List<Video> videoDevices = config.getVideoDevices();
+ assertNotNull( videoDevices );
+ for ( final Video videoDevice : videoDevices ) {
+ assertEquals( Video.Model.NONE, videoDevice.getModel() );
+ }
+
+ assertDoesNotThrow( () -> config.validateXml() );
+ }
+
+ @Test
+ @DisplayName( "Test transformation of VM mediated device passthrough configuration if mediated device passthrouh is not specified" )
+ public void testTransformationSpecificQemuMdevPassthroughIntelNoMdev() throws TransformationException
+ {
+ final TransformationSpecificQemuMdevPassthroughIntelStub transformation;
+ transformation = new TransformationSpecificQemuMdevPassthroughIntelStub( "qemu-kvm_capabilities_default.xml" );
+ final Domain config = TransformationTestUtils.getDefaultDomain();
+ final CommandLineArgs args = TransformationTestUtils.getEmptyCmdLnArgs();
+
+ transformation.transform( config, args );
+
+ final List<HostdevMdev> mdevDevices = config.getHostdevMdevDevices();
+ assertNotNull( mdevDevices );
+ assertEquals( 0, mdevDevices.size() );
+
+ final List<String> qemuCmdlnArguments = config.getQemuCmdlnArguments();
+ assertNotNull( qemuCmdlnArguments );
+ for ( final String qemuCmdlnArgument : qemuCmdlnArguments ) {
+ assertNotEquals( "device.hostdev0.x-igd-opregion=on", qemuCmdlnArgument );
+ assertNotEquals( "device.hostdev0.driver=vfio-pci-nohotplug", qemuCmdlnArgument );
+ }
+
+ final List<Video> videoDevices = config.getVideoDevices();
+ assertNotNull( videoDevices );
+ for ( final Video videoDevice : videoDevices ) {
+ assertNotEquals( Video.Model.NONE, videoDevice.getModel() );
+ }
+
+ assertDoesNotThrow( () -> config.validateXml() );
+ }
+}
diff --git a/core/modules/qemu/runvirt-plugin-qemu/src/test/java/org/openslx/runvirt/plugin/qemu/configuration/TransformationTestUtils.java b/core/modules/qemu/runvirt-plugin-qemu/src/test/java/org/openslx/runvirt/plugin/qemu/configuration/TransformationTestUtils.java
index 7bd76be5..fe4d4596 100644
--- a/core/modules/qemu/runvirt-plugin-qemu/src/test/java/org/openslx/runvirt/plugin/qemu/configuration/TransformationTestUtils.java
+++ b/core/modules/qemu/runvirt-plugin-qemu/src/test/java/org/openslx/runvirt/plugin/qemu/configuration/TransformationTestUtils.java
@@ -36,6 +36,7 @@ public class TransformationTestUtils
public static final String DEFAULT_VM_GPU0_DESC = "10de:1d01";
public static final String DEFAULT_VM_GPU0_ADDR = "0000:00:02.0";
public static final String DEFAULT_VM_NVGPUIDS0 = DEFAULT_VM_GPU0_DESC + "," + DEFAULT_VM_GPU0_ADDR;
+ public static final String DEFAULT_VM_ILMDEVID0 = "4186049f-d192-4c69-8d4f-b0f277ef095f";
// @formatter:on
private static final String[] DEFAULT_CMDLN_ARGS = {
@@ -76,7 +77,9 @@ public class TransformationTestUtils
CommandLineArgsTest.CMDLN_PREFIX_OPTION_LONG + CmdLnOption.VM_FSTGT1.getLongOption(),
TransformationTestUtils.DEFAULT_VM_FSTGT1,
CommandLineArgsTest.CMDLN_PREFIX_OPTION_LONG + CmdLnOption.VM_NVGPUIDS0.getLongOption(),
- TransformationTestUtils.DEFAULT_VM_NVGPUIDS0
+ TransformationTestUtils.DEFAULT_VM_NVGPUIDS0,
+ CommandLineArgsTest.CMDLN_PREFIX_OPTION_LONG + CmdLnOption.VM_ILMDEVID0.getLongOption(),
+ TransformationTestUtils.DEFAULT_VM_ILMDEVID0
};
private static CommandLineArgs getCmdLnArgs( String[] args )