cloudstack icon indicating copy to clipboard operation
cloudstack copied to clipboard

Fix NSX SDK list handling to fetch all paginated results

Open wolfchkov opened this issue 2 weeks ago • 6 comments

Fix for NSX plugin.

Description

NSX SDK list operations are pageable: the API returns a non-null and non-empty cursor field when more pages are available. The previous implementation only fetched the first page and ignored pagination.

This change updates the list retrieval flow to:

  • follow the cursor chain until no further pages exist
  • accumulate items from all pages
  • return a single merged result to the caller

This ensures that list operations return the complete dataset rather than just the first page.

Types of changes

  • [ ] Breaking change (fix or feature that would cause existing functionality to change)
  • [ ] New feature (non-breaking change which adds functionality)
  • [ x] 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
  • [x ] Test (unit or integration test code)

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • [ ] Major
  • [ x] Minor

Bug Severity

  • [ ] BLOCKER
  • [ x] Critical
  • [ ] Major
  • [ ] Minor
  • [ ] Trivial

Screenshots (if appropriate):

How Has This Been Tested?

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

wolfchkov avatar Dec 11 '25 11:12 wolfchkov

Congratulations on your first Pull Request and welcome to the Apache CloudStack community! If you have any issues or are unsure about any anything please check our Contribution Guide (https://github.com/apache/cloudstack/blob/main/CONTRIBUTING.md) Here are some useful points:

  • In case of a new feature add useful documentation (raise doc PR at https://github.com/apache/cloudstack-documentation)
  • Be patient and persistent. It might take some time to get a review or get the final approval from the committers.
  • Pay attention to the quality of your code, ensure tests are passing and your PR doesn't have conflicts.
  • Please follow ASF Code of Conduct for all communication including (but not limited to) comments on Pull Requests, Issues, Mailing list and Slack.
  • Be sure to read the CloudStack Coding Conventions. Apache CloudStack is a community-driven project and together we are making it better 🚀. In case of doubts contact the developers at: Mailing List: [email protected] (https://cloudstack.apache.org/mailing-lists.html) Slack: https://apachecloudstack.slack.com/

boring-cyborg[bot] avatar Dec 11 '25 11:12 boring-cyborg[bot]

Codecov Report

:x: Patch coverage is 25.85034% with 109 lines in your changes missing coverage. Please review. :white_check_mark: Project coverage is 17.46%. Comparing base (3c64847) to head (070b956). :warning: Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...va/org/apache/cloudstack/service/NsxApiClient.java 0.00% 106 Missing :warning:
...va/org/apache/cloudstack/service/PagedFetcher.java 92.68% 0 Missing and 3 partials :warning:
Additional details and impacted files
@@             Coverage Diff              @@
##              main   #12241       +/-   ##
============================================
+ Coverage     3.58%   17.46%   +13.88%     
- Complexity       0    15525    +15525     
============================================
  Files          445     5914     +5469     
  Lines        37552   529493   +491941     
  Branches      6914    64685    +57771     
============================================
+ Hits          1347    92488    +91141     
- Misses       36039   426584   +390545     
- Partials       166    10421    +10255     
Flag Coverage Δ
uitests 3.58% <ø> (ø)
unittests 18.52% <25.85%> (?)

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

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

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

codecov[bot] avatar Dec 11 '25 13:12 codecov[bot]

@blueorangutan package

Pearl1594 avatar Dec 11 '25 14:12 Pearl1594

@Pearl1594 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 avatar Dec 11 '25 14:12 blueorangutan

This fix is currently undergoing testing. When the test results are ready, I will update the description accordingly.

wolfchkov avatar Dec 11 '25 14:12 wolfchkov

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

blueorangutan avatar Dec 11 '25 15:12 blueorangutan