mirror of https://github.com/apache/cloudstack.git
CS-15503: don't send Ips in Releasing state as a part of VPC VR start
This commit is contained in:
parent
fe958786b5
commit
9c9b7ee299
|
|
@ -2038,15 +2038,29 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
|
|||
}
|
||||
}
|
||||
|
||||
protected ArrayList<? extends PublicIpAddress> getPublicIpsToApply(VirtualRouter router, Provider provider, Long guestNetworkId) {
|
||||
protected ArrayList<? extends PublicIpAddress> getPublicIpsToApply(VirtualRouter router, Provider provider,
|
||||
Long guestNetworkId, com.cloud.network.IpAddress.State... skipInStates) {
|
||||
long ownerId = router.getAccountId();
|
||||
final List<IPAddressVO> userIps = _networkMgr.listPublicIpsAssignedToGuestNtwk(ownerId, guestNetworkId, null);
|
||||
List<PublicIp> allPublicIps = new ArrayList<PublicIp>();
|
||||
if (userIps != null && !userIps.isEmpty()) {
|
||||
boolean addIp = true;
|
||||
for (IPAddressVO userIp : userIps) {
|
||||
if (skipInStates != null) {
|
||||
for (IpAddress.State stateToSkip : skipInStates) {
|
||||
if (userIp.getState() == stateToSkip) {
|
||||
s_logger.debug("Skipping ip address " + userIp + " in state " + userIp.getState());
|
||||
addIp = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (addIp) {
|
||||
PublicIp publicIp = new PublicIp(userIp, _vlanDao.findById(userIp.getVlanId()),
|
||||
NetUtils.createSequenceBasedMacAddress(userIp.getMacAddress()));
|
||||
allPublicIps.add(publicIp);
|
||||
allPublicIps.add(publicIp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ import java.util.HashMap;
|
|||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.ejb.Local;
|
||||
|
||||
|
|
@ -1044,13 +1045,12 @@ public class VpcVirtualNetworkApplianceManagerImpl extends VirtualNetworkApplian
|
|||
protected void finalizeIpAssocForNetwork(Commands cmds, VirtualRouter router, Provider provider,
|
||||
Long guestNetworkId) {
|
||||
|
||||
ArrayList<? extends PublicIpAddress> publicIps = getPublicIpsToApply(router, provider, guestNetworkId);
|
||||
ArrayList<? extends PublicIpAddress> publicIps = getPublicIpsToApply(router, provider, guestNetworkId, IpAddress.State.Releasing);
|
||||
|
||||
if (publicIps != null && !publicIps.isEmpty()) {
|
||||
s_logger.debug("Found " + publicIps.size() + " ip(s) to apply as a part of domR " + router + " start.");
|
||||
// Re-apply public ip addresses - should come before PF/LB/VPN
|
||||
createVpcAssociatePublicIPCommands(router, publicIps, cmds);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1223,4 +1223,5 @@ public class VpcVirtualNetworkApplianceManagerImpl extends VirtualNetworkApplian
|
|||
privateNic.setMacAddress(ip.getMacAddress());
|
||||
return privateNic;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue