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 2013/11/21 05:14:21 UTC

git commit: updated refs/heads/4.3 to ff24ed0

Updated Branches:
  refs/heads/4.3 5a44de282 -> ff24ed0c8


CLOUDSTACK-1868. GetVmStatsCommand throws NullPointerException with VMWare.


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

Branch: refs/heads/4.3
Commit: ff24ed0c8c8bec92ac986357af0c165e34277fb0
Parents: 5a44de2
Author: Likitha Shetty <li...@citrix.com>
Authored: Thu Nov 21 09:35:10 2013 +0530
Committer: Likitha Shetty <li...@citrix.com>
Committed: Thu Nov 21 09:36:21 2013 +0530

----------------------------------------------------------------------
 .../vmware/resource/VmwareResource.java         | 28 +++++++++++---------
 1 file changed, 15 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ff24ed0c/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 26ef047..69f1b74 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
@@ -6526,19 +6526,21 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
 
                         for(int i=0; i<values.size(); ++i) {
                             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();
-                            int beginMs = infos.get(0).getTimestamp().getSecond() * 1000 + infos.get(0).getTimestamp().getMillisecond();
-                            sampleDuration = (endMs - beginMs) /1000;
-                            List<PerfMetricSeries> vals = ((PerfEntityMetric)values.get(i)).getValue();
-                            for(int vi = 0; ((vals!= null) && (vi < vals.size())); ++vi){
-                                if(vals.get(vi) instanceof PerfMetricIntSeries) {
-                                    PerfMetricIntSeries val = (PerfMetricIntSeries)vals.get(vi);
-                                    List<Long> perfValues = val.getValue();
-                                    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 (infos != null && infos.size() > 0) {
+                                int endMs = infos.get(infos.size()-1).getTimestamp().getSecond() * 1000 + infos.get(infos.size()-1).getTimestamp().getMillisecond();
+                                int beginMs = infos.get(0).getTimestamp().getSecond() * 1000 + infos.get(0).getTimestamp().getMillisecond();
+                                sampleDuration = (endMs - beginMs) /1000;
+                                List<PerfMetricSeries> vals = ((PerfEntityMetric)values.get(i)).getValue();
+                                for(int vi = 0; ((vals!= null) && (vi < vals.size())); ++vi){
+                                    if(vals.get(vi) instanceof PerfMetricIntSeries) {
+                                        PerfMetricIntSeries val = (PerfMetricIntSeries)vals.get(vi);
+                                        List<Long> perfValues = val.getValue();
+                                        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
+                                        }
                                     }
                                 }
                             }