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

[11/11] git commit: updated refs/heads/4.3 to e089b91

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.
(cherry picked from commit 16c3f53793517e3c924df5ff6d9dc872dd508731)

Signed-off-by: Animesh Chaturvedi <an...@apache.org>


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

Branch: refs/heads/4.3
Commit: e089b91385ad032af5e39029f1203664f07b848b
Parents: 32fd3b8
Author: Likitha Shetty <li...@citrix.com>
Authored: Thu Jan 30 18:01:28 2014 +0530
Committer: Animesh Chaturvedi <an...@apache.org>
Committed: Thu Jan 30 17:59:37 2014 -0800

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


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e089b913/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
                                         }
                                     }
                                 }