From 10567e0145ce651c327267d8f4ea31d82bc7e239 Mon Sep 17 00:00:00 2001
From: Manuel Bentele
Date: Fri, 29 Jan 2021 12:22:05 +0100
Subject: Add base classes and utilites to represent Libvirt XML documents
---
.../libvirt/xml/LibvirtXmlDocumentTest.java | 262 +++++++++++++++++++++
.../libvirt/xml/LibvirtXmlTestResources.java | 29 +++
.../xml/qemu-kvm_default-archlinux-vm-cdrom.xml | 144 +++++++++++
.../xml/qemu-kvm_default-archlinux-vm-floppy.xml | 145 ++++++++++++
.../xml/qemu-kvm_default-archlinux-vm-no-hdd.xml | 134 +++++++++++
.../xml/qemu-kvm_default-archlinux-vm-no-nic.xml | 134 +++++++++++
.../xml/qemu-kvm_default-archlinux-vm-no-sound.xml | 136 +++++++++++
.../xml/qemu-kvm_default-archlinux-vm-no-usb.xml | 127 ++++++++++
.../libvirt/xml/qemu-kvm_default-archlinux-vm.xml | 140 +++++++++++
.../qemu-kvm_default-ubuntu-20-04-vm-invalid.xml | 164 +++++++++++++
.../xml/qemu-kvm_default-ubuntu-20-04-vm.xml | 164 +++++++++++++
11 files changed, 1579 insertions(+)
create mode 100644 src/test/java/org/openslx/libvirt/xml/LibvirtXmlDocumentTest.java
create mode 100644 src/test/java/org/openslx/libvirt/xml/LibvirtXmlTestResources.java
create mode 100644 src/test/resources/libvirt/xml/qemu-kvm_default-archlinux-vm-cdrom.xml
create mode 100644 src/test/resources/libvirt/xml/qemu-kvm_default-archlinux-vm-floppy.xml
create mode 100644 src/test/resources/libvirt/xml/qemu-kvm_default-archlinux-vm-no-hdd.xml
create mode 100644 src/test/resources/libvirt/xml/qemu-kvm_default-archlinux-vm-no-nic.xml
create mode 100644 src/test/resources/libvirt/xml/qemu-kvm_default-archlinux-vm-no-sound.xml
create mode 100644 src/test/resources/libvirt/xml/qemu-kvm_default-archlinux-vm-no-usb.xml
create mode 100644 src/test/resources/libvirt/xml/qemu-kvm_default-archlinux-vm.xml
create mode 100644 src/test/resources/libvirt/xml/qemu-kvm_default-ubuntu-20-04-vm-invalid.xml
create mode 100644 src/test/resources/libvirt/xml/qemu-kvm_default-ubuntu-20-04-vm.xml
(limited to 'src/test')
diff --git a/src/test/java/org/openslx/libvirt/xml/LibvirtXmlDocumentTest.java b/src/test/java/org/openslx/libvirt/xml/LibvirtXmlDocumentTest.java
new file mode 100644
index 0000000..1b6e5a5
--- /dev/null
+++ b/src/test/java/org/openslx/libvirt/xml/LibvirtXmlDocumentTest.java
@@ -0,0 +1,262 @@
+package org.openslx.libvirt.xml;
+
+import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.fail;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+
+import javax.xml.transform.Source;
+import javax.xml.transform.stream.StreamSource;
+
+import org.apache.commons.io.FileUtils;
+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.api.Test;
+import org.junit.jupiter.api.function.Executable;
+
+class LibvirtXmlDocumentStub extends LibvirtXmlDocument
+{
+ public LibvirtXmlDocumentStub( File xml )
+ throws LibvirtXmlDocumentException, LibvirtXmlSerializationException, LibvirtXmlValidationException
+ {
+ super( xml );
+ }
+
+ public LibvirtXmlDocumentStub( File xml, Source rngSchema )
+ throws LibvirtXmlDocumentException, LibvirtXmlSerializationException, LibvirtXmlValidationException
+ {
+ super( xml, rngSchema );
+ }
+}
+
+public class LibvirtXmlDocumentTest
+{
+ private static final String EMPTY = new String();
+
+ @BeforeAll
+ public static void setUp()
+ {
+ // disable logging with log4j
+ LogManager.getRootLogger().setLevel( Level.OFF );
+ }
+
+ private LibvirtXmlDocument newLibvirtXmlDocumentInstance( String xmlFileName )
+ {
+ LibvirtXmlDocument document = null;
+
+ try {
+ File xmlFile = LibvirtXmlTestResources.getLibvirtXmlFile( xmlFileName );
+ document = new LibvirtXmlDocumentStub( xmlFile );
+ } catch ( LibvirtXmlDocumentException | LibvirtXmlSerializationException | LibvirtXmlValidationException e ) {
+ String errorMsg = new String( "Cannot prepare requested Libvirt XML file from the resources folder" );
+ fail( errorMsg );
+ }
+
+ return document;
+ }
+
+ private LibvirtXmlDocument newLibvirtXmlDocumentValidationInstance( String xmlFileName, String rngSchemaFileName )
+ throws LibvirtXmlValidationException
+ {
+ LibvirtXmlDocument document = null;
+
+ try {
+ File xmlFile = LibvirtXmlTestResources.getLibvirtXmlFile( xmlFileName );
+ Source rngSchemaSource = new StreamSource( LibvirtXmlResources.getLibvirtRng( rngSchemaFileName ) );
+ document = new LibvirtXmlDocumentStub( xmlFile, rngSchemaSource );
+ } catch ( LibvirtXmlDocumentException | LibvirtXmlSerializationException e ) {
+ String errorMsg = new String( "Cannot prepare requested Libvirt XML file from the resources folder" );
+ fail( errorMsg );
+ }
+
+ return document;
+ }
+
+ @Test
+ @DisplayName( "Read libvirt XML file to String" )
+ public void testReadXmlFileToString() throws LibvirtXmlSerializationException, IOException
+ {
+ LibvirtXmlDocument vm = this.newLibvirtXmlDocumentInstance( "qemu-kvm_default-ubuntu-20-04-vm.xml" );
+ File originalXmlFile = LibvirtXmlTestResources.getLibvirtXmlFile( "qemu-kvm_default-ubuntu-20-04-vm.xml" );
+
+ final String readXmlContent = vm.toXml();
+ final String originalXmlContent = FileUtils.readFileToString( originalXmlFile, StandardCharsets.UTF_8 );
+
+ assertNotNull( readXmlContent );
+
+ final int lengthReadXmlContent = readXmlContent.split( System.lineSeparator() ).length;
+ final int lengthOriginalXmlContent = originalXmlContent.split( System.lineSeparator() ).length;
+
+ assertEquals( lengthOriginalXmlContent, lengthReadXmlContent );
+ }
+
+ @Test
+ @DisplayName( "Read libvirt XML file to file" )
+ public void testReadXmlFileToFile() throws LibvirtXmlSerializationException, IOException
+ {
+ LibvirtXmlDocument vm = this.newLibvirtXmlDocumentInstance( "qemu-kvm_default-ubuntu-20-04-vm.xml" );
+ File originalXmlFile = LibvirtXmlTestResources.getLibvirtXmlFile( "qemu-kvm_default-ubuntu-20-04-vm.xml" );
+ File readXmlFile = LibvirtXmlTestResources.createLibvirtXmlTempFile();
+
+ vm.toXml( readXmlFile );
+
+ final String readXmlContent = FileUtils.readFileToString( readXmlFile, StandardCharsets.UTF_8 );
+ final String originalXmlContent = FileUtils.readFileToString( originalXmlFile, StandardCharsets.UTF_8 );
+
+ assertNotNull( readXmlContent );
+
+ final int lengthReadXmlContent = readXmlContent.split( System.lineSeparator() ).length;
+ final int lengthOriginalXmlContent = originalXmlContent.split( System.lineSeparator() ).length;
+
+ assertEquals( lengthOriginalXmlContent, lengthReadXmlContent );
+ }
+
+ @Test
+ @DisplayName( "Validate correct libvirt XML file" )
+ public void testValidateCorrectXmlFile()
+ {
+ Executable validateXmlDocument = () -> {
+ this.newLibvirtXmlDocumentValidationInstance( "qemu-kvm_default-ubuntu-20-04-vm.xml", "domain.rng" );
+ };
+
+ assertDoesNotThrow( validateXmlDocument );
+ }
+
+ @Test
+ @DisplayName( "Validate incorrect libvirt XML file" )
+ public void testValidateIncorrectXmlFile()
+ {
+ Executable validateXmlDocument = () -> {
+ this.newLibvirtXmlDocumentValidationInstance( "qemu-kvm_default-ubuntu-20-04-vm-invalid.xml", "domain.rng" );
+ };
+
+ assertThrows( LibvirtXmlValidationException.class, validateXmlDocument );
+ }
+
+ @Test
+ @DisplayName( "Get non-existent node from libvirt XML file" )
+ public void testGetNonExistentElement()
+ {
+ LibvirtXmlDocument vm = this.newLibvirtXmlDocumentInstance( "qemu-kvm_default-ubuntu-20-04-vm.xml" );
+ assertNull( vm.getRootXmlNode().getXmlElement( "info" ) );
+ }
+
+ @Test
+ @DisplayName( "Set non-existent node in libvirt XML file" )
+ public void testSetNonExistentElement()
+ {
+ LibvirtXmlDocument vm = this.newLibvirtXmlDocumentInstance( "qemu-kvm_default-ubuntu-20-04-vm.xml" );
+ vm.getRootXmlNode().setXmlElement( "info" );
+ assertNotNull( vm.getRootXmlNode().getXmlElement( "info" ) );
+ }
+
+ @Test
+ @DisplayName( "Get non-existent element's value in libvirt XML file" )
+ public void testGetNonExistentElementValue()
+ {
+ LibvirtXmlDocument vm = this.newLibvirtXmlDocumentInstance( "qemu-kvm_default-ubuntu-20-04-vm.xml" );
+ assertNull( vm.getRootXmlNode().getXmlElementValue( "info" ) );
+ }
+
+ @Test
+ @DisplayName( "Set non-existent element's value in libvirt XML file" )
+ public void testSetNonExistentElementValue()
+ {
+ LibvirtXmlDocument vm = this.newLibvirtXmlDocumentInstance( "qemu-kvm_default-ubuntu-20-04-vm.xml" );
+ vm.getRootXmlNode().setXmlElementValue( "info", "content" );
+ assertEquals( "content", vm.getRootXmlNode().getXmlElementValue( "info" ) );
+ }
+
+ @Test
+ @DisplayName( "Get empty element from libvirt XML file" )
+ public void testGetEmptyElement()
+ {
+ LibvirtXmlDocument vm = this.newLibvirtXmlDocumentInstance( "qemu-kvm_default-ubuntu-20-04-vm.xml" );
+ assertNotNull( vm.getRootXmlNode().getXmlElement( "features/acpi" ) );
+ }
+
+ @Test
+ @DisplayName( "Set empty element in libvirt XML file" )
+ public void testSetEmptyElement()
+ {
+ LibvirtXmlDocument vm = this.newLibvirtXmlDocumentInstance( "qemu-kvm_default-ubuntu-20-04-vm.xml" );
+ vm.getRootXmlNode().setXmlElement( "features/acpi" );
+ assertNotNull( vm.getRootXmlNode().getXmlElement( "features/acpi" ) );
+ }
+
+ @Test
+ @DisplayName( "Get empty element's value from libvirt XML file" )
+ public void testGetEmptyElementValue()
+ {
+ LibvirtXmlDocument vm = this.newLibvirtXmlDocumentInstance( "qemu-kvm_default-ubuntu-20-04-vm.xml" );
+ assertEquals( EMPTY, vm.getRootXmlNode().getXmlElementValue( "features/acpi" ) );
+ }
+
+ @Test
+ @DisplayName( "Set empty element's value in libvirt XML file" )
+ public void testSetEmptyElementValue()
+ {
+ LibvirtXmlDocument vm = this.newLibvirtXmlDocumentInstance( "qemu-kvm_default-ubuntu-20-04-vm.xml" );
+ vm.getRootXmlNode().setXmlElementValue( "features/acpi", "content" );
+ assertEquals( "content", vm.getRootXmlNode().getXmlElementValue( "features/acpi" ) );
+ }
+
+ @Test
+ @DisplayName( "Get non-existent element's attribute value from libvirt XML file" )
+ public void testGetNonExistentElementAttributeValue()
+ {
+ LibvirtXmlDocument vm = this.newLibvirtXmlDocumentInstance( "qemu-kvm_default-ubuntu-20-04-vm.xml" );
+ assertNull( vm.getRootXmlNode().getXmlElementAttributeValue( "info", "test" ) );
+ }
+
+ @Test
+ @DisplayName( "Set non-existent element's attribute value from libvirt XML file" )
+ public void testSetNonExistentElementAttributeValue()
+ {
+ LibvirtXmlDocument vm = this.newLibvirtXmlDocumentInstance( "qemu-kvm_default-ubuntu-20-04-vm.xml" );
+ vm.getRootXmlNode().setXmlElementAttributeValue( "info", "test", "info" );
+ assertEquals( "info", vm.getRootXmlNode().getXmlElementAttributeValue( "info", "test" ) );
+ }
+
+ @Test
+ @DisplayName( "Get element's non-existent attribute value from libvirt XML file" )
+ public void testGetElementNonExistentAttributeValue()
+ {
+ LibvirtXmlDocument vm = this.newLibvirtXmlDocumentInstance( "qemu-kvm_default-ubuntu-20-04-vm.xml" );
+ assertNull( vm.getRootXmlNode().getXmlElementAttributeValue( "features/acpi", "test" ) );
+ }
+
+ @Test
+ @DisplayName( "Set element's non-existent attribute value from libvirt XML file" )
+ public void testSetElementNonExistentAttributeValue()
+ {
+ LibvirtXmlDocument vm = this.newLibvirtXmlDocumentInstance( "qemu-kvm_default-ubuntu-20-04-vm.xml" );
+ vm.getRootXmlNode().setXmlElementAttributeValue( "features/acpi", "test", "info" );
+ assertEquals( "info", vm.getRootXmlNode().getXmlElementAttributeValue( "features/acpi", "test" ) );
+ }
+
+ @Test
+ @DisplayName( "Get element's attribute value from libvirt XML file" )
+ public void testGetElementAttributeValue()
+ {
+ LibvirtXmlDocument vm = this.newLibvirtXmlDocumentInstance( "qemu-kvm_default-ubuntu-20-04-vm.xml" );
+ assertEquals( "partial", vm.getRootXmlNode().getXmlElementAttributeValue( "cpu", "check" ) );
+ }
+
+ @Test
+ @DisplayName( "Set element's attribute value from libvirt XML file" )
+ public void testSetElementAttributeValue()
+ {
+ LibvirtXmlDocument vm = this.newLibvirtXmlDocumentInstance( "qemu-kvm_default-ubuntu-20-04-vm.xml" );
+ vm.getRootXmlNode().setXmlElementAttributeValue( "cpu", "check", "full" );
+ assertEquals( "full", vm.getRootXmlNode().getXmlElementAttributeValue( "cpu", "check" ) );
+ }
+}
diff --git a/src/test/java/org/openslx/libvirt/xml/LibvirtXmlTestResources.java b/src/test/java/org/openslx/libvirt/xml/LibvirtXmlTestResources.java
new file mode 100644
index 0000000..6cc0360
--- /dev/null
+++ b/src/test/java/org/openslx/libvirt/xml/LibvirtXmlTestResources.java
@@ -0,0 +1,29 @@
+package org.openslx.libvirt.xml;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
+
+public final class LibvirtXmlTestResources
+{
+ private static final String LIBVIRT_PREFIX_PATH = File.separator + "libvirt";
+ private static final String LIBVIRT_PREFIX_PATH_XML = LIBVIRT_PREFIX_PATH + File.separator + "xml";
+
+ private static final String LIBVIRT_TEMP_PREFIX = "libvirt-";
+ private static final String LIBVIRT_TEMP_SUFFIX = ".xml";
+
+ public static File getLibvirtXmlFile( String libvirtXmlFileName )
+ {
+ String libvirtXmlPath = LibvirtXmlTestResources.LIBVIRT_PREFIX_PATH_XML + File.separator + libvirtXmlFileName;
+ URL libvirtXml = LibvirtXmlTestResources.class.getResource( libvirtXmlPath );
+ return new File( libvirtXml.getFile() );
+ }
+
+ public static File createLibvirtXmlTempFile() throws IOException
+ {
+ File tempFile = File.createTempFile( LibvirtXmlTestResources.LIBVIRT_TEMP_PREFIX,
+ LibvirtXmlTestResources.LIBVIRT_TEMP_SUFFIX );
+ tempFile.deleteOnExit();
+ return tempFile;
+ }
+}
diff --git a/src/test/resources/libvirt/xml/qemu-kvm_default-archlinux-vm-cdrom.xml b/src/test/resources/libvirt/xml/qemu-kvm_default-archlinux-vm-cdrom.xml
new file mode 100644
index 0000000..617e20b
--- /dev/null
+++ b/src/test/resources/libvirt/xml/qemu-kvm_default-archlinux-vm-cdrom.xml
@@ -0,0 +1,144 @@
+
+ archlinux
+ 22bbd81f-b31b-4242-9907-8840844944bf
+
+
+
+
+
+ 4194304
+ 4194304
+ 2
+
+ hvm
+
+
+
+
+
+
+
+
+
+
+
+
+
+ destroy
+ restart
+ destroy
+
+
+
+
+
+ /usr/bin/qemu-system-x86_64
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ /dev/urandom
+
+
+
+
diff --git a/src/test/resources/libvirt/xml/qemu-kvm_default-archlinux-vm-floppy.xml b/src/test/resources/libvirt/xml/qemu-kvm_default-archlinux-vm-floppy.xml
new file mode 100644
index 0000000..8a2e316
--- /dev/null
+++ b/src/test/resources/libvirt/xml/qemu-kvm_default-archlinux-vm-floppy.xml
@@ -0,0 +1,145 @@
+
+ archlinux
+ 22bbd81f-b31b-4242-9907-8840844944bf
+
+
+
+
+
+ 4194304
+ 4194304
+ 2
+
+ hvm
+
+
+
+
+
+
+
+
+
+
+
+
+
+ destroy
+ restart
+ destroy
+
+
+
+
+
+ /usr/bin/qemu-system-x86_64
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ /dev/urandom
+
+
+
+
+
diff --git a/src/test/resources/libvirt/xml/qemu-kvm_default-archlinux-vm-no-hdd.xml b/src/test/resources/libvirt/xml/qemu-kvm_default-archlinux-vm-no-hdd.xml
new file mode 100644
index 0000000..9fe998e
--- /dev/null
+++ b/src/test/resources/libvirt/xml/qemu-kvm_default-archlinux-vm-no-hdd.xml
@@ -0,0 +1,134 @@
+
+ archlinux
+ 22bbd81f-b31b-4242-9907-8840844944bf
+
+
+
+
+
+ 4194304
+ 4194304
+ 2
+
+ hvm
+
+
+
+
+
+
+
+
+
+
+
+
+
+ destroy
+ restart
+ destroy
+
+
+
+
+
+ /usr/bin/qemu-system-x86_64
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ /dev/urandom
+
+
+
+
+
diff --git a/src/test/resources/libvirt/xml/qemu-kvm_default-archlinux-vm-no-nic.xml b/src/test/resources/libvirt/xml/qemu-kvm_default-archlinux-vm-no-nic.xml
new file mode 100644
index 0000000..8c08471
--- /dev/null
+++ b/src/test/resources/libvirt/xml/qemu-kvm_default-archlinux-vm-no-nic.xml
@@ -0,0 +1,134 @@
+
+ archlinux
+ 22bbd81f-b31b-4242-9907-8840844944bf
+
+
+
+
+
+ 4194304
+ 4194304
+ 2
+
+ hvm
+
+
+
+
+
+
+
+
+
+
+
+
+
+ destroy
+ restart
+ destroy
+
+
+
+
+
+ /usr/bin/qemu-system-x86_64
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ /dev/urandom
+
+
+
+
+
diff --git a/src/test/resources/libvirt/xml/qemu-kvm_default-archlinux-vm-no-sound.xml b/src/test/resources/libvirt/xml/qemu-kvm_default-archlinux-vm-no-sound.xml
new file mode 100644
index 0000000..9e3d612
--- /dev/null
+++ b/src/test/resources/libvirt/xml/qemu-kvm_default-archlinux-vm-no-sound.xml
@@ -0,0 +1,136 @@
+
+ archlinux
+ 22bbd81f-b31b-4242-9907-8840844944bf
+
+
+
+
+
+ 4194304
+ 4194304
+ 2
+
+ hvm
+
+
+
+
+
+
+
+
+
+
+
+
+
+ destroy
+ restart
+ destroy
+
+
+
+
+
+ /usr/bin/qemu-system-x86_64
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ /dev/urandom
+
+
+
+
diff --git a/src/test/resources/libvirt/xml/qemu-kvm_default-archlinux-vm-no-usb.xml b/src/test/resources/libvirt/xml/qemu-kvm_default-archlinux-vm-no-usb.xml
new file mode 100644
index 0000000..2d50c59
--- /dev/null
+++ b/src/test/resources/libvirt/xml/qemu-kvm_default-archlinux-vm-no-usb.xml
@@ -0,0 +1,127 @@
+
+ archlinux
+ 22bbd81f-b31b-4242-9907-8840844944bf
+
+
+
+
+
+ 4194304
+ 4194304
+ 2
+
+ hvm
+
+
+
+
+
+
+
+
+
+
+
+
+
+ destroy
+ restart
+ destroy
+
+
+
+
+
+ /usr/bin/qemu-system-x86_64
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ /dev/urandom
+
+
+
+
diff --git a/src/test/resources/libvirt/xml/qemu-kvm_default-archlinux-vm.xml b/src/test/resources/libvirt/xml/qemu-kvm_default-archlinux-vm.xml
new file mode 100644
index 0000000..32c4ae8
--- /dev/null
+++ b/src/test/resources/libvirt/xml/qemu-kvm_default-archlinux-vm.xml
@@ -0,0 +1,140 @@
+
+ archlinux
+ 22bbd81f-b31b-4242-9907-8840844944bf
+
+
+
+
+
+ 4194304
+ 4194304
+ 2
+
+ hvm
+
+
+
+
+
+
+
+
+
+
+
+
+
+ destroy
+ restart
+ destroy
+
+
+
+
+
+ /usr/bin/qemu-system-x86_64
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ /dev/urandom
+
+
+
+
+
diff --git a/src/test/resources/libvirt/xml/qemu-kvm_default-ubuntu-20-04-vm-invalid.xml b/src/test/resources/libvirt/xml/qemu-kvm_default-ubuntu-20-04-vm-invalid.xml
new file mode 100644
index 0000000..15f6cff
--- /dev/null
+++ b/src/test/resources/libvirt/xml/qemu-kvm_default-ubuntu-20-04-vm-invalid.xml
@@ -0,0 +1,164 @@
+
+ 8dc5433c-0228-49e4-b019-fa2b606aa544
+ Ubuntu 20.04
+ Ubuntu 20.04 desktop installation
+
+
+
+
+
+ 4194304
+ 4194304
+ 2
+
+ hvm
+
+
+ Hello World!
+
+
+
+
+
+
+
+
+
+
+
+ destroy
+ restart
+ destroy
+
+
+
+
+
+ /usr/bin/qemu-system-x86_64
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ /dev/urandom
+
+
+
+
+
diff --git a/src/test/resources/libvirt/xml/qemu-kvm_default-ubuntu-20-04-vm.xml b/src/test/resources/libvirt/xml/qemu-kvm_default-ubuntu-20-04-vm.xml
new file mode 100644
index 0000000..241a680
--- /dev/null
+++ b/src/test/resources/libvirt/xml/qemu-kvm_default-ubuntu-20-04-vm.xml
@@ -0,0 +1,164 @@
+
+ ubuntu-20-04
+ 8dc5433c-0228-49e4-b019-fa2b606aa544
+ Ubuntu 20.04
+ Ubuntu 20.04 desktop installation
+
+
+
+
+
+ 4194304
+ 4194304
+ 2
+
+ hvm
+
+
+
+
+
+
+
+
+
+
+
+
+
+ destroy
+ restart
+ destroy
+
+
+
+
+
+ /usr/bin/qemu-system-x86_64
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ /dev/urandom
+
+
+
+
+
--
cgit v1.2.3-55-g7522