Skip to content

Commit 945646b

Browse files
committed
git commit -m "KVM: skip mountpoint check for RBD storage pools (fix snapshot errors)"
1 parent f9513b4 commit 945646b

File tree

1 file changed

+21
-6
lines changed

1 file changed

+21
-6
lines changed

plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -306,12 +306,27 @@ public void storagePoolRefresh(StoragePool pool) {
306306
}
307307

308308
private void checkNetfsStoragePoolMounted(String uuid) {
309-
String targetPath = _mountPoint + File.separator + uuid;
310-
int mountpointResult = Script.runSimpleBashScriptForExitValue("mountpoint -q " + targetPath);
311-
if (mountpointResult != 0) {
312-
String errMsg = String.format("libvirt failed to mount storage pool %s at %s", uuid, targetPath);
313-
logger.error(errMsg);
314-
throw new CloudRuntimeException(errMsg);
309+
try {
310+
// lookup the storage pool definition
311+
Connect conn = LibvirtConnection.getConnection();
312+
StoragePool pool = conn.storagePoolLookupByUUIDString(uuid);
313+
LibvirtStoragePoolDef def = getStoragePoolDef(conn, pool);
314+
315+
// Skip mountpoint check if pool type is RBD
316+
if (def.getPoolType() == LibvirtStoragePoolDef.PoolType.RBD) {
317+
logger.debug("Skipping mountpoint check for RBD pool " + uuid);
318+
return;
319+
}
320+
321+
String targetPath = _mountPoint + File.separator + uuid;
322+
int mountpointResult = Script.runSimpleBashScriptForExitValue("mountpoint -q " + targetPath);
323+
if (mountpointResult != 0) {
324+
String errMsg = String.format("libvirt failed to mount storage pool %s at %s", uuid, targetPath);
325+
logger.error(errMsg);
326+
throw new CloudRuntimeException(errMsg);
327+
}
328+
} catch (LibvirtException e) {
329+
throw new CloudRuntimeException("Failed to check storage pool type for " + uuid, e);
315330
}
316331
}
317332

0 commit comments

Comments
 (0)