VPC: CS-15564 - when send the rules to the backend, form the list of rules 
after the rules were marked with Revoke state

Conflicts:

        server/src/com/cloud/network/vpc/NetworkACLManagerImpl.java


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

Branch: refs/heads/vpc
Commit: 534e6d4d80f526641cc491f473656850ada8851c
Parents: d48d4c2
Author: Alena Prokharchyk <[email protected]>
Authored: Fri Jul 13 12:47:36 2012 -0700
Committer: Alena Prokharchyk <[email protected]>
Committed: Fri Jul 13 13:35:06 2012 -0700

----------------------------------------------------------------------
 .../cloud/network/vpc/NetworkACLManagerImpl.java   |   16 ++++++++++----
 1 files changed, 11 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/534e6d4d/server/src/com/cloud/network/vpc/NetworkACLManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/vpc/NetworkACLManagerImpl.java 
b/server/src/com/cloud/network/vpc/NetworkACLManagerImpl.java
index aec50b0..e1fa3dc 100644
--- a/server/src/com/cloud/network/vpc/NetworkACLManagerImpl.java
+++ b/server/src/com/cloud/network/vpc/NetworkACLManagerImpl.java
@@ -13,8 +13,6 @@
 package com.cloud.network.vpc;
 
 import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 
@@ -369,19 +367,27 @@ public class NetworkACLManagerImpl implements 
Manager,NetworkACLManager{
     public boolean revokeAllNetworkACLsForNetwork(long networkId, long userId, 
Account caller) throws ResourceUnavailableException {
 
         List<FirewallRuleVO> ACLs = 
_firewallDao.listByNetworkAndPurpose(networkId, Purpose.NetworkACL);
+        
+        if (ACLs.isEmpty()) {
+            s_logger.debug("Found no network ACLs for network id=" + 
networkId);
+            return true;
+        }
+        
         if (s_logger.isDebugEnabled()) {
             s_logger.debug("Releasing " + ACLs.size() + " Network ACLs for 
network id=" + networkId);
         }
 
         for (FirewallRuleVO ACL : ACLs) {
-            // Mark all Firewall rules as Revoke, but don't revoke them yet - 
we have to revoke all rules for ip, no
+            // Mark all Network ACLs rules as Revoke, but don't revoke them 
yet - we have to revoke all rules for ip, no
             // need to send them one by one
             revokeNetworkACL(ACL.getId(), false, caller, 
Account.ACCOUNT_ID_SYSTEM);
         }
+        
+        List<FirewallRuleVO> ACLsToRevoke = 
_firewallDao.listByNetworkAndPurpose(networkId, Purpose.NetworkACL);
 
         // now send everything to the backend
-        boolean success = _firewallMgr.applyFirewallRules(ACLs, false, caller);
-        
+        boolean success = _firewallMgr.applyFirewallRules(ACLsToRevoke, false, 
caller);
+
         if (s_logger.isDebugEnabled()) {
             s_logger.debug("Successfully released Network ACLs for network 
id=" + networkId + " and # of rules now = " + ACLs.size());
         }

Reply via email to