Skip to content

Commit 5b2dd6e

Browse files
Fix for NFS3 primary storage pool is failing to come out of maintenan… (#71)
Fix for NFS3 primary storage pool is failing to come out of maintenance mode ### Description This PR has the following: 1. For NetworkFileSystem type, libvirtd handles mounting and unmounting of nfs mount [Ref: https://libvirt.org/storage.html] 2. KVM adaptor hasn't overridden `deleteStoragePool` method leading to only just the change in the DB. This was leading to error in case of `Cancel Maintenance` as the pool already exists with the host. 3. Also, when `Enable Maintenance` call comes, it was first removing the nfs mount, which was causing the libvirtd to error out during `Destroy Pool` call as the mount wasn't available. <!--- ******************************************************************************* --> <!--- NOTE: AUTOMATION USES THE DESCRIPTIONS TO SET LABELS AND PRODUCE DOCUMENTATION. --> <!--- PLEASE PUT AN 'X' in only **ONE** box --> <!--- ******************************************************************************* --> ### Types of changes - [ ] Breaking change (fix or feature that would cause existing functionality to change) - [ ] New feature (non-breaking change which adds functionality) - [X] Bug fix (non-breaking change which fixes an issue) - [ ] Enhancement (improves an existing feature and functionality) - [ ] Cleanup (Code refactoring and cleanup, that may add test cases) - [ ] Build/CI - [ ] Test (unit or integration test code) ### Feature/Enhancement Scale or Bug Severity #### Feature/Enhancement Scale - [] Major - [ ] Minor #### Bug Severity - [ ] BLOCKER - [ ] Critical - [X] Major - [ ] Minor - [ ] Trivial ### Screenshots (if appropriate): ### How Has This Been Tested? `Previously:` <img width="1035" height="362" alt="Screenshot 2026-07-08 at 8 00 05 AM" src="https://github.com/user-attachments/assets/91a3bcd7-cb6f-4b53-81f5-0851abd337ee" /> <img width="1301" height="365" alt="Screenshot 2026-07-08 at 7 58 31 AM" src="https://github.com/user-attachments/assets/5444b1ae-5cfa-4709-a48f-107b8a257e29" /> <img width="1035" height="362" alt="Screenshot 2026-07-08 at 8 00 29 AM" src="https://github.com/user-attachments/assets/bbeaece1-8795-46ef-b1c7-9a9b24910b21" /> <img width="1301" height="327" alt="Screenshot 2026-07-08 at 8 01 37 AM" src="https://github.com/user-attachments/assets/c9086ef2-066c-4661-a684-c4788e471fdc" /> So, clearly though the nfs mount was removed, the libvirtd still has the pool details with it. `Now:` <img width="1042" height="351" alt="Screenshot 2026-07-08 at 8 30 46 AM" src="https://github.com/user-attachments/assets/59d2c629-41bd-4991-9988-3989dd3497aa" /> <img width="1300" height="382" alt="Screenshot 2026-07-08 at 8 31 18 AM" src="https://github.com/user-attachments/assets/9b774243-8329-4fb8-babb-a0891d20fc6a" /> <img width="1043" height="355" alt="Screenshot 2026-07-08 at 8 32 41 AM" src="https://github.com/user-attachments/assets/5207517a-c2d0-4935-adf0-db70877b79fa" /> <img width="1299" height="312" alt="Screenshot 2026-07-08 at 8 33 02 AM" src="https://github.com/user-attachments/assets/fd5014bb-8d46-423b-8039-b2caa391b885" /> <img width="1049" height="340" alt="Screenshot 2026-07-08 at 8 34 32 AM" src="https://github.com/user-attachments/assets/ec951783-a90e-4118-89d2-8d62b28f138e" /> <img width="1299" height="365" alt="Screenshot 2026-07-08 at 8 33 46 AM" src="https://github.com/user-attachments/assets/a64a2c86-9089-4f67-a345-90a0dbfa88fc" />
1 parent 54d65f2 commit 5b2dd6e

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ public boolean deleteStoragePool(StoragePoolType type, String uuid) {
417417
if (type == StoragePoolType.NetworkFilesystem) {
418418
_haMonitor.removeStoragePool(uuid);
419419
}
420-
boolean deleteStatus = adaptor.deleteStoragePool(uuid);;
420+
boolean deleteStatus = adaptor.deleteStoragePool(uuid);
421421
synchronized (_storagePools) {
422422
_storagePools.remove(uuid);
423423
}
@@ -426,10 +426,12 @@ public boolean deleteStoragePool(StoragePoolType type, String uuid) {
426426

427427
public boolean deleteStoragePool(StoragePoolType type, String uuid, Map<String, String> details) {
428428
StorageAdaptor adaptor = getStorageAdaptor(type);
429+
// For NetworkFilesystem, libvirt will take care of unmounting the nfs mount. If nfs mount has been removed before libvirt's pool
430+
// delete, libvirt will throw an error.
431+
boolean deleteStatus = adaptor.deleteStoragePool(uuid, details);
429432
if (type == StoragePoolType.NetworkFilesystem) {
430433
_haMonitor.removeStoragePool(uuid);
431434
}
432-
boolean deleteStatus = adaptor.deleteStoragePool(uuid, details);
433435
synchronized (_storagePools) {
434436
_storagePools.remove(uuid);
435437
}

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -905,6 +905,11 @@ private boolean destroyStoragePoolHandleException(Connect conn, String uuid)
905905
return false;
906906
}
907907

908+
@Override
909+
public boolean deleteStoragePool(String uuid, Map<String, String> details) {
910+
return deleteStoragePool(uuid);
911+
}
912+
908913
@Override
909914
public boolean deleteStoragePool(String uuid) {
910915
logger.info("Attempting to remove storage pool " + uuid + " from libvirt");

0 commit comments

Comments
 (0)