You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by sa...@apache.org on 2013/07/29 10:19:55 UTC

git commit: updated refs/heads/4.2 to 460fe86

Updated Branches:
  refs/heads/4.2 11e3a43eb -> 460fe86eb


CLOUDSTACK-3870 [VMware] Management traffic network over a VLAN is not working

CLOUDSTACK-3437 In case of multiple physical network setup we see log message "can't get physical network"

CloudStack's control network is management network in case of VMware.
Processing management VLAN id provided in zone traffic label for management traffic.`

Signed-off-by: Sateesh Chodapuneedi <sa...@apache.org>


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

Branch: refs/heads/4.2
Commit: 460fe86eb52beba2cf00b9d8ed339821c0ca67a9
Parents: 11e3a43
Author: Sateesh Chodapuneedi <sa...@apache.org>
Authored: Mon Jul 29 08:16:58 2013 +0530
Committer: Sateesh Chodapuneedi <sa...@apache.org>
Committed: Mon Jul 29 08:16:58 2013 +0530

----------------------------------------------------------------------
 .../src/com/cloud/network/NetworkModelImpl.java | 48 +++++++++++++++-----
 1 file changed, 36 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/460fe86e/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 d7ca639..849884d 100755
--- a/server/src/com/cloud/network/NetworkModelImpl.java
+++ b/server/src/com/cloud/network/NetworkModelImpl.java
@@ -1277,7 +1277,7 @@ public class NetworkModelImpl extends ManagerBase implements NetworkModel {
     
         Long physicalNetworkId = null;
         if (effectiveTrafficType != TrafficType.Guest) {
-            physicalNetworkId = getNonGuestNetworkPhysicalNetworkId(network);
+            physicalNetworkId = getNonGuestNetworkPhysicalNetworkId(network, effectiveTrafficType);
         } else {
             NetworkOffering offering = _configMgr.getNetworkOffering(network.getNetworkOfferingId());
             physicalNetworkId = network.getPhysicalNetworkId();
@@ -1796,18 +1796,11 @@ public class NetworkModelImpl extends ManagerBase implements NetworkModel {
 
     
 
-    protected Long getNonGuestNetworkPhysicalNetworkId(Network network) {
-            // no physical network for control traffic type
-    
-            // have to remove this sanity check as VMware control network is management network
+    protected Long getNonGuestNetworkPhysicalNetworkId(Network network, TrafficType trafficType) {
+            // VMware control network is management network
             // we need to retrieve traffic label information through physical network
-    /*        
-            if (network.getTrafficType() == TrafficType.Control) {
-                return null;
-            }
-    */
             Long physicalNetworkId = network.getPhysicalNetworkId();
-    
+
             if (physicalNetworkId == null) {
                 List<PhysicalNetworkVO> pNtwks = _physicalNetworkDao.listByZone(network.getDataCenterId());
                 if (pNtwks.size() == 1) {
@@ -1817,7 +1810,7 @@ public class NetworkModelImpl extends ManagerBase implements NetworkModel {
                     // We can make this assumptions based on the fact that Public/Management/Control traffic types are
                     // supported only in one physical network in the zone in 3.0
                     for (PhysicalNetworkVO pNtwk : pNtwks) {
-                        if (_pNTrafficTypeDao.isTrafficTypeSupported(pNtwk.getId(), network.getTrafficType())) {
+                        if (_pNTrafficTypeDao.isTrafficTypeSupported(pNtwk.getId(), trafficType)) {
                             physicalNetworkId = pNtwk.getId();
                             break;
                         }
@@ -1827,6 +1820,37 @@ public class NetworkModelImpl extends ManagerBase implements NetworkModel {
             return physicalNetworkId;
         }
 
+    protected Long getNonGuestNetworkPhysicalNetworkId(Network network) {
+        // no physical network for control traffic type
+
+        // have to remove this sanity check as VMware control network is management network
+        // we need to retrieve traffic label information through physical network
+/*
+        if (network.getTrafficType() == TrafficType.Control) {
+            return null;
+        }
+*/
+        Long physicalNetworkId = network.getPhysicalNetworkId();
+
+        if (physicalNetworkId == null) {
+            List<PhysicalNetworkVO> pNtwks = _physicalNetworkDao.listByZone(network.getDataCenterId());
+            if (pNtwks.size() == 1) {
+                physicalNetworkId = pNtwks.get(0).getId();
+            } else {
+                // locate physicalNetwork with supported traffic type
+                // We can make this assumptions based on the fact that Public/Management/Control traffic types are
+                // supported only in one physical network in the zone in 3.0
+                for (PhysicalNetworkVO pNtwk : pNtwks) {
+                    if (_pNTrafficTypeDao.isTrafficTypeSupported(pNtwk.getId(), network.getTrafficType())) {
+                        physicalNetworkId = pNtwk.getId();
+                        break;
+                    }
+                }
+            }
+        }
+        return physicalNetworkId;
+    }
+
     @Override
     public NicProfile getNicProfile(VirtualMachine vm, long networkId, String broadcastUri) {
         NicVO nic = null;