You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CLOUDSTACK-9812: Update 'updatePortForwardingRule' api to include additional parameter end port (apache#1985)
Configure a PF rule Private port : Start port ; 20 ENd POrt 25 || Public Port : Start port 20 ; ENd Port : 25.
Trigger UpdatePortForwardingRule api
ApI fails with following error : " Unable to update the private port of port forwarding rule as the rule has port range "
Solution-
Port range gets modified
Copy file name to clipboardExpand all lines: api/src/org/apache/cloudstack/api/command/user/firewall/UpdatePortForwardingRuleCmd.java
+10-2Lines changed: 10 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -47,9 +47,13 @@ public class UpdatePortForwardingRuleCmd extends BaseAsyncCustomIdCmd {
47
47
@Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = FirewallRuleResponse.class, required = true, description = "the ID of the port forwarding rule", since = "4.4")
48
48
privateLongid;
49
49
50
-
@Parameter(name=ApiConstants.PRIVATE_PORT, type=CommandType.INTEGER, description="the private port of the port forwarding rule")
50
+
@Parameter(name=ApiConstants.PRIVATE_START_PORT, type=CommandType.INTEGER, description="the private start port of the port forwarding rule")
51
51
privateIntegerprivatePort;
52
52
53
+
54
+
@Parameter(name=ApiConstants.PRIVATE_END_PORT, type=CommandType.INTEGER, description="the private end port of the port forwarding rule")
@@ -1541,9 +1541,29 @@ public PortForwardingRule updatePortForwardingRule(long id, Integer privatePort,
1541
1541
rule.setDisplay(forDisplay);
1542
1542
}
1543
1543
1544
-
if (!rule.getSourcePortStart().equals(rule.getSourcePortEnd()) && privatePort != null) {
1545
-
thrownewInvalidParameterValueException("Unable to update the private port of port forwarding rule as the rule has port range : " + rule.getSourcePortStart() + " to " + rule.getSourcePortEnd());
1544
+
if (privatePort != null && !NetUtils.isValidPort(privatePort)) {
1545
+
thrownewInvalidParameterValueException("privatePort is an invalid value: " + privatePort);
1546
1546
}
1547
+
if (privateEndPort != null && !NetUtils.isValidPort(privateEndPort)) {
1548
+
thrownewInvalidParameterValueException("PrivateEndPort has an invalid value: " + privateEndPort);
0 commit comments