|
17 | 17 | */ |
18 | 18 | package com.cloud.agent.api; |
19 | 19 |
|
| 20 | +import com.cloud.agent.api.LogLevel.Log4jLevel; |
20 | 21 | import com.cloud.host.HostStats; |
21 | 22 |
|
22 | 23 | /** |
23 | 24 | * @author ajoshi |
24 | 25 | * |
25 | 26 | */ |
| 27 | +@LogLevel(Log4jLevel.Trace) |
26 | 28 | public class GetHostStatsAnswer extends Answer implements HostStats { |
27 | | - |
28 | | - HostStatsEntry hostStats; |
| 29 | + |
| 30 | + HostStatsEntry hostStats; |
29 | 31 |
|
30 | 32 | protected GetHostStatsAnswer() { |
31 | | - hostStats = new HostStatsEntry(); |
| 33 | + hostStats = new HostStatsEntry(); |
| 34 | + } |
| 35 | + |
| 36 | + public GetHostStatsAnswer(GetHostStatsCommand cmd, HostStatsEntry hostStatistics) { |
| 37 | + super(cmd); |
| 38 | + this.hostStats = hostStatistics; |
32 | 39 | } |
33 | | - |
34 | | - public GetHostStatsAnswer(GetHostStatsCommand cmd, HostStatsEntry hostStatistics) { |
35 | | - super(cmd); |
36 | | - this.hostStats = hostStatistics; |
37 | | - } |
38 | | - |
39 | | - public GetHostStatsAnswer(GetHostStatsCommand cmd, double cpuUtilization, double freeMemoryKBs, double totalMemoryKBs, double networkReadKBs, |
40 | | - double networkWriteKBs, String entityType) { |
| 40 | + |
| 41 | + public GetHostStatsAnswer(GetHostStatsCommand cmd, double cpuUtilization, double freeMemoryKBs, double totalMemoryKBs, double networkReadKBs, |
| 42 | + double networkWriteKBs, String entityType) { |
41 | 43 | super(cmd); |
42 | 44 | hostStats = new HostStatsEntry(); |
43 | | - |
| 45 | + |
44 | 46 | hostStats.setCpuUtilization(cpuUtilization); |
45 | 47 | hostStats.setFreeMemoryKBs(freeMemoryKBs); |
46 | 48 | hostStats.setTotalMemoryKBs(totalMemoryKBs); |
47 | 49 | hostStats.setNetworkReadKBs(networkReadKBs); |
48 | 50 | hostStats.setNetworkWriteKBs(networkWriteKBs); |
49 | 51 | hostStats.setEntityType(entityType); |
50 | 52 | } |
51 | | - |
| 53 | + |
52 | 54 | @Override |
53 | 55 | public double getUsedMemory() { |
54 | | - return hostStats.getUsedMemory(); |
| 56 | + return hostStats.getUsedMemory(); |
55 | 57 | } |
56 | | - |
| 58 | + |
57 | 59 | @Override |
58 | 60 | public double getFreeMemoryKBs() { |
59 | 61 | return hostStats.getFreeMemoryKBs(); |
60 | 62 | } |
61 | | - |
| 63 | + |
62 | 64 | @Override |
63 | 65 | public double getTotalMemoryKBs() { |
64 | | - return hostStats.getTotalMemoryKBs(); |
| 66 | + return hostStats.getTotalMemoryKBs(); |
65 | 67 | } |
66 | | - |
| 68 | + |
67 | 69 | @Override |
68 | 70 | public double getCpuUtilization() { |
69 | 71 | return hostStats.getCpuUtilization(); |
70 | 72 | } |
71 | | - |
| 73 | + |
72 | 74 | @Override |
73 | 75 | public double getNetworkReadKBs() { |
74 | | - return hostStats.getNetworkReadKBs(); |
| 76 | + return hostStats.getNetworkReadKBs(); |
75 | 77 | } |
76 | | - |
| 78 | + |
77 | 79 | @Override |
78 | 80 | public double getNetworkWriteKBs() { |
79 | | - return hostStats.getNetworkWriteKBs(); |
| 81 | + return hostStats.getNetworkWriteKBs(); |
80 | 82 | } |
81 | 83 |
|
82 | | - @Override |
83 | | - public String getEntityType() { |
84 | | - return hostStats.getEntityType(); |
85 | | - } |
| 84 | + @Override |
| 85 | + public String getEntityType() { |
| 86 | + return hostStats.getEntityType(); |
| 87 | + } |
86 | 88 |
|
87 | | - @Override |
88 | | - public HostStats getHostStats() { |
89 | | - return hostStats; |
90 | | - } |
91 | | - |
92 | 89 | @Override |
93 | | - public boolean logTrace() { |
94 | | - return true; |
| 90 | + public HostStats getHostStats() { |
| 91 | + return hostStats; |
95 | 92 | } |
96 | 93 | } |
0 commit comments