forked from lstoll/libvirt-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDomainInfo.java
More file actions
85 lines (77 loc) · 1.74 KB
/
Copy pathDomainInfo.java
File metadata and controls
85 lines (77 loc) · 1.74 KB
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
73
74
75
76
77
78
79
80
81
82
83
84
85
package org.libvirt;
import org.libvirt.jna.virDomainInfo;
/**
* This object is returned by Domain.getInfo()
*
* @author stoty
*
*/
public class DomainInfo {
/**
* @author stoty
*
*/
public static enum DomainState {
/**
* no state
*/
VIR_DOMAIN_NOSTATE,
/**
* the domain is running
*/
VIR_DOMAIN_RUNNING,
/**
* the domain is blocked on resource
*/
VIR_DOMAIN_BLOCKED,
/**
* the domain is paused by user
*/
VIR_DOMAIN_PAUSED,
/**
* the domain is being shut down
*/
VIR_DOMAIN_SHUTDOWN,
/**
* the domain is shut off
*/
VIR_DOMAIN_SHUTOFF,
/**
* the domain is crashed
*/
VIR_DOMAIN_CRASHED
}
/**
* the running state, one of virDomainFlag
*/
public DomainState state;
/**
* the maximum memory in KBytes allowed
*/
public long maxMem;
/**
* the memory in KBytes used by the domain
*/
public long memory;
/**
* the number of virtual CPUs for the domain
*/
public int nrVirtCpu;
/**
* the CPU time used in nanoseconds
*/
public long cpuTime;
public DomainInfo() {
}
public DomainInfo(virDomainInfo info) {
cpuTime = info.cpuTime;
maxMem = info.maxMem.longValue();
memory = info.memory.longValue();
nrVirtCpu = info.nrVirtCpu;
state = DomainState.values()[info.state];
}
@Override
public String toString() {
return String.format("state:%s%nmaxMem:%d%nmemory:%d%nnrVirtCpu:%d%ncpuTime:%d%n", state, maxMem, memory, nrVirtCpu, cpuTime);
}
}