From ea50c6663fcff4b166fc43cb652638e3c1080c64 Mon Sep 17 00:00:00 2001 From: Wei Zhou Date: Thu, 8 Aug 2013 16:37:36 +0200 Subject: [PATCH] CLOUDSTACK-2729: use spd.getTargetPath instead of mount path to fix issue on local storage (cherry picked from commit b2ed632396fb57fedd7f88d36408299167f963c0) --- .../hypervisor/kvm/storage/LibvirtStorageAdaptor.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) 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 ca0d3c0b4eb..89930947615 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 @@ -1173,15 +1173,17 @@ public class LibvirtStorageAdaptor implements StorageAdaptor { pool.refresh(0); return; } - String lockFile = _mountPoint + File.separator + pool.getUUIDString() + File.separator + _lockfile; + String lockFile = spd.getTargetPath() + File.separator + _lockfile; + s_logger.debug("Attempting to lock pool " + pool.getName() + " with file " + lockFile); if (lock(lockFile, 30)) { try { pool.refresh(0); } finally { + s_logger.debug("Releasing the lock on pool " + pool.getName() + " with file " + lockFile); 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.getName()); } } @@ -1192,14 +1194,16 @@ public class LibvirtStorageAdaptor implements StorageAdaptor { return; } String lockFile = pool.getLocalPath() + File.separator + _lockfile; + s_logger.debug("Attempting to lock pool " + pool.getName() + " with file " + lockFile); if (lock(lockFile, 30)) { try { vol.delete(0); } finally { + s_logger.debug("Releasing the lock on pool " + pool.getName() + " with file " + lockFile); 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.getName()); } }