jmsperu opened a new pull request, #14815: URL: https://github.com/apache/cloudstack/pull/14815
### Description NetworkOrchestrator.createNicForVm picked the free device ID of the instance and allocated the NIC without any lock. Networks added to the same instance at the same time (for example VPC tiers implemented in parallel, all plugged into the same VPC router) could all read the same free device ID, and the instance ended with several NICs on one device ID. On a VPC router this leaves tiers without a gateway while everything is reported as Implemented and Running. This PR takes a lock per instance around the device ID pick and the NIC allocation. Nothing else changes. Fixes #14814. Found while testing #14640, which fixes the Agent side of the same scenario; both are needed for parallel tier creation to be reliable. ### Types of changes - [x] Bug fix (non-breaking change which fixes an issue) ### Feature/Enhancement Scale or Bug Severity #### Bug Severity - [x] Major ### How Has This Been Tested? Lab test (CloudStack 4.22.1.1, 2 KVM hosts, one VPC with 6 tiers created and started in parallel, each run on a fresh VPC): | Phase | Management server | Agents | Runs | Runs with duplicate device IDs | Runs with all 6 gateways up | |---|---|---|---|---|---| | A | original | with PR #14640 | 6 | 4 | 2 | | B | this PR | with PR #14640 | 8 | 0 | 8 | | C | this PR | original | 3 | 0 | 0 | Phase C shows the two changes are separate: with this PR alone the device IDs are always unique, but the original Agent still fails (3 to 4 NullPointerExceptions per run, 2, 5 and 3 gateways up), which is what PR #14640 fixes. Both are needed for a clean result. After the test the lab was put back on the original builds. https://claude.ai/code/session_01CUwgtFEPLkr62vbUayjCDZ -- 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]
