cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From weiz...@apache.org
Subject git commit: updated refs/heads/4.2-forward to d0ffc9e
Date Tue, 03 Sep 2013 11:14:51 GMT
Updated Branches:
  refs/heads/4.2-forward b99962d27 -> d0ffc9e33


CLOUDSTACK-1192: fix collectVmDiskStatistics issue when stopping a vm

(Cherry-picked from commit 65c1c986da2cd14b9138a229ad6843ffbf46f3f4)


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

Branch: refs/heads/4.2-forward
Commit: d0ffc9e33985a4a19277b94df6d13a94b53c317c
Parents: b99962d
Author: Wei Zhou <w.zhou@leaseweb.com>
Authored: Tue Sep 3 11:45:34 2013 +0200
Committer: Wei Zhou <w.zhou@leaseweb.com>
Committed: Tue Sep 3 13:13:58 2013 +0200

----------------------------------------------------------------------
 server/src/com/cloud/vm/UserVmManagerImpl.java | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d0ffc9e3/server/src/com/cloud/vm/UserVmManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/vm/UserVmManagerImpl.java b/server/src/com/cloud/vm/UserVmManagerImpl.java
index a970478..812f838 100755
--- a/server/src/com/cloud/vm/UserVmManagerImpl.java
+++ b/server/src/com/cloud/vm/UserVmManagerImpl.java
@@ -3486,8 +3486,8 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager,
Use
     public void collectVmDiskStatistics (UserVmVO userVm) {
         // support KVM only util 2013.06.25
         if (!userVm.getHypervisorType().equals(HypervisorType.KVM))
-            return;        
-    	// Collect vm disk statistics from host before stopping Vm
+            return;
+    	s_logger.debug("Collect vm disk statistics from host before stopping Vm");
     	long hostId = userVm.getHostId();
     	List<String> vmNames = new ArrayList<String>();
     	vmNames.add(userVm.getInstanceName());
@@ -3509,8 +3509,9 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager,
Use
             try {
                 txn.start();
                 HashMap<String, List<VmDiskStatsEntry>> vmDiskStatsByName = diskStatsAnswer.getVmDiskStatsMap();
+                if (vmDiskStatsByName == null)
+                    return;
                 List<VmDiskStatsEntry> vmDiskStats = vmDiskStatsByName.get(userVm.getInstanceName());
-
                 if (vmDiskStats == null)
 		    return;
 
@@ -4982,7 +4983,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager,
Use
     @Override
     public void prepareStop(VirtualMachineProfile<UserVmVO> profile) {
         UserVmVO vm = _vmDao.findById(profile.getId());
-        if (vm.getState() == State.Running)
+        if (vm != null && vm.getState() == State.Stopping)
             collectVmDiskStatistics(vm);
     }
     


Mime
View raw message