Skip to content

Conversation

@shwstppr
Copy link
Contributor

@shwstppr shwstppr commented Sep 6, 2025

Description

Currently, acquire or associate IP action in the UI will load only 500 addresses (or whatever defined by config default.page.size). Also, it will load all 500 of them together. This PR uses InfiniteScrollSelect to iteratively load more addresses. To facilitate retrieving both Free and Reserved addresses api and server change has been made for the listPublicIpAddresses API to pass a comma-separated list of states for state parameter.

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

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

image

How Has This Been Tested?

How did you try to break this feature and the system with this change?

@codecov
Copy link

codecov bot commented Sep 6, 2025

Codecov Report

❌ Patch coverage is 64.28571% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 17.56%. Comparing base (e90e31d) to head (136b6ac).
⚠️ Report is 3 commits behind head on 4.22.

Files with missing lines Patch % Lines
...in/java/com/cloud/server/ManagementServerImpl.java 62.96% 10 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##               4.22   #11591   +/-   ##
=========================================
  Coverage     17.56%   17.56%           
- Complexity    15538    15544    +6     
=========================================
  Files          5909     5909           
  Lines        529099   529106    +7     
  Branches      64623    64625    +2     
=========================================
+ Hits          92913    92926   +13     
+ Misses       425732   425726    -6     
  Partials      10454    10454           
