summaryrefslogtreecommitdiffstats
path: root/src/main/java/org/openslx/libvirt/domain/device/HostdevPci.java
diff options
context:
space:
mode:
authorStephan Schwär2021-02-19 00:09:54 +0100
committerStephan Schwär2021-02-19 00:09:54 +0100
commit62dce8c2b4e519f689e89038ff2afe4496f60628 (patch)
tree7c6802a436e2beb943065b5a377b61eb77d93170 /src/main/java/org/openslx/libvirt/domain/device/HostdevPci.java
parent[docker] Check recieved content. (diff)
parentAdd automatic RelaxNG schema validation for Libvirt domain XML documents (diff)
downloadmaster-sync-shared-62dce8c2b4e519f689e89038ff2afe4496f60628.tar.gz
master-sync-shared-62dce8c2b4e519f689e89038ff2afe4496f60628.tar.xz
master-sync-shared-62dce8c2b4e519f689e89038ff2afe4496f60628.zip
Merge remote-tracking branch 'origin/feature/qemu-integration'
Diffstat (limited to 'src/main/java/org/openslx/libvirt/domain/device/HostdevPci.java')
-rw-r--r--src/main/java/org/openslx/libvirt/domain/device/HostdevPci.java79
1 files changed, 79 insertions, 0 deletions
diff --git a/src/main/java/org/openslx/libvirt/domain/device/HostdevPci.java b/src/main/java/org/openslx/libvirt/domain/device/HostdevPci.java
new file mode 100644
index 0000000..3b26fb0
--- /dev/null
+++ b/src/main/java/org/openslx/libvirt/domain/device/HostdevPci.java
@@ -0,0 +1,79 @@
+package org.openslx.libvirt.domain.device;
+
+import org.openslx.libvirt.xml.LibvirtXmlNode;
+
+/**
+ * A hostdev PCI device node in a Libvirt domain XML document for PCI passthrough.
+ *
+ * @author Manuel Bentele
+ * @version 1.0
+ */
+public class HostdevPci extends Hostdev
+{
+ /**
+ * Creates an empty hostdev PCI device.
+ */
+ public HostdevPci()
+ {
+ super();
+ }
+
+ /**
+ * Creates a hostdev PCI device representing an existing Libvirt XML hostdev PCI device element.
+ *
+ * @param xmlNode existing Libvirt XML hostdev PCI device element.
+ */
+ public HostdevPci( LibvirtXmlNode xmlNode )
+ {
+ super( xmlNode );
+ }
+
+ /**
+ * Checks if PCI hostdev device is managed.
+ *
+ * If {@link #isManaged()} returns <code>true</code> the hostdev PCI device is detached from the
+ * host before being passed on to the guest and reattached to the host after the guest exits.
+ *
+ * @return state whether PCI hostdev device is managed.
+ */
+ public boolean isManaged()
+ {
+ return this.getXmlElementAttributeValueAsBool( "managed" );
+ }
+
+ /**
+ * Sets state whether PCI hostdev device is managed.
+ *
+ * If the <code>managed</code> parameter is set to <code>true</code> the PCI hostdev device is
+ * detached from the host before being passed on to the guest and reattached to the host after
+ * the guest exits.
+ *
+ * @return state whether PCI hostdev device is managed.
+ */
+ public void setManaged( boolean managed )
+ {
+ this.setXmlElementAttributeValue( "managed", managed );
+ }
+
+ /**
+ * Creates a non-existent hostdev PCI device as Libvirt XML device element.
+ *
+ * @param xmlNode Libvirt XML node of the Libvirt XML device that is created.
+ * @return created hostdev PCI device instance.
+ */
+ public static HostdevPci createInstance( LibvirtXmlNode xmlNode )
+ {
+ return HostdevPci.newInstance( xmlNode );
+ }
+
+ /**
+ * Creates a hostdev PCI device representing an existing Libvirt XML hostdev PCI device element.
+ *
+ * @param xmlNode existing Libvirt XML hostdev PCI device element.
+ * @return hostdev PCI device instance.
+ */
+ public static HostdevPci newInstance( LibvirtXmlNode xmlNode )
+ {
+ return new HostdevPci( xmlNode );
+ }
+}