cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wid...@apache.org
Subject [02/50] [abbrv] git commit: updated refs/heads/statscollector-graphite to e06a814
Date Tue, 11 Nov 2014 12:03:41 GMT
CLOUDSTACK-7683: hold a db lock during vm expunge


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

Branch: refs/heads/statscollector-graphite
Commit: 812b0122e2972987e3b4a38cc7431ace78b09145
Parents: 885bba9
Author: Edison Su <sudison@gmail.com>
Authored: Thu Nov 6 15:22:34 2014 -0800
Committer: Edison Su <sudison@gmail.com>
Committed: Thu Nov 6 15:37:15 2014 -0800

----------------------------------------------------------------------
 server/src/com/cloud/vm/UserVmManagerImpl.java | 6 ++++++
 1 file changed, 6 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/812b0122/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 2636096..01a692d 100755
--- a/server/src/com/cloud/vm/UserVmManagerImpl.java
+++ b/server/src/com/cloud/vm/UserVmManagerImpl.java
@@ -1703,6 +1703,10 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager,
Vir
 
     @Override
     public boolean expunge(UserVmVO vm, long callerUserId, Account caller) {
+        vm = _vmDao.acquireInLockTable(vm.getId());
+        if (vm == null) {
+            return false;
+        }
         try {
             List<VolumeVO> rootVol = _volsDao.findByInstanceAndType(vm.getId(), Volume.Type.ROOT);
             // expunge the vm
@@ -1739,6 +1743,8 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager,
Vir
         } catch (ConcurrentOperationException e) {
             s_logger.warn("Concurrent operations on expunging " + vm, e);
             return false;
+        } finally {
+            _vmDao.releaseFromLockTable(vm.getId());
         }
     }
 


Mime
View raw message