cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m...@apache.org
Subject git commit: updated refs/heads/master to 5e56e43
Date Fri, 14 Jun 2013 05:14:07 GMT
Updated Branches:
  refs/heads/master 18163eaa4 -> 5e56e43e3


fix CLOUDSTACK-2930, exception while applying ACL rule with protocol as ALL.
1) change UI, disable startport and endport when protocol=All
2) validate parameters for API createNetworkACL


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/5e56e43e
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/5e56e43e
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/5e56e43e

Branch: refs/heads/master
Commit: 5e56e43e31dae8ec505db9b948dfaa476a96deb8
Parents: 18163ea
Author: Mice Xia <mice_xia@tcloudcomputing.com>
Authored: Fri Jun 14 13:17:38 2013 +0800
Committer: Mice Xia <mice_xia@tcloudcomputing.com>
Committed: Fri Jun 14 13:19:07 2013 +0800

----------------------------------------------------------------------
 .../com/cloud/network/vpc/NetworkACLServiceImpl.java |  4 ++++
 ui/scripts/vpc.js                                    | 15 +++++++++++++--
 2 files changed, 17 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5e56e43e/server/src/com/cloud/network/vpc/NetworkACLServiceImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/vpc/NetworkACLServiceImpl.java b/server/src/com/cloud/network/vpc/NetworkACLServiceImpl.java
index 4ad22d9..a28657b 100644
--- a/server/src/com/cloud/network/vpc/NetworkACLServiceImpl.java
+++ b/server/src/com/cloud/network/vpc/NetworkACLServiceImpl.java
@@ -294,6 +294,10 @@ public class NetworkACLServiceImpl extends ManagerBase implements NetworkACLServ
             throw new InvalidParameterValueException("Start port can't be bigger than end
port");
         }
 
+        // start port and end port must be null for protocol = 'all'
+        if ((portStart != null || portEnd != null ) && protocol != null &&
protocol.equalsIgnoreCase("all"))
+            throw new InvalidParameterValueException("start port and end port must be null
if protocol = 'all'");
+
         if (sourceCidrList != null) {
             for (String cidr: sourceCidrList){
                 if (!NetUtils.isValidCIDR(cidr)){

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5e56e43e/ui/scripts/vpc.js
----------------------------------------------------------------------
diff --git a/ui/scripts/vpc.js b/ui/scripts/vpc.js
index 39c258c5..759364d 100644
--- a/ui/scripts/vpc.js
+++ b/ui/scripts/vpc.js
@@ -97,6 +97,13 @@
                      name != 'icmpcode' &&
                      name != 'cidrlist';
             });
+            var $portFields = $inputs.filter(function() {
+              var name = $(this).attr('name');
+              return $.inArray(name, [
+                'startport',
+                'endport'
+              ]) > -1;
+            });
 
             var $protocolinput = args.$form.find('td input');
             var $protocolFields = $protocolinput.filter(function(){
@@ -124,6 +131,10 @@
               $icmpFields.hide();
               $icmpFields.parent().find('label.error').hide();
               $protocolFields.hide().removeClass('required');
+              if ($(this).val() == 'all'){
+                $portFields.attr('disabled', 'disabled');
+                $portFields.hide();
+              }
             }
           });
 
@@ -216,11 +227,11 @@
 
 
        
-        if((args.data.protocol == 'tcp' || args.data.protocol == 'udp' || args.data.protocol
== 'all') && (args.data.startport=="" || args.data.startport == undefined)){
+        if((args.data.protocol == 'tcp' || args.data.protocol == 'udp') && (args.data.startport==""
|| args.data.startport == undefined)){
          cloudStack.dialog.notice({message:_l('Start Port or End Port value should not be
blank')});
           $(window).trigger('cloudStack.fullRefresh');
         }
-        else if((args.data.protocol == 'tcp' || args.data.protocol == 'udp' || args.data.protocol
== 'all')  && (args.data.endport=="" || args.data.endport == undefined)){
+        else if((args.data.protocol == 'tcp' || args.data.protocol == 'udp')  &&
(args.data.endport=="" || args.data.endport == undefined)){
          cloudStack.dialog.notice({message:_l('Start Port or End Port value should not be
blank')});
           $(window).trigger('cloudStack.fullRefresh');
         }


Mime
View raw message