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

   ## Summary
   
   Persists the effective network rate (bandwidth throttling) for both NICs and 
Guest Networks in their respective detail tables, and exposes the values 
through the API and UI.
   
   ### What changed
   
   **Persistence — NIC (`nic_details`)**
   - On VM deploy: `allocateNetworksForVm()` calls `refreshNicNetworkRates()` 
after NICs are created in the DB
   - On NIC hot-plug: `addNicToVm()` persists the rate immediately after 
allocation
   - On VM start (`StartVMCmd`): `refreshNicNetworkRates()` refreshes all NIC 
rates so stale values are corrected when the network offering changes between 
stop/start cycles
   - On NIC/VM removal: `NetworkOrchestrator.removeNic()` and `removeNics()` 
clean up `nic_details` co-located with the `_nicDao.remove()` call, respecting 
the `preserveNics` guard
   
   **Persistence — Guest Network (`network_details`)**
   - On network create: `NetworkOrchestrator.setupNetwork()` calls 
`saveNetworkRateInDetails()` after the network record is committed
   - On network offering update: `NetworkServiceImpl.updateGuestNetwork()` 
upserts the rate inside the offering-change transaction
   
   **API**
   - `NicResponse`: new `networkrate` field (`since = "4.24.0"`) populated from 
`nic_details`
   - `NetworkResponse`: new `networkrate` field (`since = "4.21.0"`) populated 
from `network_details`
   - `ApiResponseHelper`: reads rate detail for both NIC and Network responses
   
   **UI**
   - Guest Network detail page: `networkrate` added to the fields array in 
`network.js`
   - VM NIC expanded row (`NicsTable.vue`): `networkrate` shown under the 
Admin/DomainAdmin guard alongside `broadcasturi` and `isolationuri`
   
   ### Design notes
   
   - Rate is stored as a string: a positive integer (Mb/s) or `"unlimited"` 
when the offering has no limit
   - `NicVO` and `NetworkVO` use soft-delete (`removed = NOW()`), so `ON DELETE 
CASCADE` on the FK never fires — cleanup is explicit
   - `refreshNicNetworkRates()` uses `NetworkModelImpl.getNetworkRate()` which 
resolves the current offering dynamically, matching what the hypervisor 
enforces when rebuilding domain XML
   
   ## Test plan
   
   - [ ] Deploy a VM on a network with throttling configured — verify 
`nic_details` has the rate
   - [ ] Hot-plug a NIC — verify `nic_details` entry created
   - [ ] Update the network offering on an existing network, stop/start the VM 
— verify `nic_details` reflects the new rate
   - [ ] Destroy a VM — verify `nic_details` rows are removed
   - [ ] `listNics` response includes `networkrate`
   - [ ] `listNetworks` response includes `networkrate`
   - [ ] Guest Network detail page shows Network Rate field
   - [ ] VM details NIC expanded row shows Network Rate (Admin/DomainAdmin only)


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