Flag Coverage Δ
uitests 3.58% <ø> (+<0.01%) ⬆️
unittests 18.63% <64.28%> (+<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.

@shwstppr
Copy link
Contributor Author

shwstppr commented Sep 6, 2025

@blueorangutan package

@blueorangutan
Copy link

@shwstppr a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@blueorangutan
Copy link

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 14878

@DaanHoogland
Copy link
Contributor

@blueorangutan test keepEnv

@blueorangutan
Copy link

@DaanHoogland a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests

@shwstppr shwstppr requested a review from Copilot September 10, 2025 09:10
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 pull request enhances the public IP address listing functionality in CloudStack by enabling iterative loading through infinite scroll and supporting multiple states. The primary improvement is in the UI's IP acquisition/association interface, which previously loaded only 500 addresses synchronously.

Key changes include:

  • Modified listPublicIpAddresses API to accept comma-separated states parameter
  • Replaced static select component with infinite scroll select in UI
  • Updated server-side filtering to handle multiple states
  • Enhanced test coverage for new multi-state functionality

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
ui/src/views/network/IpAddressesTab.vue Replaces static select with InfiniteScrollSelect component and removes manual IP loading logic
ui/src/components/widgets/InfiniteScrollSelect.vue Adds support for custom label functions and auto-selection of first option
server/src/main/java/com/cloud/server/ManagementServerImpl.java Implements comma-separated state parameter parsing and multi-state filtering
api/src/main/java/org/apache/cloudstack/api/command/user/address/ListPublicIpAddressesCmd.java Updates API documentation to reflect comma-separated state support
server/src/test/java/com/cloud/server/ManagementServerImplTest.java Updates test methods to accommodate new multi-state parameter structure

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link
Contributor

@harikrishna-patnala harikrishna-patnala left a comment

Choose a reason for hiding this comment

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

code LGTM

@harikrishna-patnala
Copy link
Contributor

@blueorangutan package

@blueorangutan
Copy link

@harikrishna-patnala a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@blueorangutan
Copy link

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 14949

DaanHoogland
DaanHoogland previously approved these changes Sep 15, 2025
Copy link
Contributor

@DaanHoogland DaanHoogland left a comment

Choose a reason for hiding this comment

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

code looks good, just one remark, no blocker

@github-actions
Copy link

github-actions bot commented Oct 7, 2025

This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch.

@shwstppr
Copy link
Contributor Author

shwstppr commented Oct 7, 2025

@blueorangutan package

@blueorangutan
Copy link

@shwstppr a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@blueorangutan
Copy link

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 15327

@harikrishna-patnala harikrishna-patnala self-requested a review October 8, 2025 07:48
},
listApiParamsForAssociate () {
const params = this.listApiParams
params.state = 'Free,Reserved'
Copy link
Contributor

@harikrishna-patnala harikrishna-patnala Oct 8, 2025

Choose a reason for hiding this comment

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

@shwstppr I tested the changes, it is not listing any IPs now

Image

Seems to be problem with these params

http://10.0.32.194:8080/client/api/?page=1&pagesize=20&zoneid=eb21bc9a-4c08-4456-938b-af605ef36aae&domainid=d3a3e350-a40d-11f0-b82c-1e009c000155&account=admin&forvirtualnetwork=true&allocatedonly=false& state=Free,Reserved &showicon=true&command=listPublicIpAddresses&response=json&sessionkey=fSa-6YW14skm_KeFEJvTnLPpQQs

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for checking @harikrishna-patnala. Will check and fix. Moving to draft for now

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@harikrishna-patnala changes should work now

@harikrishna-patnala harikrishna-patnala self-requested a review October 8, 2025 07:54
@shwstppr shwstppr marked this pull request as draft October 9, 2025 12:22
@shwstppr shwstppr changed the base branch from main to 4.22 November 13, 2025 12:31
@shwstppr
Copy link
Contributor Author

@blueorangutan package

@blueorangutan
Copy link

@shwstppr a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@blueorangutan
Copy link

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 15751

@DaanHoogland DaanHoogland dismissed their stale review November 13, 2025 15:08

remark ignored

import org.apache.commons.codec.binary.Base64;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang3.EnumUtils;
Copy link
Contributor

Choose a reason for hiding this comment

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

please let com.cloud.utils.EnumUtils inherit org.apache.commons.lang3.EnumUtils and import that one, to keep related utilities in one place and serve as a proxy in case dependencies need updating/replacing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Signed-off-by: Abhishek Kumar <[email protected]>
@apache apache deleted a comment from blueorangutan Nov 13, 2025
@apache apache deleted a comment from blueorangutan Nov 13, 2025
@shwstppr
Copy link
Contributor Author

@blueorangutan package

@blueorangutan
Copy link

@shwstppr a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

Copy link
Contributor

@DaanHoogland DaanHoogland left a comment

Choose a reason for hiding this comment

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

this is what I meant. in this case it makes it very simple.

@blueorangutan
Copy link

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 15760

Signed-off-by: Abhishek Kumar <[email protected]>
@DaanHoogland
Copy link
Contributor

@blueorangutan package

@blueorangutan
Copy link

@DaanHoogland a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@blueorangutan
Copy link

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 15769

Copy link
Contributor

@DaanHoogland DaanHoogland left a comment

Choose a reason for hiding this comment

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

clgtm, some nitpicking applied

Boolean isAllocated = cmd.isAllocatedOnly();
if (isAllocated == null) {
if (state != null && (state.equalsIgnoreCase(IpAddress.State.Free.name()) || state.equalsIgnoreCase(IpAddress.State.Reserved.name()))) {
if (states.contains(IpAddress.State.Free) || states.contains(IpAddress.State.Reserved)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

we cannot have a null here, so no biggy but maybe reverse the checks and even use Arrays?

}
} else {
if (state != null && (state.equalsIgnoreCase(IpAddress.State.Free.name()) || state.equalsIgnoreCase(IpAddress.State.Reserved.name()))) {
if (states.contains(IpAddress.State.Free) || states.contains(IpAddress.State.Reserved)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

same here

throw new InvalidParameterValueException("Conflict: allocatedonly is true but state is Free");
}
} else if (state != null && state.equalsIgnoreCase(IpAddress.State.Allocated.name())) {
} else if (states.contains(IpAddress.State.Allocated)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

and here

isAllocatedOrReserved = true;
}
boolean isAllocatedOrReserved = isAllocated ||
(states.size() == 1 && IpAddress.State.Reserved.equals(states.get(0)));
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
(states.size() == 1 && IpAddress.State.Reserved.equals(states.get(0)));
(states.size() == 1 && states.contains(IpAddress.State.Reserved));

@DaanHoogland
Copy link
Contributor

@blueorangutan test keepEnv

@blueorangutan
Copy link

@DaanHoogland a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests

@blueorangutan
Copy link

[SF] Trillian test result (tid-14835)
Environment: kvm-ol8 (x2), zone: Advanced Networking with Mgmt server ol8
Total time taken: 50242 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr11591-t14835-kvm-ol8.zip
Smoke tests completed. 148 look OK, 1 have errors, 0 did not run
Only failed and skipped tests results shown below:

Test Result Time (s) Test File
test_1_userdata_on_ssvm Error 3.27 test_systemvm_userdata.py

@DaanHoogland
Copy link
Contributor

tested in lab env by defining a 1021 long network range. acquire dialog nicely scrolls through them without preloading.

@blueorangutan
Copy link

[SF] Trillian test result (tid-14863)
Environment: kvm-ol8 (x2), zone: Advanced Networking with Mgmt server ol8
Total time taken: 46359 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr11591-t14863-kvm-ol8.zip
Smoke tests completed. 149 look OK, 0 have errors, 0 did not run
Only failed and skipped tests results shown below:

Test Result Time (s) Test File

@DaanHoogland DaanHoogland merged commit 9ec8cc4 into apache:4.22 Nov 26, 2025
26 checks passed
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.

5 participants