cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bfede...@apache.org
Subject [8/51] [abbrv] git commit: refs/heads/ui-quick-view-v2 - CLOUDSTACK-1346: Check to see if external devices are used in the network, is hardcoded for specific devices
Date Thu, 21 Feb 2013 21:45:20 GMT
CLOUDSTACK-1346: Check to see if external devices are used in the network, is hardcoded for
specific devices

- Changes the check to list all providers of a network and check if it is an external provider


Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/744c24ee
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/744c24ee
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/744c24ee

Branch: refs/heads/ui-quick-view-v2
Commit: 744c24ee68ff9d44d340120e3abd8f6502d3d0ad
Parents: 48ec439
Author: Prachi Damle <prachi@cloud.com>
Authored: Wed Feb 20 15:35:14 2013 -0800
Committer: Prachi Damle <prachi@cloud.com>
Committed: Wed Feb 20 15:37:27 2013 -0800

----------------------------------------------------------------------
 server/src/com/cloud/network/NetworkModelImpl.java |   25 ++++++++++-----
 1 files changed, 17 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/744c24ee/server/src/com/cloud/network/NetworkModelImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/NetworkModelImpl.java b/server/src/com/cloud/network/NetworkModelImpl.java
index beebb87..ebe5aa4 100644
--- a/server/src/com/cloud/network/NetworkModelImpl.java
+++ b/server/src/com/cloud/network/NetworkModelImpl.java
@@ -1762,17 +1762,26 @@ public class NetworkModelImpl extends ManagerBase implements NetworkModel
{
 
     @Override
     public boolean networkIsConfiguredForExternalNetworking(long zoneId, long networkId)
{
-        boolean netscalerInNetwork = isProviderForNetwork(Network.Provider.Netscaler, networkId);
-        boolean juniperInNetwork = isProviderForNetwork(Network.Provider.JuniperSRX, networkId);
-        boolean f5InNetwork = isProviderForNetwork(Network.Provider.F5BigIp, networkId);
-    
-        if (netscalerInNetwork || juniperInNetwork || f5InNetwork) {
-            return true;
-        } else {
-            return false;
+        List<Provider> networkProviders = getNetworkProviders(networkId);
+       for(Provider provider : networkProviders){
+           if(provider.isExternal()){
+               return true;
+           }
         }
+       return false;
     }
 
+    private List<Provider> getNetworkProviders(long networkId) {
+        List<String> providerNames = _ntwkSrvcDao.getDistinctProviders(networkId);
+        Map<String, Provider> providers = new HashMap<String, Provider>();
+        for (String providerName : providerNames) {
+           if(!providers.containsKey(providerName)){
+               providers.put(providerName, Network.Provider.getProvider(providerName));
+           }
+        }
+
+       return new ArrayList<Provider>(providers.values());
+    }
 
     @Override
     public boolean configure(String name, Map<String, Object> params) throws ConfigurationException
{


Mime
View raw message