cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bhais...@apache.org
Subject [cloudstack] 03/03: CLOUDSTACK-9113: skip vm with inconsistent state when getVmNetworkStats
Date Sun, 23 Jul 2017 15:15:30 GMT
This is an automated email from the ASF dual-hosted git repository.

bhaisaab pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cloudstack.git

commit c03923c7e75b70b3c7b33fb2e28cd1bed8ac5c7d
Author: Wei Zhou <w.zhou@tech.leaseweb.com>
AuthorDate: Mon Dec 7 12:02:43 2015 +0100

    CLOUDSTACK-9113: skip vm with inconsistent state when getVmNetworkStats
---
 .../wrapper/LibvirtGetVmNetworkStatsCommandWrapper.java  | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtGetVmNetworkStatsCommandWrapper.java
b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtGetVmNetworkStatsCommandWrapper.java
index 19a0a46..20ee4fd 100644
--- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtGetVmNetworkStatsCommandWrapper.java
+++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtGetVmNetworkStatsCommandWrapper.java
@@ -48,12 +48,16 @@ public final class LibvirtGetVmNetworkStatsCommandWrapper extends CommandWrapper
             final HashMap<String, List<VmNetworkStatsEntry>> vmNetworkStatsNameMap
= new HashMap<String, List<VmNetworkStatsEntry>>();
             final Connect conn = libvirtUtilitiesHelper.getConnection();
             for (final String vmName : vmNames) {
-                final List<VmNetworkStatsEntry> statEntry = libvirtComputingResource.getVmNetworkStat(conn,
vmName);
-                if (statEntry == null) {
-                    continue;
-                }
+                try {
+                    final List<VmNetworkStatsEntry> statEntry = libvirtComputingResource.getVmNetworkStat(conn,
vmName);
+                    if (statEntry == null) {
+                        continue;
+                    }
 
-                vmNetworkStatsNameMap.put(vmName, statEntry);
+                    vmNetworkStatsNameMap.put(vmName, statEntry);
+                } catch (LibvirtException e) {
+                    s_logger.warn("Can't get vm network stats: " + e.toString() + ", continue");
+                }
             }
             return new GetVmNetworkStatsAnswer(command, "", command.getHostName(), vmNetworkStatsNameMap);
         } catch (final LibvirtException e) {
@@ -61,4 +65,4 @@ public final class LibvirtGetVmNetworkStatsCommandWrapper extends CommandWrapper
             return new GetVmNetworkStatsAnswer(command, null, null, null);
         }
     }
-}
\ No newline at end of file
+}

-- 
To stop receiving notification emails like this one, please contact
"commits@cloudstack.apache.org" <commits@cloudstack.apache.org>.

Mime
View raw message