Skip to content

Addition of description field for NIC's secondary IP addresses#12864

Open
erikbocks wants to merge 2 commits intoapache:mainfrom
scclouds:add-description-for-secondary-ip-addresses
Open

Addition of description field for NIC's secondary IP addresses#12864
erikbocks wants to merge 2 commits intoapache:mainfrom
scclouds:add-description-for-secondary-ip-addresses

Conversation

@erikbocks
Copy link
Collaborator

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

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)
  • Build/CI
  • Test (unit or integration test code)

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • Major
  • Minor

Screenshots (if appropriate):

Figure 1 - Form description field image
Figure 2 - IP's description present at NIC details image

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 Screenshots tab). Via CMK, I validated that the description field was also added to the addIpToNicAPI.

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 listNics API.

@codecov
Copy link

codecov bot commented Mar 19, 2026

Codecov Report

❌ Patch coverage is 0% with 20 lines in your changes missing coverage. Please review.
✅ Project coverage is 18.02%. Comparing base (b744824) to head (02a1d07).

Files with missing lines Patch % Lines
...c/main/java/com/cloud/vm/dao/NicSecondaryIpVO.java 0.00% 8 Missing ⚠️
...loudstack/api/response/NicSecondaryIpResponse.java 0.00% 6 Missing ⚠️
...src/main/java/com/cloud/api/ApiResponseHelper.java 0.00% 2 Missing ⚠️
...ain/java/com/cloud/network/NetworkServiceImpl.java 0.00% 2 Missing ⚠️
...loudstack/api/command/user/vm/AddIpToVmNicCmd.java 0.00% 1 Missing ⚠️
...ava/com/cloud/api/query/dao/UserVmJoinDaoImpl.java 0.00% 1 Missing ⚠️
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              
Flag Coverage Δ
uitests 3.53% <ø> (-0.01%) ⬇️
unittests 19.18% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 description column to nic_secondary_ips and plumb it through NicSecondaryIp/NicSecondaryIpVO and allocation flow.
  • Extend addIpToNic API to accept description and include it in NicSecondaryIpResponse/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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants