mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
CLOUDSTACK-1868. GetVmStatsCommand throws NullPointerException with VMWare.
This commit is contained in:
parent
278ef81a83
commit
273c912bb6
@ -6526,19 +6526,21 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
|
|||||||
|
|
||||||
for(int i=0; i<values.size(); ++i) {
|
for(int i=0; i<values.size(); ++i) {
|
||||||
List<PerfSampleInfo> infos = ((PerfEntityMetric)values.get(i)).getSampleInfo();
|
List<PerfSampleInfo> infos = ((PerfEntityMetric)values.get(i)).getSampleInfo();
|
||||||
int endMs = infos.get(infos.size()-1).getTimestamp().getSecond() * 1000 + infos.get(infos.size()-1).getTimestamp().getMillisecond();
|
if (infos != null && infos.size() > 0) {
|
||||||
int beginMs = infos.get(0).getTimestamp().getSecond() * 1000 + infos.get(0).getTimestamp().getMillisecond();
|
int endMs = infos.get(infos.size()-1).getTimestamp().getSecond() * 1000 + infos.get(infos.size()-1).getTimestamp().getMillisecond();
|
||||||
sampleDuration = (endMs - beginMs) /1000;
|
int beginMs = infos.get(0).getTimestamp().getSecond() * 1000 + infos.get(0).getTimestamp().getMillisecond();
|
||||||
List<PerfMetricSeries> vals = ((PerfEntityMetric)values.get(i)).getValue();
|
sampleDuration = (endMs - beginMs) /1000;
|
||||||
for(int vi = 0; ((vals!= null) && (vi < vals.size())); ++vi){
|
List<PerfMetricSeries> vals = ((PerfEntityMetric)values.get(i)).getValue();
|
||||||
if(vals.get(vi) instanceof PerfMetricIntSeries) {
|
for(int vi = 0; ((vals!= null) && (vi < vals.size())); ++vi){
|
||||||
PerfMetricIntSeries val = (PerfMetricIntSeries)vals.get(vi);
|
if(vals.get(vi) instanceof PerfMetricIntSeries) {
|
||||||
List<Long> perfValues = val.getValue();
|
PerfMetricIntSeries val = (PerfMetricIntSeries)vals.get(vi);
|
||||||
if (vals.get(vi).getId().getCounterId() == rxPerfCounterInfo.getKey()) {
|
List<Long> perfValues = val.getValue();
|
||||||
networkReadKBs = sampleDuration * perfValues.get(3); //get the average RX rate multiplied by sampled duration
|
if (vals.get(vi).getId().getCounterId() == rxPerfCounterInfo.getKey()) {
|
||||||
}
|
networkReadKBs = sampleDuration * perfValues.get(3); //get the average RX rate multiplied by sampled duration
|
||||||
if (vals.get(vi).getId().getCounterId() == txPerfCounterInfo.getKey()) {
|
}
|
||||||
networkWriteKBs = sampleDuration * perfValues.get(3);//get the average TX rate multiplied by sampled duration
|
if (vals.get(vi).getId().getCounterId() == txPerfCounterInfo.getKey()) {
|
||||||
|
networkWriteKBs = sampleDuration * perfValues.get(3);//get the average TX rate multiplied by sampled duration
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user