summaryrefslogtreecommitdiffstats
path: root/src/main/java/org/openslx/libvirt/domain/Domain.java
diff options
context:
space:
mode:
authorManuel Bentele2021-11-16 08:43:18 +0100
committerManuel Bentele2021-11-16 08:43:18 +0100
commit0d172ab55c6eb9a235870d8f98d619078bb91078 (patch)
tree20c1cb9b97d35e5846d8b2793c2af6519f38c771 /src/main/java/org/openslx/libvirt/domain/Domain.java
parentMerge branch 'feature/docker-data-container' (diff)
downloadmaster-sync-shared-0d172ab55c6eb9a235870d8f98d619078bb91078.tar.gz
master-sync-shared-0d172ab55c6eb9a235870d8f98d619078bb91078.tar.xz
master-sync-shared-0d172ab55c6eb9a235870d8f98d619078bb91078.zip
Add CPU topology functionality for Libvirt domain XML configs
Diffstat (limited to 'src/main/java/org/openslx/libvirt/domain/Domain.java')
-rw-r--r--src/main/java/org/openslx/libvirt/domain/Domain.java84
1 files changed, 84 insertions, 0 deletions
diff --git a/src/main/java/org/openslx/libvirt/domain/Domain.java b/src/main/java/org/openslx/libvirt/domain/Domain.java
index e6049fa..ca10261 100644
--- a/src/main/java/org/openslx/libvirt/domain/Domain.java
+++ b/src/main/java/org/openslx/libvirt/domain/Domain.java
@@ -768,6 +768,90 @@ public class Domain extends LibvirtXmlDocument
}
/**
+ * Returns the number of virtual machine CPU dies defined in the Libvirt domain XML document.
+ *
+ * @return number of virtual machine CPU dies.
+ */
+ public int getCpuDies()
+ {
+ final String numDies = this.getRootXmlNode().getXmlElementAttributeValue( "cpu/topology", "dies" );
+ return Integer.valueOf( numDies );
+ }
+
+ /**
+ * Set number of virtual machine CPU dies in the Libvirt domain XML document.
+ *
+ * @param number virtual machine CPU dies.
+ */
+ public void setCpuDies( int number )
+ {
+ this.getRootXmlNode().setXmlElementAttributeValue( "cpu/topology", "dies", Integer.toString( number ) );
+ }
+
+ /**
+ * Returns the number of virtual machine CPU sockets defined in the Libvirt domain XML document.
+ *
+ * @return number of virtual machine CPU sockets.
+ */
+ public int getCpuSockets()
+ {
+ final String numSockets = this.getRootXmlNode().getXmlElementAttributeValue( "cpu/topology", "sockets" );
+ return Integer.valueOf( numSockets );
+ }
+
+ /**
+ * Set number of virtual machine CPU dies in the Libvirt domain XML document.
+ *
+ * @param number virtual machine CPU dies.
+ */
+ public void setCpuSockets( int number )
+ {
+ this.getRootXmlNode().setXmlElementAttributeValue( "cpu/topology", "sockets", Integer.toString( number ) );
+ }
+
+ /**
+ * Returns the number of virtual machine CPU cores defined in the Libvirt domain XML document.
+ *
+ * @return number of virtual machine CPU cores.
+ */
+ public int getCpuCores()
+ {
+ final String numCores = this.getRootXmlNode().getXmlElementAttributeValue( "cpu/topology", "cores" );
+ return Integer.valueOf( numCores );
+ }
+
+ /**
+ * Set number of virtual machine CPU cores in the Libvirt domain XML document.
+ *
+ * @param number virtual machine CPU cores.
+ */
+ public void setCpuCores( int number )
+ {
+ this.getRootXmlNode().setXmlElementAttributeValue( "cpu/topology", "cores", Integer.toString( number ) );
+ }
+
+ /**
+ * Returns the number of virtual machine CPU threads defined in the Libvirt domain XML document.
+ *
+ * @return number of virtual machine CPU threads.
+ */
+ public int getCpuThreads()
+ {
+ final String numThreads = this.getRootXmlNode().getXmlElementAttributeValue( "cpu/topology", "threads" );
+ return Integer.valueOf( numThreads );
+ }
+
+ /**
+ * Set number of virtual machine CPU threads in the Libvirt domain XML document.
+ *
+ * @param number virtual machine CPU threads.
+ */
+ public void setCpuThreads( int number )
+ {
+ this.getRootXmlNode().setXmlElementAttributeValue( "cpu/topology", "threads", Integer.toString( number ) );
+ }
+
+ /**
* Returns the file name of the emulator binary defined in the Libvirt domain XML document.
*
* @return file name of the emulator binary.