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 to c229244
Date Tue, 06 Aug 2013 10:40:39 GMT
Updated Branches:
  refs/heads/4.2 fd7b9c44b -> c229244da


CLOUDSTACK-2729: move unlock to finally block to handle failed libvirt operations
(cherry picked from commit 5cb090ed40816950d0c9dbb62135240a7c8b1e3d)


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

Branch: refs/heads/4.2
Commit: c229244dabb5c5685fbb1aab84de9afdf199820b
Parents: fd7b9c4
Author: Wei Zhou <w.zhou@leaseweb.com>
Authored: Tue Aug 6 12:40:06 2013 +0200
Committer: Wei Zhou <w.zhou@leaseweb.com>
Committed: Tue Aug 6 12:40:32 2013 +0200

----------------------------------------------------------------------
 .../kvm/storage/LibvirtStorageAdaptor.java        | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c229244d/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java
b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java
index 22a1be9..1558d9c 100644
--- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java
+++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java
@@ -1175,10 +1175,13 @@ public class LibvirtStorageAdaptor implements StorageAdaptor {
         }
         String lockFile = _mountPoint + File.separator + pool.getUUIDString() + File.separator
+ _lockfile;
         if (lock(lockFile, 30)) {
-            pool.refresh(0);
-            unlock(lockFile);
+            try {
+                pool.refresh(0);
+            } finally {
+                unlock(lockFile);
+            }
         } else {
-            throw new CloudRuntimeException("Can not get file lock to refresh the pool" +
pool.getUUIDString());
+            throw new CloudRuntimeException("Can not get file lock to refresh the pool "
+ pool.getUUIDString());
         }
     }
 
@@ -1190,10 +1193,13 @@ public class LibvirtStorageAdaptor implements StorageAdaptor {
         }
         String lockFile = pool.getLocalPath() + File.separator + _lockfile;
         if (lock(lockFile, 30)) {
-            vol.delete(0);
-            unlock(lockFile);
+            try {
+                vol.delete(0);
+            } finally {
+                unlock(lockFile);
+            }
         } else {
-            throw new CloudRuntimeException("Can not get file lock to delete the volume"
+ vol.getPath());
+            throw new CloudRuntimeException("Can not get file lock to delete the volume "
+ vol.getPath());
         }
     }
 


Mime
View raw message