This is an automated email from the ASF dual-hosted git repository.
shwstppr pushed a commit to branch 4.20
in repository https://gitbox.apache.org/repos/asf/cloudstack.git
The following commit(s) were added to refs/heads/4.20 by this push:
new c2c74c56e8f api: fix ProjectResponse.setVpcLimit assigning the network
limit (#14022)
c2c74c56e8f is described below
commit c2c74c56e8f803305d71ccc611fe463eb2143836
Author: Ramgopal Nagaboina <[email protected]>
AuthorDate: Mon Sep 7 05:51:07 2026 -0400
api: fix ProjectResponse.setVpcLimit assigning the network limit (#14022)
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.
---
.../cloudstack/api/response/ProjectResponse.java | 2 +-
.../api/response/ProjectResponseTest.java | 34 ++++++++++++++++++++++
2 files changed, 35 insertions(+), 1 deletion(-)
diff --git
a/api/src/main/java/org/apache/cloudstack/api/response/ProjectResponse.java
b/api/src/main/java/org/apache/cloudstack/api/response/ProjectResponse.java
index ee40e9d3918..347a1fe99d1 100644
--- a/api/src/main/java/org/apache/cloudstack/api/response/ProjectResponse.java
+++ b/api/src/main/java/org/apache/cloudstack/api/response/ProjectResponse.java
@@ -362,7 +362,7 @@ public class ProjectResponse extends BaseResponse
implements ResourceLimitAndCou
@Override
public void setVpcLimit(String vpcLimit) {
- this.vpcLimit = networkLimit;
+ this.vpcLimit = vpcLimit;
}
@Override
diff --git
a/api/src/test/java/org/apache/cloudstack/api/response/ProjectResponseTest.java
b/api/src/test/java/org/apache/cloudstack/api/response/ProjectResponseTest.java
new file mode 100644
index 00000000000..a6f5caa4a76
--- /dev/null
+++
b/api/src/test/java/org/apache/cloudstack/api/response/ProjectResponseTest.java
@@ -0,0 +1,34 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.api.response;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.springframework.test.util.ReflectionTestUtils;
+
+public class ProjectResponseTest {
+
+ @Test
+ public void setVpcLimitStoresItsOwnParameterNotTheNetworkLimit() {
+ ProjectResponse response = new ProjectResponse();
+ response.setNetworkLimit("5");
+ response.setVpcLimit("10");
+
+ Assert.assertEquals("10", ReflectionTestUtils.getField(response,
"vpcLimit"));
+ Assert.assertEquals("5", ReflectionTestUtils.getField(response,
"networkLimit"));
+ }
+}