bwsw commented on a change in pull request #2320: Hotfixes to make 4.10 KVM 
agent work
URL: https://github.com/apache/cloudstack/pull/2320#discussion_r151939543
 
 

 ##########
 File path: scripts/vm/network/security_group.py
 ##########
 @@ -1039,21 +1051,27 @@ def add_network_rules(vm_name, vm_id, vm_ip, vm_ip6, 
signature, seqno, vmMac, ru
                 range = 'any'
 
         for ip in rule['ipv4']:
-            if protocol == 'all':
-                execute('iptables -I ' + vmchain + ' -m state --state NEW ' + 
direction + ' ' + ip + ' -j ' + action)
-            elif protocol != 'icmp':
-                execute('iptables -I ' + vmchain + ' -p ' + protocol + ' -m ' 
+ protocol + ' --dport ' + range + ' -m state --state NEW ' + direction + ' ' + 
ip + ' -j ' + action)
-            else:
-                execute('iptables -I ' + vmchain + ' -p icmp --icmp-type ' + 
range + ' ' + direction + ' ' + ip + ' -j ' + action)
-
+            try:
+                if protocol == 'all':
+                    execute('iptables -I ' + vmchain + ' -m state --state NEW 
' + direction + ' ' + ip + ' -j ' + action)
+                elif protocol != 'icmp':
+                    execute('iptables -I ' + vmchain + ' -p ' + protocol + ' 
-m ' + protocol + ' --dport ' + range + ' -m state --state NEW ' + direction + 
' ' + ip + ' -j ' + action)
+                else:
+                    execute('iptables -I ' + vmchain + ' -p icmp --icmp-type ' 
+ range + ' ' + direction + ' ' + ip + ' -j ' + action)
+            except:
+                pass
 
 Review comment:
   Basically, these try except for icmpv6, because (-1, -1) doesn't handled 
right for icmpv6.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to