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

This commit is contained in:
Alena Prokharchyk 2012-08-13 11:41:55 -07:00
parent cf669496e1
commit a82ff7b0d1
4 changed files with 11 additions and 21 deletions

View File

@ -464,12 +464,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

View File

@ -981,7 +981,6 @@ public class LoadBalancingRulesManagerImpl<Type> implements LoadBalancingRulesMa
if (performedIpAssoc) {
ipVO = _ipAddressDao.findById(ipVO.getId());
_vpcMgr.unassignIPFromVpcNetwork(ipVO.getId(), lb.getNetworkId());
}
}
}
@ -1178,6 +1177,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());
}
}
@ -1560,9 +1562,5 @@ public class LoadBalancingRulesManagerImpl<Type> implements LoadBalancingRulesMa
// 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());
}
}

View File

@ -628,12 +628,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();
@ -646,14 +647,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);
}
});

View File

@ -1438,9 +1438,5 @@ 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());
}
}