Skip to content

api: fix ProjectResponse.setVpcLimit assigning the network limit - #14022

Open
nagaboinaramgopal wants to merge 1 commit into
apache:mainfrom
nagaboinaramgopal:fix/projectresponse-vpclimit
Open

api: fix ProjectResponse.setVpcLimit assigning the network limit#14022
nagaboinaramgopal wants to merge 1 commit into
apache:mainfrom
nagaboinaramgopal:fix/projectresponse-vpclimit

Conversation

@nagaboinaramgopal

Copy link
Copy Markdown

Description

ProjectResponse.setVpcLimit(String vpcLimit) ignored its argument and assigned
the networkLimit field instead:

public void setVpcLimit(String vpcLimit) {
    this.vpcLimit = networkLimit;   // should be vpcLimit
}

Actual behaviour: listProjects reports a project's vpclimit equal to its
networklimit (and null if setVpcLimit runs before setNetworkLimit).
Expected behaviour: vpclimit reflects the project's real VPC limit,
independent of the network limit.

Every sibling setter in the class assigns its own parameter; this one was a
copy-paste slip. Fix: assign the vpcLimit 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

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

How Has This Been Tested?

  • Added a unit test (ProjectResponseTest) asserting setVpcLimit stores its own
    value and leaves networkLimit untouched.
  • Built standard .deb packages and deployed a KVM advanced zone; confirmed
    listProjects returns the correct, independent vpclimit.

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

Set different network and VPC limits on a project and verified via listProjects
that vpclimit reflects the VPC limit — including when the VPC limit is set
before the network limit.

setVpcLimit ignored its parameter and copied the networkLimit field into
vpcLimit (this.vpcLimit = networkLimit), so a projects reported vpclimit
always mirrored its networklimit instead of the real VPC limit (and would be
null if setVpcLimit ran before setNetworkLimit). The sibling setters all
assign their own parameter.

Assign the vpcLimit parameter.

Adds a regression test asserting setVpcLimit stores its own value and leaves
networkLimit untouched.
@boring-cyborg

boring-cyborg Bot commented Sep 1, 2026

Copy link
Copy Markdown

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:

@DaanHoogland DaanHoogland left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

clgtm

@codecov

codecov Bot commented Sep 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 19.73%. Comparing base (77fbb0f) to head (f00e6b0).

Additional details and impacted files
@@            Coverage Diff            @@
##               main   #14022   +/-   ##
=========================================
  Coverage     19.73%   19.73%           
- Complexity    19955    19959    +4     
=========================================
  Files          6371     6371           
  Lines        575784   575784           
  Branches      70478    70478           
=========================================
+ Hits         113632   113657   +25     
+ Misses       449805   449774   -31     
- Partials      12347    12353    +6     
Flag Coverage Δ
uitests 3.41% <ø> (ø)
unittests 21.01% <100.00%> (+<0.01%) ⬆️

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

☔ View full report in Codecov by Harness.
📢 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.

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

Projects

Status: Ready

Development

Successfully merging this pull request may close these issues.

3 participants