cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject [26/50] git commit: updated refs/heads/feature/systemvm-persistent-config to 921f6e2
Date Mon, 16 Feb 2015 16:40:17 GMT
Fix array index problems on the ACL command.


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

Branch: refs/heads/feature/systemvm-persistent-config
Commit: 7500962f08761ed05e46a0809b6886ce0fb104d4
Parents: af86630
Author: wilderrodrigues <wrodrigues@schubergphilis.com>
Authored: Thu Jan 29 14:55:06 2015 +0100
Committer: wilderrodrigues <wrodrigues@schubergphilis.com>
Committed: Wed Feb 4 18:47:13 2015 +0100

----------------------------------------------------------------------
 .../facade/SetNetworkAclConfigItem.java               | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7500962f/core/src/com/cloud/agent/resource/virtualnetwork/facade/SetNetworkAclConfigItem.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/resource/virtualnetwork/facade/SetNetworkAclConfigItem.java
b/core/src/com/cloud/agent/resource/virtualnetwork/facade/SetNetworkAclConfigItem.java
index d1afb7c..7247766 100644
--- a/core/src/com/cloud/agent/resource/virtualnetwork/facade/SetNetworkAclConfigItem.java
+++ b/core/src/com/cloud/agent/resource/virtualnetwork/facade/SetNetworkAclConfigItem.java
@@ -22,6 +22,8 @@ package com.cloud.agent.resource.virtualnetwork.facade;
 import java.util.ArrayList;
 import java.util.List;
 
+import org.apache.log4j.Logger;
+
 import com.cloud.agent.api.routing.NetworkElementCommand;
 import com.cloud.agent.api.routing.SetNetworkACLCommand;
 import com.cloud.agent.api.to.NicTO;
@@ -39,6 +41,8 @@ import com.cloud.utils.net.NetUtils;
 
 public class SetNetworkAclConfigItem extends AbstractConfigItemFacade {
 
+    public static final Logger s_logger = Logger.getLogger(SetNetworkAclConfigItem.class.getName());
+
     @Override
     public List<ConfigItem> generateConfig(final NetworkElementCommand cmd) {
         final SetNetworkACLCommand command = (SetNetworkACLCommand) cmd;
@@ -71,7 +75,15 @@ public class SetNetworkAclConfigItem extends AbstractConfigItemFacade {
                 aclRule = new AllAclRule(ruleParts[4], "ACCEPT".equals(ruleParts[5]));
                 break;
             default:
-                aclRule = new ProtocolAclRule(ruleParts[4], "ACCEPT".equals(ruleParts[5]),
Integer.parseInt(ruleParts[1]));
+                // Fuzzy logic in cloudstack: if we do not handle it here, it will throw
an exception and work okay (with a stack trace on the console).
+                // If we check the size of the array, it will fail to setup the network.
+                // So, let's catch the exception and continue in the loop.
+                try {
+                    aclRule = new ProtocolAclRule(ruleParts[5], false, Integer.parseInt(ruleParts[1]));
+                } catch (final Exception e) {
+                    s_logger.warn("Problem occured when reading the entries in the ruleParts
array. Actual array size is '" + ruleParts.length + "', but trying to read from index 5.");
+                    continue;
+                }
             }
             if ("Ingress".equals(ruleParts[0])) {
                 ingressRules.add(aclRule);


Mime
View raw message