blob: eea5a367b692e9aa3e398ac2fc873927171bec17 (
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
|
package org.openslx.libvirt.capabilities.cpu;
import java.math.BigInteger;
import org.openslx.libvirt.domain.DomainUtils;
import org.openslx.libvirt.xml.LibvirtXmlNode;
/**
* Implementation of a host CPU memory pages instance as part of the Libvirt capabilities XML
* document.
*
* @author Manuel Bentele
* @version 1.0
*/
public class Pages extends LibvirtXmlNode
{
/**
* Creates an empty host CPU memory pages instance.
*/
public Pages()
{
super();
}
/**
* Creates a host CPU memory pages instance representing an existing Libvirt XML host CPU pages
* element.
*
* @param xmlNode existing Libvirt XML host CPU pages element.
*/
public Pages( LibvirtXmlNode xmlNode )
{
super( xmlNode );
}
/**
* Returns size of the memory pages instance.
*
* @return size of the memory pages instance.
*/
public BigInteger getSize()
{
final String pagesValue = this.getXmlElementAttributeValue( "size" );
final String pagesUnit = this.getXmlElementAttributeValue( "unit" );
return DomainUtils.decodeMemory( pagesValue, pagesUnit );
}
/**
* Creates a host CPU memory pages instance representing an existing Libvirt XML host CPU pages
* element.
*
* @param xmlNode existing Libvirt XML host CPU pages element.
* @return host CPU memory pages instance.
*/
public static Pages newInstance( LibvirtXmlNode xmlNode )
{
return new Pages( xmlNode );
}
}
|