This is an automated email from the ASF dual-hosted git repository. sureshanaparti pushed a commit to branch 4.19 in repository https://gitbox.apache.org/repos/asf/cloudstack.git
The following commit(s) were added to refs/heads/4.19 by this push: new f4612c51ec4 libvirtstorage: Make sure netfs storage was really mounted (#8887) f4612c51ec4 is described below commit f4612c51ec444ff597867bc105c75976d298c103 Author: Rene Peinthor <rene.peint...@linbit.com> AuthorDate: Sun Jun 23 16:11:02 2024 +0200 libvirtstorage: Make sure netfs storage was really mounted (#8887) --- .../hypervisor/kvm/storage/LibvirtStorageAdaptor.java | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java b/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java index 9d62925e134..31281615bce 100644 --- a/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java +++ b/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java @@ -272,6 +272,16 @@ public class LibvirtStorageAdaptor implements StorageAdaptor { } } + private void checkNetfsStoragePoolMounted(String uuid) { + String targetPath = _mountPoint + File.separator + uuid; + int mountpointResult = Script.runSimpleBashScriptForExitValue("mountpoint -q " + targetPath); + if (mountpointResult != 0) { + String errMsg = String.format("libvirt failed to mount storage pool %s at %s", uuid, targetPath); + s_logger.error(errMsg); + throw new CloudRuntimeException(errMsg); + } + } + private StoragePool createNetfsStoragePool(PoolType fsType, Connect conn, String uuid, String host, String path) throws LibvirtException { String targetPath = _mountPoint + File.separator + uuid; LibvirtStoragePoolDef spd = new LibvirtStoragePoolDef(fsType, uuid, uuid, host, path, targetPath); @@ -692,6 +702,10 @@ public class LibvirtStorageAdaptor implements StorageAdaptor { sp.create(0); } + if (type == StoragePoolType.NetworkFilesystem) { + checkNetfsStoragePoolMounted(name); + } + return getStoragePool(name); } catch (LibvirtException e) { String error = e.toString(); @@ -756,10 +770,10 @@ public class LibvirtStorageAdaptor implements StorageAdaptor { if (e.toString().contains("exit status 16")) { String targetPath = _mountPoint + File.separator + uuid; s_logger.error("deleteStoragePool removed pool from libvirt, but libvirt had trouble unmounting the pool. Trying umount location " + targetPath + - "again in a few seconds"); + " again in a few seconds"); String result = Script.runSimpleBashScript("sleep 5 && umount " + targetPath); if (result == null) { - s_logger.error("Succeeded in unmounting " + targetPath); + s_logger.info("Succeeded in unmounting " + targetPath); return true; } s_logger.error("Failed to unmount " + targetPath);