You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by mc...@apache.org on 2013/11/01 01:21:48 UTC
[37/50] [abbrv] git commit: updated refs/heads/rbac to 2ef4d52
Add support for multiple networks in the 'per account' source nat type setting in external network devices
Signed-off-by: Sheng Yang <sh...@citrix.com>
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/8871cdc0
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/8871cdc0
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/8871cdc0
Branch: refs/heads/rbac
Commit: 8871cdc03a4009b309fde6d9baa4f9d5e89f7ae7
Parents: a6b6fa6
Author: Will Stevens <ws...@cloudops.com>
Authored: Wed Oct 30 10:14:14 2013 -0700
Committer: Sheng Yang <sh...@citrix.com>
Committed: Wed Oct 30 10:16:00 2013 -0700
----------------------------------------------------------------------
.../network/ExternalFirewallDeviceManagerImpl.java | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8871cdc0/server/src/com/cloud/network/ExternalFirewallDeviceManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/ExternalFirewallDeviceManagerImpl.java b/server/src/com/cloud/network/ExternalFirewallDeviceManagerImpl.java
index fa171ab..b0e1b39 100644
--- a/server/src/com/cloud/network/ExternalFirewallDeviceManagerImpl.java
+++ b/server/src/com/cloud/network/ExternalFirewallDeviceManagerImpl.java
@@ -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());
}
}