Skip to content

Commit 6f3d2d1

Browse files
Addressed the comments received on upstream PR for refactoring the fix for NFS Cancel maintenance
1 parent 4d1fbde commit 6f3d2d1

4 files changed

Lines changed: 13 additions & 11 deletions

File tree

‎plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/KVMHAMonitor.java‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,12 @@ public void addStoragePool(HAStoragePool pool) {
5050
}
5151
}
5252

53+
public void unregisterStoragePool(String uuid) {
54+
synchronized (haStoragePools) {
55+
haStoragePools.remove(uuid);
56+
}
57+
}
58+
5359
public void removeStoragePool(String uuid) {
5460
synchronized (haStoragePools) {
5561
HAStoragePool pool = haStoragePools.get(uuid);

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -457,11 +457,12 @@ public synchronized boolean deleteStoragePool(StoragePoolType type, String uuid)
457457

458458
public boolean deleteStoragePool(StoragePoolType type, String uuid, Map<String, String> details) {
459459
StorageAdaptor adaptor = getStorageAdaptor(type);
460-
// For NetworkFilesystem, libvirt will take care of unmounting the nfs mount. If nfs mount has been removed before libvirt's pool
461-
// delete, libvirt will throw an error.
462-
boolean deleteStatus = adaptor.deleteStoragePool(uuid, details);
460+
boolean deleteStatus;
463461
if (type == StoragePoolType.NetworkFilesystem) {
464-
_haMonitor.removeStoragePool(uuid);
462+
_haMonitor.unregisterStoragePool(uuid);
463+
deleteStatus = adaptor.deleteStoragePool(uuid);
464+
} else {
465+
deleteStatus = adaptor.deleteStoragePool(uuid, details);
465466
}
466467
synchronized (_storagePools) {
467468
_storagePools.remove(uuid);

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

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

894-
@Override
895-
public boolean deleteStoragePool(String uuid, Map<String, String> details) {
896-
return deleteStoragePool(uuid);
897-
}
898-
899894
@Override
900895
public boolean deleteStoragePool(String uuid) {
901896
logger.info("Attempting to remove storage pool " + uuid + " from libvirt");

‎server/src/main/java/com/cloud/storage/StorageManagerImpl.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1276,7 +1276,7 @@ public PrimaryDataStoreInfo updateStoragePool(UpdateStoragePoolCmd cmd) throws I
12761276
if (capacityBytes != null) {
12771277
if (capacityBytes != pool.getCapacityBytes()) {
12781278
updatedCapacityBytes = capacityBytes;
1279-
details.put(PrimaryDataStoreLifeCycle.CAPACITY_BYTES, String.valueOf(updatedCapacityBytes));
1279+
details.put(PrimaryDataStoreLifeCycle.CAPACITY_BYTES, String.valueOf(updatedCapacityBytes));
12801280
changes = true;
12811281
}
12821282
}
@@ -1286,7 +1286,7 @@ public PrimaryDataStoreInfo updateStoragePool(UpdateStoragePoolCmd cmd) throws I
12861286
if (capacityIops != null) {
12871287
if (!capacityIops.equals(pool.getCapacityIops())) {
12881288
updatedCapacityIops = capacityIops;
1289-
details.put(PrimaryDataStoreLifeCycle.CAPACITY_IOPS, String.valueOf(updatedCapacityIops));
1289+
details.put(PrimaryDataStoreLifeCycle.CAPACITY_IOPS, String.valueOf(updatedCapacityIops));
12901290
changes = true;
12911291
}
12921292
}

0 commit comments

Comments
 (0)