CLOUDSTACK-2729: use spd.getTargetPath instead of mount path to fix issue on local storage

(cherry picked from commit b2ed632396)
This commit is contained in:
Wei Zhou 2013-08-08 16:37:36 +02:00
parent caa9d27822
commit ea50c6663f
1 changed files with 7 additions and 3 deletions

View File

@ -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());
}
}