cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alena1...@apache.org
Subject git commit: VPC: CS-15968 - don't send ips in Releasing state to the router when the nic is already unplugged for this Vlan
Date Mon, 13 Aug 2012 18:57:51 GMT
Updated Branches:
  refs/heads/master 55e224f56 -> e74969fde


VPC: CS-15968 - don't send ips in Releasing state to the router when the nic is already unplugged
for this Vlan

Conflicts:

	server/src/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java
	server/src/com/cloud/network/rules/RulesManagerImpl.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/e74969fd
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/e74969fd
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/e74969fd

Branch: refs/heads/master
Commit: e74969fdeca58e8e6e5745a93832020b1f67b2b0
Parents: 55e224f
Author: Alena Prokharchyk <alena.prokharchyk@citrix.com>
Authored: Mon Aug 13 11:41:55 2012 -0700
Committer: Alena Prokharchyk <alena.prokharchyk@citrix.com>
Committed: Mon Aug 13 11:55:34 2012 -0700

----------------------------------------------------------------------
 .../network/firewall/FirewallManagerImpl.java      |    6 ------
 .../network/lb/LoadBalancingRulesManagerImpl.java  |   10 ++++------
 .../VpcVirtualNetworkApplianceManagerImpl.java     |   14 ++++++++------
 .../com/cloud/network/rules/RulesManagerImpl.java  |    5 -----
 4 files changed, 12 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e74969fd/server/src/com/cloud/network/firewall/FirewallManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/firewall/FirewallManagerImpl.java b/server/src/com/cloud/network/firewall/FirewallManagerImpl.java
index 032d878..f112065 100644
--- a/server/src/com/cloud/network/firewall/FirewallManagerImpl.java
+++ b/server/src/com/cloud/network/firewall/FirewallManagerImpl.java
@@ -457,12 +457,6 @@ public class FirewallManagerImpl implements FirewallService, FirewallManager,
Ma
 
         //remove the rule
         _firewallDao.remove(rule.getId());
-        
-        if (rule.getSourceIpAddressId() != null) {
-            //if the rule is the last one for the ip address assigned to VPC, unassign it
from the network
-            IpAddress ip = _ipAddressDao.findById(rule.getSourceIpAddressId());
-            _vpcMgr.unassignIPFromVpcNetwork(ip.getId(), rule.getNetworkId());
-        }
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e74969fd/server/src/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java b/server/src/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java
index c430c67..ba9923f 100755
--- a/server/src/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java
+++ b/server/src/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java
@@ -982,6 +982,9 @@ public class LoadBalancingRulesManagerImpl<Type> implements LoadBalancingRulesMa
                         }
                     }
                 }
+                // if the rule is the last one for the ip address assigned to VPC, unassign
it from the network
+                IpAddress ip = _ipAddressDao.findById(lb.getSourceIpAddressId());
+                _vpcMgr.unassignIPFromVpcNetwork(ip.getId(), lb.getNetworkId());
             }
         }
 
@@ -1346,13 +1349,8 @@ public class LoadBalancingRulesManagerImpl<Type> implements LoadBalancingRulesMa
         return _lbDao.findById(lbId);
     }
 
-    protected void removeLBRule(LoadBalancerVO rule) {
-        
+    protected void removeLBRule(LoadBalancerVO rule) { 
         //remove the rule
         _lbDao.remove(rule.getId());
-        
-        //if the rule is the last one for the ip address assigned to VPC, unassign it from
the network
-        IpAddress ip = _ipAddressDao.findById(rule.getSourceIpAddressId());
-        _vpcMgr.unassignIPFromVpcNetwork(ip.getId(), rule.getNetworkId());
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e74969fd/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java
b/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java
index 41bd45c..ce5ba34 100644
--- a/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java
+++ b/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java
@@ -602,12 +602,13 @@ public class VpcVirtualNetworkApplianceManagerImpl extends VirtualNetworkApplian
             }
         }
         
-        //3) apply the rules
+        //3) apply the ips
         boolean result = applyRules(network, routers, "vpc ip association", false, null,
false, new RuleApplier() {
             @Override
             public boolean execute(Network network, VirtualRouter router) throws ResourceUnavailableException
{
                 Commands cmds = new Commands(OnError.Continue);
                 Map<String, String> vlanMacAddress = new HashMap<String, String>();
+                List<PublicIpAddress> ipsToSend = new ArrayList<PublicIpAddress>();
                 for (PublicIpAddress ipAddr : ipAddress) {
                     
                     String broadcastURI = BroadcastDomainType.Vlan.toUri(ipAddr.getVlanTag()).toString();
@@ -620,14 +621,15 @@ public class VpcVirtualNetworkApplianceManagerImpl extends VirtualNetworkApplian
                             throw new CloudRuntimeException("Unable to find the nic in network
" + ipAddr.getNetworkId() + 
                                     "  to apply the ip address " + ipAddr  + " for");
                         }
-                        macAddress = ipAddr.getMacAddress();
+                        s_logger.debug("Not sending release for ip address " + ipAddr + 
+                                " as its nic is already gone from VPC router " + router);
                     } else {
                         macAddress = nic.getMacAddress();
-                    }
-                    
-                    vlanMacAddress.put(ipAddr.getVlanTag(), macAddress);
+                        vlanMacAddress.put(ipAddr.getVlanTag(), macAddress);
+                        ipsToSend.add(ipAddr);
+                    }   
                 }
-                createVpcAssociatePublicIPCommands(router, ipAddress, cmds, vlanMacAddress);
+                createVpcAssociatePublicIPCommands(router, ipsToSend, cmds, vlanMacAddress);
                 return sendCommandsToRouter(router, cmds);
             }
         });

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e74969fd/server/src/com/cloud/network/rules/RulesManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/rules/RulesManagerImpl.java b/server/src/com/cloud/network/rules/RulesManagerImpl.java
index 73cc6bb..6e57009 100755
--- a/server/src/com/cloud/network/rules/RulesManagerImpl.java
+++ b/server/src/com/cloud/network/rules/RulesManagerImpl.java
@@ -1394,11 +1394,6 @@ public class RulesManagerImpl implements RulesManager, RulesService,
Manager {
 
     
     protected void removePFRule(PortForwardingRuleVO rule) {
-        
         _portForwardingDao.remove(rule.getId());
-        
-        //if the rule is the last one for the ip address assigned to VPC, unassign it from
the network
-        IpAddress ip = _ipAddressDao.findById(rule.getSourceIpAddressId());
-        _vpcMgr.unassignIPFromVpcNetwork(ip.getId(), rule.getNetworkId());   
     }
 }


Mime
View raw message