jmsperu opened a new issue, #14814: URL: https://github.com/apache/cloudstack/issues/14814
### Problem When several tiers of one VPC are implemented at the same time, each one plugs a NIC into the same VPC router. NetworkOrchestrator.createNicForVm reads the next free device ID (NicDao.getFreeDeviceId) and then allocates the NIC, with no lock in between, so parallel calls read the same free ID. Result: the router has several NICs with the same device ID in the nics table, the PlugNicCommands carry the same deviceId, and the router configures only some of the tier gateways. Every network shows Implemented and every instance Running, but instances in the affected tiers have no gateway, no DHCP and no DNS. ### Versions 4.22.1.1 (KVM, Ubuntu 24.04). The code is the same on main. ### Steps to reproduce 1. Create a VPC. 2. Create 6 tiers in parallel (6 createNetwork calls at once) and deploy one instance in each tier as soon as the tier exists. 3. Look at the router: `select device_id, count(*) from nics where instance_id=<router> and removed is null group by device_id`, and `ip -4 -br a` in the router. Lab numbers (CloudStack 4.22.1.1, 2 KVM hosts, one VPC with 6 tiers created and started in parallel, original management server, Agents carrying PR #14640): 4 of 6 runs ended with duplicate device IDs on the VPC router. | Run | Router NIC device IDs | Duplicates | Tier gateways up / commands left unprocessed | |---|---|---|---| | 1 | 0,1,2,3,4,5,6,7 | 0 | 6 / 0 | | 2 | 0,1,2,2,3,3,4,5 | 2 | 4 / 2 | | 3 | 0,1,2,2,3,3,4,5 | 2 | 4 / 2 | | 4 | 0,1,2,2,3,4,5,6 | 1 | 5 / 1 | | 5 | 0,1,2,3,4,5,6,7 | 0 | 6 / 0 | | 6 | 0,1,2,2,3,4,5,5 | 2 | 4 / 2 | Every duplicate device ID matches one tier whose gateway never came up on the router. -- 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]
