blob: dfe6362b3d5fb26f66851b8ff625861a61d969db (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
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 );
}
}
|