Updated Branches:
  refs/heads/4.2 d72ae0326 -> 2c9f07324

CLOUDSTACK-3905 [VMWARE]Can not add Standard/DVSwitch when Nexus global config 
is set to true

Make VSM specific input paramters optional while adding VMware cluster where no 
traffic chosen to use Nexus 1000v dvSwitch when cloud level vSwitch is Nexus 
1000v.

Signed-off-by: Sateesh Chodapuneedi <[email protected]>


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

Branch: refs/heads/4.2
Commit: 2c9f0732498f4e1426eeb76a5cd6517b5c06a358
Parents: d72ae03
Author: Sateesh Chodapuneedi <[email protected]>
Authored: Mon Aug 12 22:41:38 2013 +0530
Committer: Sateesh Chodapuneedi <[email protected]>
Committed: Mon Aug 12 22:41:38 2013 +0530

----------------------------------------------------------------------
 .../vmware/VmwareServerDiscoverer.java          | 38 +++++++++-----------
 .../com/cloud/network/VmwareTrafficLabel.java   | 16 ++++-----
 2 files changed, 25 insertions(+), 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2c9f0732/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareServerDiscoverer.java
----------------------------------------------------------------------
diff --git 
a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareServerDiscoverer.java
 
b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareServerDiscoverer.java
index 5d48dee..8a405fb 100755
--- 
a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareServerDiscoverer.java
+++ 
b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareServerDiscoverer.java
@@ -291,7 +291,12 @@ public class VmwareServerDiscoverer extends DiscovererBase 
implements
             s_logger.info("Detected private network label : " + 
privateTrafficLabel);
                }
         Pair<Boolean, Long> vsmInfo = new Pair<Boolean, Long>(false, 0L);
-        if (nexusDVS) {
+        if (nexusDVS &&
+                (guestTrafficLabelObj.getVirtualSwitchType() == 
VirtualSwitchType.NexusDistributedVirtualSwitch) ||
+                ((zoneType == NetworkType.Advanced) && 
(publicTrafficLabelObj.getVirtualSwitchType() == 
VirtualSwitchType.NexusDistributedVirtualSwitch))) {
+            // Expect Cisco Nexus VSM details only if following 2 condition met
+            // 1) The global config parameter vmware.use.nexus.vswitch
+            // 2) Atleast 1 traffic type uses Nexus distributed virtual switch 
as backend.
                        if (zoneType != NetworkType.Basic) {
                 publicTrafficLabel = 
_netmgr.getDefaultPublicTrafficLabel(dcId, HypervisorType.VMware);
                                if (publicTrafficLabel != null) {
@@ -650,33 +655,24 @@ public class VmwareServerDiscoverer extends 
DiscovererBase implements
             throw e;
         }
 
-        if 
(defaultVirtualSwitchType.equals(VirtualSwitchType.StandardVirtualSwitch)|| 
(vSwitchType == null && vSwitchName == null)) {
-            // Case of no cluster level override configuration defined.
-            // Depend only on zone wide traffic label
-            // If global param for dvSwitch is false return default traffic 
info object with vmware standard vswitch
-            return trafficLabelObj;
-        } else {
-            // Need to persist cluster level override configuration to db
-            clusterDetails = _clusterDetailsDao.findDetails(clusterId);
-        }
-
+        clusterDetails = _clusterDetailsDao.findDetails(clusterId);
         if (vSwitchName != null) {
             trafficLabelObj.setVirtualSwitchName(vSwitchName);
-            if (trafficType == TrafficType.Guest) {
-                clusterDetails.put(ApiConstants.VSWITCH_NAME_GUEST_TRAFFIC, 
vSwitchName);
-            } else {
-                clusterDetails.put(ApiConstants.VSWITCH_NAME_PUBLIC_TRAFFIC, 
vSwitchName);
-            }
+        }
+        if (trafficType == TrafficType.Guest) {
+            clusterDetails.put(ApiConstants.VSWITCH_NAME_GUEST_TRAFFIC, 
trafficLabelObj.getVirtualSwitchName());
+        } else {
+            clusterDetails.put(ApiConstants.VSWITCH_NAME_PUBLIC_TRAFFIC, 
trafficLabelObj.getVirtualSwitchName());
         }
 
         if (vSwitchType != null) {
             validateVswitchType(vSwitchType);
             
trafficLabelObj.setVirtualSwitchType(VirtualSwitchType.getType(vSwitchType));
-            if (trafficType == TrafficType.Guest) {
-                clusterDetails.put(ApiConstants.VSWITCH_TYPE_GUEST_TRAFFIC, 
vSwitchType);
-            } else {
-                clusterDetails.put(ApiConstants.VSWITCH_TYPE_PUBLIC_TRAFFIC, 
vSwitchType);
-            }
+        }
+        if (trafficType == TrafficType.Guest) {
+            clusterDetails.put(ApiConstants.VSWITCH_TYPE_GUEST_TRAFFIC, 
trafficLabelObj.getVirtualSwitchType().toString());
+        } else {
+            clusterDetails.put(ApiConstants.VSWITCH_TYPE_PUBLIC_TRAFFIC, 
trafficLabelObj.getVirtualSwitchType().toString());
         }
 
         // Save cluster level override configuration to cluster details

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2c9f0732/plugins/hypervisors/vmware/src/com/cloud/network/VmwareTrafficLabel.java
----------------------------------------------------------------------
diff --git 
a/plugins/hypervisors/vmware/src/com/cloud/network/VmwareTrafficLabel.java 
b/plugins/hypervisors/vmware/src/com/cloud/network/VmwareTrafficLabel.java
index 8d2890a..e92dc89 100644
--- a/plugins/hypervisors/vmware/src/com/cloud/network/VmwareTrafficLabel.java
+++ b/plugins/hypervisors/vmware/src/com/cloud/network/VmwareTrafficLabel.java
@@ -58,15 +58,15 @@ public class VmwareTrafficLabel implements TrafficLabel {
     }
 
     private void _parseLabel(String networkLabel, VirtualSwitchType 
defVswitchType) {
+        // Set defaults for label in case of distributed vSwitch
+        if 
(defVswitchType.equals(VirtualSwitchType.VMwareDistributedVirtualSwitch)) {
+            _vSwitchName = DEFAULT_DVSWITCH_NAME;
+            _vSwitchType = VirtualSwitchType.VMwareDistributedVirtualSwitch;
+        } else if 
(defVswitchType.equals(VirtualSwitchType.NexusDistributedVirtualSwitch)) {
+            _vSwitchName = DEFAULT_NDVSWITCH_NAME;
+            _vSwitchType = VirtualSwitchType.NexusDistributedVirtualSwitch;
+        }
         if (networkLabel == null || networkLabel.isEmpty()) {
-            // Set defaults for label in case of distributed vSwitch
-            if 
(defVswitchType.equals(VirtualSwitchType.VMwareDistributedVirtualSwitch)) {
-                _vSwitchName = DEFAULT_DVSWITCH_NAME;
-                _vSwitchType = 
VirtualSwitchType.VMwareDistributedVirtualSwitch;
-            } else if 
(defVswitchType.equals(VirtualSwitchType.NexusDistributedVirtualSwitch)) {
-                _vSwitchName = DEFAULT_NDVSWITCH_NAME;
-                _vSwitchType = VirtualSwitchType.NexusDistributedVirtualSwitch;
-            }
             return;
         }
         String[] tokens = networkLabel.split(",");

Reply via email to