You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by li...@apache.org on 2014/01/30 14:03:05 UTC

git commit: updated refs/heads/4.3-forward to 16c3f53

Updated Branches:
  refs/heads/4.3-forward 775fa0f0d -> 16c3f5379


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.


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/16c3f537
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/16c3f537
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/16c3f537

Branch: refs/heads/4.3-forward
Commit: 16c3f53793517e3c924df5ff6d9dc872dd508731
Parents: 775fa0f
Author: Likitha Shetty <li...@citrix.com>
Authored: Thu Jan 30 18:01:28 2014 +0530
Committer: Likitha Shetty <li...@citrix.com>
Committed: Thu Jan 30 18:20:44 2014 +0530

----------------------------------------------------------------------
 .../cloud/hypervisor/vmware/resource/VmwareResource.java    | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/16c3f537/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
index 7439f12..d1fea92 100755
--- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
+++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
@@ -6690,11 +6690,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
                                         }
                                     }
                                 }