diff options
author | Manuel Bentele | 2021-05-19 09:01:38 +0200 |
---|---|---|
committer | Manuel Bentele | 2021-05-19 09:01:38 +0200 |
commit | adc19701eafcd18a746a57dc0a610a614e1d80cf (patch) | |
tree | df9f27c6172684909ed1c5ffede2a46243322a8d /src/main/java/org/openslx/libvirt/capabilities/guest/Machine.java | |
parent | Remove needless reference to internal/private Maven repository (diff) | |
parent | Implements XML schema validation for VirtualBox configurations (diff) | |
download | master-sync-shared-adc19701eafcd18a746a57dc0a610a614e1d80cf.tar.gz master-sync-shared-adc19701eafcd18a746a57dc0a610a614e1d80cf.tar.xz master-sync-shared-adc19701eafcd18a746a57dc0a610a614e1d80cf.zip |
Merge branch 'feature/qemu-integration'
Diffstat (limited to 'src/main/java/org/openslx/libvirt/capabilities/guest/Machine.java')
-rw-r--r-- | src/main/java/org/openslx/libvirt/capabilities/guest/Machine.java | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/src/main/java/org/openslx/libvirt/capabilities/guest/Machine.java b/src/main/java/org/openslx/libvirt/capabilities/guest/Machine.java new file mode 100644 index 0000000..dfe6362 --- /dev/null +++ b/src/main/java/org/openslx/libvirt/capabilities/guest/Machine.java @@ -0,0 +1,72 @@ +package org.openslx.libvirt.capabilities.guest; + +import org.openslx.libvirt.xml.LibvirtXmlNode; + +/** + * Implementation of a guest machine as part of the Libvirt XML capabilities document. + * + * @author Manuel Bentele + * @version 1.0 + */ +public class Machine extends LibvirtXmlNode +{ + /** + * Creates an empty guest machine instance. + */ + public Machine() + { + super(); + } + + /** + * Creates an guest machine representing an existing Libvirt XML guest machine element. + * + * @param xmlNode existing Libvirt XML guest machine element. + */ + public Machine( LibvirtXmlNode xmlNode ) + { + super( xmlNode ); + } + + /** + * Returns the canonical machine name. + * + * @return canonical machine name. + */ + public String getCanonicalMachine() + { + return this.getXmlElementAttributeValue( "canonical" ); + } + + /** + * Returns the maximum number of CPUs supported by the guest machine. + * + * @return maximum number of CPUs supported by the guest machine. + */ + public int getMaxCpus() + { + final String numMaxCpus = this.getXmlElementAttributeValue( "maxCpus" ); + return Integer.parseUnsignedInt( numMaxCpus ); + } + + /** + * Returns the name of the guest machine. + * + * @return name of the guest machine. + */ + public String getName() + { + return this.getXmlElementValue( null ); + } + + /** + * Creates an guest machine representing an existing Libvirt XML guest machine element. + * + * @param xmlNode existing Libvirt XML guest machine element. + * @return guest machine instance. + */ + public static Machine newInstance( LibvirtXmlNode xmlNode ) + { + return new Machine( xmlNode ); + } +} |