cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mc...@apache.org
Subject [37/50] [abbrv] git commit: updated refs/heads/rbac to 2ef4d52
Date Fri, 01 Nov 2013 00:21:48 GMT
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>


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  <wstevens@cloudops.com>
Authored: Wed Oct 30 10:14:14 2013 -0700
Committer: Sheng Yang <sheng.yang@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());
             }
         }
 


Mime
View raw message