dheeraj12347 opened a new pull request, #14694: URL: https://github.com/apache/cloudstack/pull/14694
### Description This PR fixes a storage pool reference-count leak in `createStoragePoolLocked()`. When the reference count is incremented for a secondary storage pool, subsequent failures in `checkNetfsStoragePoolMounted()` or `getStoragePool()` can leave the reference count incremented because the existing exception handling only catches `LibvirtException`. ### Solution - Track whether the storage pool reference count was successfully incremented. - Track whether the operation completed successfully. - Use a `finally` block to decrement the reference count if the operation fails after the increment. - Preserve existing `LibvirtException` handling. ### Types of changes - [x] Bug fix (non-breaking change which fixes an issue) ### Bug Severity - [x] Minor ### How Has This Been Tested? Added `testCreateStoragePoolDecrementsRefCountWhenGetStoragePoolFails()` to verify that the reference count is decremented when `getStoragePool()` throws a `CloudRuntimeException`. - `git diff --check`: Passed. - Maven tests: Not rerun after the final changes. Related: #14189 -- 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]
