sureshanaparti commented on code in PR #9390:
URL: https://github.com/apache/cloudstack/pull/9390#discussion_r1677562831
##########
plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java:
##########
@@ -766,26 +766,55 @@ public KVMStoragePool createStoragePool(String name,
String host, int port, Stri
}
}
+ private boolean destroyStoragePool(Connect conn, String uuid) throws
LibvirtException
+ {
+ StoragePool sp;
+ try {
+ sp = conn.storagePoolLookupByUUIDString(uuid);
+ } catch (LibvirtException exc) {
+ s_logger.warn("Storage pool " + uuid + " doesn't exist in libvirt.
Assuming it is already removed");
+ return true;
+ }
+
+ if (sp != null) {
+ if (sp.isPersistent() == 1) {
+ sp.destroy();
+ sp.undefine();
+ } else {
+ sp.destroy();
+ }
+ sp.free();
+
+ return true;
+ } else {
+ s_logger.warn("Storage pool " + uuid + " doesn't exist in libvirt.
Assuming it is already removed");
+ return false;
+ }
+ }
+
+ private boolean destroyStoragePoolHandleException(Connect conn, String
uuid)
+ {
+ try {
+ return destroyStoragePool(conn, uuid);
+ }
Review Comment:
```suggestion
} catch (LibvirtException e)
```
##########
plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java:
##########
@@ -766,26 +766,55 @@ public KVMStoragePool createStoragePool(String name,
String host, int port, Stri
}
}
+ private boolean destroyStoragePool(Connect conn, String uuid) throws
LibvirtException
+ {
+ StoragePool sp;
+ try {
+ sp = conn.storagePoolLookupByUUIDString(uuid);
+ } catch (LibvirtException exc) {
+ s_logger.warn("Storage pool " + uuid + " doesn't exist in libvirt.
Assuming it is already removed");
+ return true;
+ }
+
+ if (sp != null) {
+ if (sp.isPersistent() == 1) {
+ sp.destroy();
+ sp.undefine();
+ } else {
+ sp.destroy();
+ }
+ sp.free();
+
+ return true;
+ } else {
+ s_logger.warn("Storage pool " + uuid + " doesn't exist in libvirt.
Assuming it is already removed");
+ return false;
+ }
+ }
+
+ private boolean destroyStoragePoolHandleException(Connect conn, String
uuid)
+ {
+ try {
+ return destroyStoragePool(conn, uuid);
+ }
+ catch (LibvirtException e)
Review Comment:
```suggestion
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]