You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by pr...@apache.org on 2013/02/13 00:10:28 UTC
[8/8] git commit: refs/heads/4.1 - CLOUDSTACK-1135: [EC2 Query API]
AuthorizeSecurityGroupIngress and RevokeSecurityGroupIngress fails when icmp
code and type is provided
Updated Branches:
refs/heads/4.1 85db26770 -> 48368263a
CLOUDSTACK-1135: [EC2 Query API] AuthorizeSecurityGroupIngress and RevokeSecurityGroupIngress fails when icmp code and type is provided
For AuthorizeSecurityGroupIngress RevokeSecurityGroupIngress query calls parse and set the icmp code and type
Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/48368263
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/48368263
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/48368263
Branch: refs/heads/4.1
Commit: 48368263aab49e515df8020459365e57aa169d17
Parents: de5adcd
Author: Prachi Damle <pr...@cloud.com>
Authored: Tue Feb 12 14:45:29 2013 -0800
Committer: Prachi Damle <pr...@cloud.com>
Committed: Tue Feb 12 15:09:18 2013 -0800
----------------------------------------------------------------------
.../com/cloud/bridge/service/EC2RestServlet.java | 32 +++++++++++----
1 files changed, 24 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/48368263/awsapi/src/com/cloud/bridge/service/EC2RestServlet.java
----------------------------------------------------------------------
diff --git a/awsapi/src/com/cloud/bridge/service/EC2RestServlet.java b/awsapi/src/com/cloud/bridge/service/EC2RestServlet.java
index e209662..29a002c 100644
--- a/awsapi/src/com/cloud/bridge/service/EC2RestServlet.java
+++ b/awsapi/src/com/cloud/bridge/service/EC2RestServlet.java
@@ -707,12 +707,20 @@ public class EC2RestServlet extends HttpServlet {
else break;
String[] fromPort = request.getParameterValues( "IpPermissions." + nCount + ".FromPort" );
- if ( null != fromPort && 0 < fromPort.length)
- perm.setFromPort( Integer.parseInt( fromPort[0]));
+ if ( null != fromPort && 0 < fromPort.length ) {
+ if ( protocol[0].equalsIgnoreCase("icmp") )
+ perm.setIcmpType( fromPort[0] ) ;
+ else
+ perm.setFromPort( Integer.parseInt( fromPort[0]) );
+ }
String[] toPort = request.getParameterValues( "IpPermissions." + nCount + ".ToPort" );
- if ( null != toPort && 0 < toPort.length)
- perm.setToPort( Integer.parseInt( toPort[0]));
+ if ( null != toPort && 0 < toPort.length ) {
+ if ( protocol[0].equalsIgnoreCase("icmp") )
+ perm.setIcmpCode( toPort[0] );
+ else
+ perm.setToPort( Integer.parseInt( toPort[0]) );
+ }
// -> list: IpPermissions.n.IpRanges.m.CidrIp
mCount = 1;
@@ -780,12 +788,20 @@ public class EC2RestServlet extends HttpServlet {
else break;
String[] fromPort = request.getParameterValues( "IpPermissions." + nCount + ".FromPort" );
- if ( null != fromPort && 0 < fromPort.length)
- perm.setFromPort( Integer.parseInt( fromPort[0]));
+ if ( null != fromPort && 0 < fromPort.length ) {
+ if ( protocol[0].equalsIgnoreCase("icmp") )
+ perm.setIcmpType( fromPort[0] ) ;
+ else
+ perm.setFromPort( Integer.parseInt( fromPort[0]) );
+ }
String[] toPort = request.getParameterValues( "IpPermissions." + nCount + ".ToPort" );
- if ( null != toPort && 0 < toPort.length)
- perm.setToPort( Integer.parseInt( toPort[0]));
+ if ( null != toPort && 0 < toPort.length ) {
+ if ( protocol[0].equalsIgnoreCase("icmp") )
+ perm.setIcmpCode( toPort[0] );
+ else
+ perm.setToPort( Integer.parseInt( toPort[0]) );
+ }
// -> list: IpPermissions.n.IpRanges.m.CidrIp
int mCount = 1;