Return-Path: X-Original-To: apmail-cloudstack-commits-archive@www.apache.org Delivered-To: apmail-cloudstack-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C39A61079A for ; Fri, 31 Jan 2014 02:08:26 +0000 (UTC) Received: (qmail 81278 invoked by uid 500); 31 Jan 2014 02:08:13 -0000 Delivered-To: apmail-cloudstack-commits-archive@cloudstack.apache.org Received: (qmail 81084 invoked by uid 500); 31 Jan 2014 02:08:06 -0000 Mailing-List: contact commits-help@cloudstack.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cloudstack.apache.org Delivered-To: mailing list commits@cloudstack.apache.org Received: (qmail 80998 invoked by uid 99); 31 Jan 2014 02:08:05 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 31 Jan 2014 02:08:05 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id C0BE69170F3; Fri, 31 Jan 2014 02:08:04 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: animesh@apache.org To: commits@cloudstack.apache.org Date: Fri, 31 Jan 2014 02:08:14 -0000 Message-Id: <759052acc94a493baa5d8969e850306f@git.apache.org> In-Reply-To: <3d39c8fdaac8452dbeb36f775d37ff2d@git.apache.org> References: <3d39c8fdaac8452dbeb36f775d37ff2d@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [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 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 Authored: Thu Jan 30 18:01:28 2014 +0530 Committer: Animesh Chaturvedi 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 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 } } }