mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Add support for multiple networks in the 'per account' source nat type setting in external network devices
Signed-off-by: Sheng Yang <sheng.yang@citrix.com>
This commit is contained in:
parent
a6b6fa65fa
commit
8871cdc03a
@ -434,17 +434,20 @@ public abstract class ExternalFirewallDeviceManagerImpl extends AdapterBase impl
|
||||
|
||||
IPAddressVO sourceNatIp = null;
|
||||
if (!sharedSourceNat) {
|
||||
// Get the source NAT IP address for this account
|
||||
// Get the source NAT IP address for this network
|
||||
List<? extends IpAddress> sourceNatIps = _networkModel.listPublicIpsAssignedToAccount(network.getAccountId(),
|
||||
zoneId, true);
|
||||
|
||||
if (sourceNatIps.size() != 1) {
|
||||
String errorMsg = "External firewall was unable to find the source NAT IP address for account "
|
||||
+ account.getAccountName();
|
||||
for (IpAddress ipAddress : sourceNatIps) {
|
||||
if (ipAddress.getAssociatedWithNetworkId().longValue() == network.getId()) {
|
||||
sourceNatIp = _ipAddressDao.findById(ipAddress.getId());
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (sourceNatIp == null) {
|
||||
String errorMsg = "External firewall was unable to find the source NAT IP address for network " + network.getName();
|
||||
s_logger.error(errorMsg);
|
||||
return true;
|
||||
} else {
|
||||
sourceNatIp = _ipAddressDao.findById(sourceNatIps.get(0).getId());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user