andrijapanicsb opened a new pull request, #13125:
URL: https://github.com/apache/cloudstack/pull/13125

   ### Description
   
   During VM migration and host maintenance flows, 
`UserVmManagerImpl.isAnyVmVolumeUsingLocalStorage` checks VM volumes to decide 
whether the VM uses local storage. If a stale destroyed volume row still 
references a storage pool that has since been removed, the method can 
dereference a null `StoragePoolVO` and fail with an NPE.
   
   This change skips non-active volume rows while evaluating local-storage 
usage:
   
   - null volume entries
   - volumes with `removed` set
   - volumes in `Destroy` state
   - volumes in `Expunged` state
   
   For active volumes, the method now fails with a clear 
`CloudRuntimeException` if the referenced storage pool is missing or removed 
instead of throwing a null-pointer exception. This keeps stale destroyed 
metadata from blocking unrelated VM/host operations while still surfacing real 
active-volume inconsistency.
   
   Fixes #13124
   
   ### Tests
   
   Added unit coverage in `UserVmManagerImplTest` for:
   
   - skipping destroyed volumes with missing pools
   - skipping removed volumes
   - failing clearly for active volumes with missing pools
   - failing clearly for active volumes with removed pools
   
   Not run locally: this workstation does not have Java or Maven installed 
(`java`, `javac`, and `mvn` are not available).
   


-- 
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]

Reply via email to