Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

server: consistent behaviour for list apis with project=-1 #11767

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
DaanHoogland merged 2 commits into apache:main from shapeblue:fix-listapi-project-consistency
Oct 14, 2025

Conversation

@shwstppr
Copy link
Contributor

@shwstppr shwstppr commented Oct 1, 2025
edited
Loading

Description

Fixes #9602
Fixes #11517

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

How Has This Been Tested?

Created 3 new accounts:

  • user - Normal User in ROOT domain
  • dadmin - Domain Admin in ROOT domain
  • d1admin - Domain Admin in ROOT/d1 domain

Create a new Project test-proj using root admin account and added user and dadmin into it. Create a test network for the project.

Created networks using each of the four accounts - admin, dadmin, user, d1admin
There are now 5 networks:

  • admin-net
  • dadmin-net
  • user-net
  • d1admin-net
  • testproj-net

Verified when project toggle is changed:

  • admin can list all 5 networks
  • dadmin can list all 5 networks
  • user can list 2 networks (user-net, testproj-net)
  • d1admin can list only one network (d1admin-net)
image

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

weizhouapache and bernardodemarco reacted with thumbs up emoji
Fixes apache#9602
Fixes apache#11517
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
Copy link

codecov bot commented Oct 1, 2025
edited
Loading

Codecov Report

❌ Patch coverage is 40.00000% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 17.56%. Comparing base (2c1aad4) to head (a8eec6c).
⚠️ Report is 59 commits behind head on main.

Files with missing lines Patch % Lines
...ain/java/com/cloud/network/NetworkServiceImpl.java 40.00% 6 Missing ⚠️
Additional details and impacted files
@@ Coverage Diff @@
## main #11767 +/- ##
============================================
+ Coverage 17.50% 17.56% +0.05% 
- Complexity 15427 15521 +94 
============================================
 Files 5894 5906 +12 
 Lines 526845 528382 +1537 
 Branches 64334 64529 +195 
============================================
+ Hits 92232 92791 +559 
- Misses 424236 425160 +924 
- Partials 10377 10431 +54 
Flag Coverage Δ
uitests 3.59% <ø> (-0.03%) ⬇️
unittests 18.62% <40.00%> (+0.06%) ⬆️

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 fixes consistent behavior for list APIs when project parameter is set to -1, ensuring that all networks (including project networks) are included in the search results when project=-1 is specified.

Key changes:

  • Modified the addProjectNetworksConditionToSearch method to handle the special case of projectId=-1
  • Updated all callers to pass the projectId parameter consistently
  • Added comprehensive test coverage for the new functionality

Reviewed Changes

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

File Description
NetworkServiceImpl.java Enhanced project network filtering logic to handle project=-1 case and updated method signatures
NetworkServiceImplTest.java Added unit tests to verify the new project network filtering behavior

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

Copy link
Member

@shwstppr, thanks for the PR! I believe after this one gets merged, we'll be able to move forward with the apache/cloudstack-cloudmonkey#185 PR.

Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
Copy link
Contributor Author

@blueorangutan package

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 Author

Tested some of the APIs:

  • listVirtualMachines
  • listNetworks
  • listSshKeypairs
  • listUserdata

Only listNetworks was having different behaviour so fixed that. Testing results around that are added in the description.
Narking this ready for review

@shwstppr shwstppr marked this pull request as ready for review October 13, 2025 08:09
Copy link
Member

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

Copy link

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

Copy link
Contributor

@blueorangutan test keepEnv

Copy link

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

Copy link

[SF] Trillian test result (tid-14646)
Environment: kvm-ol8 (x2), zone: Advanced Networking with Mgmt server ol8
Total time taken: 57386 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr11767-t14646-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

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, tested with the use-cases from #9602 and #11517

@DaanHoogland DaanHoogland merged commit dfcbd2e into apache:main Oct 14, 2025
27 of 28 checks passed
@DaanHoogland DaanHoogland deleted the fix-listapi-project-consistency branch October 14, 2025 07:06
@DaanHoogland DaanHoogland added this to the 4.22.0 milestone Oct 14, 2025
dhslove pushed a commit to ablecloud-team/ablestack-cloud that referenced this pull request Oct 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

Copilot code review Copilot Copilot left review comments

@DaanHoogland DaanHoogland DaanHoogland approved these changes

@weizhouapache weizhouapache weizhouapache approved these changes

Assignees

No one assigned

Projects

None yet

Milestone

4.22.0

Development

Successfully merging this pull request may close these issues.

Inconsistent behaviour in handling projectid param for different list APIs Enabling the Project toggle doesn't list the admin created networks

AltStyle によって変換されたページ (->オリジナル) /