jdhirst commented on issue #11104:
URL: https://github.com/apache/cloudstack/issues/11104#issuecomment-3036009385

   @kiranchavala I was able to reproduce this issue on a fresh installation 
using a single RHEL 8 VM following the [quick installation 
guide](https://docs.cloudstack.apache.org/en/latest/quickinstallationguide/qig.html)
   
   Everything was working fine until the agent service restarted and then the 
local pool vanished with the same behaviour I was seeing before.
   
   This is the repo I used: 
   ```
   [cloudstack]
   name=cloudstack
   baseurl=https://download.cloudstack.org/testing/nightly/2025-07-02/el8/4.21/
   enabled=1
   gpgcheck=0
   ```
   
   Logs:
   
   agent:
   
[agent.err.log](https://github.com/user-attachments/files/21053648/agent.err.log)
   [agent.log](https://github.com/user-attachments/files/21053643/agent.log)
   
[security_group.log](https://github.com/user-attachments/files/21053650/security_group.log)
   [setup.log](https://github.com/user-attachments/files/21053651/setup.log)
   
[agent.out.log](https://github.com/user-attachments/files/21053654/agent.out.log)
   
   management:
   [access.log](https://github.com/user-attachments/files/21053671/access.log)
   [apilog.log](https://github.com/user-attachments/files/21053680/apilog.log)
   
[management-server.err.log](https://github.com/user-attachments/files/21053703/management-server.err.log)
   
[management-server.out.log](https://github.com/user-attachments/files/21053686/management-server.out.log)
   
[management-server.log](https://github.com/user-attachments/files/21053683/management-server.log)
   
   ## debugging
   
   I connected a remote debugger and started to poke through the code and found 
that this method is being called: 
   
![Image](https://github.com/user-attachments/assets/b1cfeb6f-16c1-495a-b163-ce7aca2b97ac)
   
![Image](https://github.com/user-attachments/assets/50e34fe8-48da-4229-8bf2-7bb499f1741a)
   
   I upgraded to the latest build since I saw that there were some 
storage-related changes that came in from 4.20, however this didn't change 
anything.
   
   I then proceeded to downgrade the management server to the latest build on 
the 4.20 branch (and nuked the db / re-created the zone) and ran the debugger 
again. 
   
   I was then not able to reproduce the issue, and the storage pool would 
always return even if I destroyed it from libvirt. 
   
   ## possible root cause
   
   I believe that the root cause of this issue is the change that was made to 
StoragePoolMonitor.java as part of b17808bfba1d914b17d25ef82c0f372b295465c5
   
   
https://github.com/apache/cloudstack/blob/b17808bfba1d914b17d25ef82c0f372b295465c5/server/src/main/java/com/cloud/storage/listener/StoragePoolMonitor.java#L159
   
   This check for previously connected pools fails to take local pools into 
account and therefore always targets them for destruction:
   ```
               List<StoragePoolHostVO> previouslyConnectedPools = new 
ArrayList<>();
               
previouslyConnectedPools.addAll(_storageManager.findStoragePoolsConnectedToHost(host.getId()));
   ```
   
   Local pools are not available in the `pools` list as they are not returned 
in the pool list queries further up in the file so therefore they don't get 
removed from this previously connected pools list, and thus get destroyed.
   
   This can be seen here:
   
![Image](https://github.com/user-attachments/assets/40109135-1bbd-4441-8e35-4ca292db461c)


-- 
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: commits-unsubscr...@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to