mirror of https://github.com/apache/cloudstack.git
CLOUDSTACK-2045: [Multiple IPs Per Nic] This feature is not working well
in case of networks with external devices after GC add an exception for networks that use external networking devices and has secondary guest IP's allocated. On network GC, when network goes through implement phase a new vlan is allocated, based on the acquired VLAN id cidr of the network is decided in case of external networking case. While NIC uses reservation strategy 'Start' which ensures that new primary ip is allocated for the NiC from the new CIDR. Secondary IP's have hardcoded IP's in network rules. So prevent network GC.
This commit is contained in:
parent
6da29c4cde
commit
0f40cfbea8
|
|
@ -276,4 +276,6 @@ public interface NetworkModel {
|
|||
Nic getNicInNetworkIncludingRemoved(long vmId, long networkId);
|
||||
|
||||
boolean getExecuteInSeqNtwkElmtCmd();
|
||||
|
||||
boolean isNetworkReadyForGc(long networkId);
|
||||
}
|
||||
|
|
@ -2975,6 +2975,11 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager, L
|
|||
|
||||
List<Long> networkIds = _networksDao.findNetworksToGarbageCollect();
|
||||
for (Long networkId : networkIds) {
|
||||
|
||||
if (!_networkModel.isNetworkReadyForGc(networkId)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Long time = _lastNetworkIdsToFree.remove(networkId);
|
||||
if (time == null) {
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
|
|
|
|||
|
|
@ -2126,4 +2126,25 @@ public class NetworkModelImpl extends ManagerBase implements NetworkModel {
|
|||
public boolean getExecuteInSeqNtwkElmtCmd() {
|
||||
return _executeInSequenceNtwkElmtCmd;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNetworkReadyForGc(long networkId) {
|
||||
Network network = getNetwork(networkId);
|
||||
List<Long> networkIds = _networksDao.findNetworksToGarbageCollect();
|
||||
List<String> secondaryIps = _nicSecondaryIpDao.listSecondaryIpAddressInNetwork(networkId);
|
||||
if (!networkIds.contains(networkId)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// add an exception for networks that use external networking devices and has secondary guest IP's allocated.
|
||||
// On network GC, when network goes through implement phase a new vlan is allocated, based on the acquired VLAN
|
||||
// id cidr of the network is decided in case of external networking case. While NIC uses reservation strategy 'Start'
|
||||
// which ensures that new primary ip is allocated for the NiC from the new CIDR. Secondary IP's have hardcoded IP's in
|
||||
// network rules. So prevent network GC.
|
||||
if (secondaryIps != null && !secondaryIps.isEmpty() &&
|
||||
networkIsConfiguredForExternalNetworking(network.getDataCenterId(), networkId)) {
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -885,4 +885,9 @@ public class MockNetworkModelImpl extends ManagerBase implements NetworkModel {
|
|||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNetworkReadyForGc(long networkId) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -898,4 +898,8 @@ public class MockNetworkModelImpl extends ManagerBase implements NetworkModel {
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNetworkReadyForGc(long networkId) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue