CLOUDSTACK-5994. Hitting IndexOutOfBoundsException in GetVmStatsCommand after upgrade.

To obtain network read/write statistics, multiply sample duration with the
average of the particular performance metric obtained over the sample period.
This commit is contained in:
Likitha Shetty 2014-01-30 18:01:28 +05:30
parent cb048f4108
commit 06f79a881c
1 changed files with 7 additions and 2 deletions

View File

@ -5290,11 +5290,16 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
if (vals.get(vi) instanceof PerfMetricIntSeries) {
PerfMetricIntSeries val = (PerfMetricIntSeries)vals.get(vi);
List<Long> perfValues = val.getValue();
Long sumRate = 0L;
for (int j = 0; j < infos.size(); j++) { // Size of the array matches the size as the PerfSampleInfo
sumRate += perfValues.get(j);
}
Long averageRate = sumRate / infos.size();
if (vals.get(vi).getId().getCounterId() == rxPerfCounterInfo.getKey()) {
networkReadKBs = sampleDuration * perfValues.get(3); //get the average RX rate multiplied by sampled duration
networkReadKBs = sampleDuration * averageRate; //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
networkWriteKBs = sampleDuration * averageRate;//get the average TX rate multiplied by sampled duration
}
}
}