DaanHoogland commented on code in PR #10231:
URL: https://github.com/apache/cloudstack/pull/10231#discussion_r1924862137
##########
plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtDeleteStoragePoolCommandWrapper.java:
##########
@@ -39,6 +47,34 @@ public Answer execute(final DeleteStoragePoolCommand
command, final LibvirtCompu
final KVMStoragePoolManager storagePoolMgr =
libvirtComputingResource.getStoragePoolMgr();
storagePoolMgr.deleteStoragePool(pool.getType(),
pool.getUuid());
+ if (Storage.StoragePoolType.Filesystem.equals(pool.getType())
&& !libvirtComputingResource.DEFAULT_LOCAL_STORAGE_PATH.equals(pool.getPath()))
{
+ String localStoragePath =
AgentPropertiesFileHandler.getPropertyValue(AgentProperties.LOCAL_STORAGE_PATH);
+ String localStorageUuid =
AgentPropertiesFileHandler.getPropertyValue(AgentProperties.LOCAL_STORAGE_UUID);
+
+ String uuidToRemove = pool.getUuid();
+ String pathToRemove = pool.getPath();
+
+ if (localStorageUuid != null && uuidToRemove != null) {
+ localStorageUuid =
Arrays.stream(localStorageUuid.split(","))
+ .filter(uuid -> !uuid.equals(uuidToRemove))
+ .collect(Collectors.joining(","));
+ }
+
+ if (localStoragePath != null && pathToRemove != null) {
+ localStoragePath =
Arrays.stream(localStoragePath.split(","))
+ .filter(path -> !path.equals(pathToRemove))
+ .collect(Collectors.joining(","));
+ }
+
+ PropertiesStorage agentProperties = new
PropertiesStorage();
+ agentProperties.configure("AgentProperties", new
HashMap<String, Object>());
+ if (localStorageUuid != null) {
+
agentProperties.persist(AgentProperties.LOCAL_STORAGE_UUID.getName(),
localStorageUuid);
+ }
+ if (localStoragePath != null) {
+
agentProperties.persist(AgentProperties.LOCAL_STORAGE_PATH.getName(),
localStoragePath);
+ }
+ }
Review Comment:
can this move to aa separate method?
--
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]