Addition of description field for NIC's secondary IP addresses#12864
Addition of description field for NIC's secondary IP addresses#12864erikbocks wants to merge 2 commits intoapache:mainfrom
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #12864 +/- ##
============================================
- Coverage 18.02% 18.02% -0.01%
+ Complexity 16450 16449 -1
============================================
Files 5968 5968
Lines 537086 537105 +19
Branches 65961 65961
============================================
- Hits 96819 96796 -23
- Misses 429347 429389 +42
Partials 10920 10920
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR enhances NIC secondary IP handling by adding a free-text description field to secondary IP allocations, persisting it in the DB, exposing it via API responses, and surfacing it in the UI so users can understand why secondary IPs were allocated.
Changes:
- Add a
descriptioncolumn tonic_secondary_ipsand plumb it throughNicSecondaryIp/NicSecondaryIpVOand allocation flow. - Extend
addIpToNicAPI to acceptdescriptionand include it inNicSecondaryIpResponse/NIC listing responses. - Update UI to capture and display secondary IP descriptions.
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| ui/src/views/network/NicsTable.vue | Displays secondary IPs with appended descriptions in NIC details. |
| ui/src/views/network/NicsTab.vue | Adds a description input to the secondary IP allocation modal and submits it to addIpToNic. |
| ui/public/locales/en.json | Adds i18n strings for the new description UI labels/placeholders. |
| ui/public/locales/pt_BR.json | Adds i18n strings for the new description UI labels/placeholders. |
| api/src/main/java/org/apache/cloudstack/api/command/user/vm/AddIpToVmNicCmd.java | Adds description request parameter and passes it into secondary IP allocation. |
| api/src/main/java/org/apache/cloudstack/api/response/NicSecondaryIpResponse.java | Adds description field to the secondary IP response model. |
| api/src/main/java/com/cloud/network/NetworkService.java | Extends allocateSecondaryGuestIP signature to include description. |
| api/src/main/java/com/cloud/vm/NicSecondaryIp.java | Adds getDescription() to the secondary IP interface. |
| api/src/test/java/org/apache/cloudstack/api/command/test/AddIpToVmNicTest.java | Updates mocks for the changed allocation signature. |
| server/src/main/java/com/cloud/network/NetworkServiceImpl.java | Persists description when allocating a secondary IP. |
| server/src/main/java/com/cloud/api/ApiResponseHelper.java | Includes secondary IP description in NIC and secondary-IP responses. |
| server/src/main/java/com/cloud/api/query/dao/UserVmJoinDaoImpl.java | Includes secondary IP description in VM NIC secondary IP response population. |
| server/src/main/java/com/cloud/network/rules/RulesManagerImpl.java | (Unrelated hunk) variable type change introduced in static NAT enable flow. |
| server/src/test/java/com/cloud/vpc/MockNetworkManagerImpl.java | Updates mock implementation signature for allocateSecondaryGuestIP. |
| engine/schema/src/main/java/com/cloud/vm/dao/NicSecondaryIpVO.java | Adds description field + getter/setter and constructor wiring. |
| engine/schema/src/main/resources/META-INF/db/schema-42210to42300.sql | Adds DB migration to add description column to nic_secondary_ips. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Description
In order to help users to identify more easily the reason that their NIC's secondary IP address were allocated to the VM, a description field was added to the secondary IPs. Now, during secondary IP address allocation, it is possible to inform a descriptive text, that will be displayed along with the IP address in the NIC details or in the API's responses.
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Screenshots (if appropriate):
Figure 1 - Form description field
Figure 2 - IP's description present at NIC details
How Has This Been Tested?
In an environment where the PR changes were installed, I opened the secondary IP addition tab and validated that the description field was added successfully to the form (Figure 1 in the
Screenshotstab). Via CMK, I validated that the description field was also added to theaddIpToNicAPI.Then, I added a secondary IP address to my VM with an example text in it (Figure 2). After that, I made some tests to features involving secondary IPs, as the addresses management and configuration, as well as a communication test with static NAT assigned to the secondary IP.
With CloudMonkey, I also validated that the description field was now returned in NICs' responses in the
listNicsAPI.