mirror of https://github.com/apache/cloudstack.git
bug 13100: Handle the multiply source nat for different network
The original method of testing source nat didn't consider the situation that multiply source nat ip can be passed into the function because they belonged to the different networks. status 13100: resolved fixed
This commit is contained in:
parent
550a0f98a9
commit
200f8e4d14
|
|
@ -640,18 +640,18 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
|||
Map<PublicIp, Set<Service>> ipToServices = new HashMap<PublicIp, Set<Service>>();
|
||||
|
||||
if (publicIps != null && !publicIps.isEmpty()) {
|
||||
boolean gotSNAT = false;
|
||||
Set<Long> networkSNAT = new HashSet<Long>();
|
||||
for (PublicIp ip : publicIps) {
|
||||
Set<Service> services = ipToServices.get(ip);
|
||||
if (services == null) {
|
||||
services = new HashSet<Service>();
|
||||
}
|
||||
if (ip.isSourceNat()) {
|
||||
if (!gotSNAT) {
|
||||
if (!networkSNAT.contains(ip.getAssociatedWithNetworkId())) {
|
||||
services.add(Service.SourceNat);
|
||||
gotSNAT = true;
|
||||
networkSNAT.add(ip.getAssociatedWithNetworkId());
|
||||
} else {
|
||||
throw new CloudRuntimeException("Multiply generic source NAT IPs provided!");
|
||||
throw new CloudRuntimeException("Multiply generic source NAT IPs provided for network " + ip.getAssociatedWithNetworkId());
|
||||
}
|
||||
}
|
||||
if (ip.isOneToOneNat()) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue