Return-Path: X-Original-To: apmail-cloudstack-commits-archive@www.apache.org Delivered-To: apmail-cloudstack-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 5920BFBCE for ; Tue, 6 Aug 2013 10:40:40 +0000 (UTC) Received: (qmail 39034 invoked by uid 500); 6 Aug 2013 10:40:40 -0000 Delivered-To: apmail-cloudstack-commits-archive@cloudstack.apache.org Received: (qmail 39017 invoked by uid 500); 6 Aug 2013 10:40:40 -0000 Mailing-List: contact commits-help@cloudstack.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cloudstack.apache.org Delivered-To: mailing list commits@cloudstack.apache.org Received: (qmail 39010 invoked by uid 99); 6 Aug 2013 10:40:39 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 06 Aug 2013 10:40:39 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id A10528B9D21; Tue, 6 Aug 2013 10:40:39 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: weizhou@apache.org To: commits@cloudstack.apache.org Message-Id: <1e7d986638dc4a9eac3f3f1f5b6aefcf@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: git commit: updated refs/heads/4.2 to c229244 Date: Tue, 6 Aug 2013 10:40:39 +0000 (UTC) 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 Authored: Tue Aug 6 12:40:06 2013 +0200 Committer: Wei Zhou 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()); } }