You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by re...@apache.org on 2015/12/12 13:59:25 UTC

[1/2] git commit: updated refs/heads/4.6 to 65bf2ed

Repository: cloudstack
Updated Branches:
  refs/heads/4.6 61ebb53e1 -> 65bf2edfa


CLOUDSTACK-9113: skip vm with inconsistent state when getVmStats/getVmDiskStats


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

Branch: refs/heads/4.6
Commit: 24edf1c1e4892b2f34b334b6e6fa13364bc413e2
Parents: 9ce1334
Author: Wei Zhou <w....@tech.leaseweb.com>
Authored: Mon Dec 7 12:02:43 2015 +0100
Committer: Wei Zhou <w....@tech.leaseweb.com>
Committed: Mon Dec 7 12:15:24 2015 +0100

----------------------------------------------------------------------
 .../LibvirtGetVmDiskStatsCommandWrapper.java        | 16 ++++++++++------
 .../wrapper/LibvirtGetVmStatsCommandWrapper.java    | 14 +++++++++-----
 2 files changed, 19 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/24edf1c1/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtGetVmDiskStatsCommandWrapper.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtGetVmDiskStatsCommandWrapper.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtGetVmDiskStatsCommandWrapper.java
index 52449e9..6316be9 100644
--- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtGetVmDiskStatsCommandWrapper.java
+++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtGetVmDiskStatsCommandWrapper.java
@@ -48,12 +48,16 @@ public final class LibvirtGetVmDiskStatsCommandWrapper extends CommandWrapper<Ge
             final HashMap<String, List<VmDiskStatsEntry>> vmDiskStatsNameMap = new HashMap<String, List<VmDiskStatsEntry>>();
             final Connect conn = libvirtUtilitiesHelper.getConnection();
             for (final String vmName : vmNames) {
-                final List<VmDiskStatsEntry> statEntry = libvirtComputingResource.getVmDiskStat(conn, vmName);
-                if (statEntry == null) {
-                    continue;
-                }
+                try {
+                    final List<VmDiskStatsEntry> statEntry = libvirtComputingResource.getVmDiskStat(conn, vmName);
+                    if (statEntry == null) {
+                        continue;
+                    }
 
-                vmDiskStatsNameMap.put(vmName, statEntry);
+                    vmDiskStatsNameMap.put(vmName, statEntry);
+                } catch (LibvirtException e) {
+                    s_logger.warn("Can't get vm disk stats: " + e.toString() + ", continue");
+                }
             }
             return new GetVmDiskStatsAnswer(command, "", command.getHostName(), vmDiskStatsNameMap);
         } catch (final LibvirtException e) {
@@ -61,4 +65,4 @@ public final class LibvirtGetVmDiskStatsCommandWrapper extends CommandWrapper<Ge
             return new GetVmDiskStatsAnswer(command, null, null, null);
         }
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/24edf1c1/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtGetVmStatsCommandWrapper.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtGetVmStatsCommandWrapper.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtGetVmStatsCommandWrapper.java
index 6a71d2f..e19d868 100644
--- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtGetVmStatsCommandWrapper.java
+++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtGetVmStatsCommandWrapper.java
@@ -49,12 +49,16 @@ public final class LibvirtGetVmStatsCommandWrapper extends CommandWrapper<GetVmS
                 final LibvirtUtilitiesHelper libvirtUtilitiesHelper = libvirtComputingResource.getLibvirtUtilitiesHelper();
 
                 final Connect conn = libvirtUtilitiesHelper.getConnectionByVmName(vmName);
-                final VmStatsEntry statEntry = libvirtComputingResource.getVmStat(conn, vmName);
-                if (statEntry == null) {
-                    continue;
-                }
+                try {
+                    final VmStatsEntry statEntry = libvirtComputingResource.getVmStat(conn, vmName);
+                    if (statEntry == null) {
+                        continue;
+                    }
 
-                vmStatsNameMap.put(vmName, statEntry);
+                    vmStatsNameMap.put(vmName, statEntry);
+                } catch (LibvirtException e) {
+                    s_logger.warn("Can't get vm stats: " + e.toString() + ", continue");
+                }
             }
             return new GetVmStatsAnswer(command, vmStatsNameMap);
         } catch (final LibvirtException e) {


[2/2] git commit: updated refs/heads/4.6 to 65bf2ed

Posted by re...@apache.org.
Merge pull request #1182 from ustcweizhou/CLOUDSTACK-9113-getVmStats

[4.6] CLOUDSTACK-9113: skip vm with inconsistent state when getVmStats/getVmDiskStatson KVM, if there is a vm has inconsistent state between hypervisor and db, the getVmStat will terminate and return null, all vm stats will not be updated.
we should skip the vm which has inconsistent state, and continue on others.

* pr/1182:
  CLOUDSTACK-9113: skip vm with inconsistent state when getVmStats/getVmDiskStats

Signed-off-by: Remi Bergsma <gi...@remi.nl>


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

Branch: refs/heads/4.6
Commit: 65bf2edfa196601d68e82f09012a393ee73499a2
Parents: 61ebb53 24edf1c
Author: Remi Bergsma <gi...@remi.nl>
Authored: Sat Dec 12 13:58:48 2015 +0100
Committer: Remi Bergsma <gi...@remi.nl>
Committed: Sat Dec 12 13:58:49 2015 +0100

----------------------------------------------------------------------
 .../LibvirtGetVmDiskStatsCommandWrapper.java        | 16 ++++++++++------
 .../wrapper/LibvirtGetVmStatsCommandWrapper.java    | 14 +++++++++-----
 2 files changed, 19 insertions(+), 11 deletions(-)
----------------------------------------------------------------------