You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ke...@apache.org on 2012/05/28 00:30:43 UTC

[2/50] git commit: CS-14956 Support for rate limiting policies in Nexus dvSwith feature for CloudStack Removed global parameters that are not required. Cleanup. Reviewed-by: Devdeep

CS-14956 Support for rate limiting policies in Nexus dvSwith feature for CloudStack
Removed global parameters that are not required. Cleanup.
Reviewed-by: Devdeep


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

Branch: refs/heads/master
Commit: 4ad8845b286f7f2f336d37ee9f2504df677b6dab
Parents: 0e3bf8c
Author: Sateesh Chodapuneedi <sa...@citrix.com>
Authored: Sat May 26 05:22:03 2012 +0530
Committer: Vijayendra Bhamidipati <vi...@citrix.com>
Committed: Fri May 25 19:41:36 2012 -0700

----------------------------------------------------------------------
 .../hypervisor/vmware/manager/VmwareManager.java   |    6 --
 .../hypervisor/vmware/resource/VmwareResource.java |   39 +--------
 server/src/com/cloud/configuration/Config.java     |    3 -
 .../cloud/hypervisor/vmware/VmwareManagerImpl.java |   66 ++++-----------
 .../hypervisor/vmware/VmwareServerDiscoverer.java  |   20 +----
 .../src/com/cloud/network/NetworkManagerImpl.java  |   26 +++++-
 6 files changed, 50 insertions(+), 110 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/4ad8845b/core/src/com/cloud/hypervisor/vmware/manager/VmwareManager.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/hypervisor/vmware/manager/VmwareManager.java b/core/src/com/cloud/hypervisor/vmware/manager/VmwareManager.java
index b2a24c2..7d85a96 100755
--- a/core/src/com/cloud/hypervisor/vmware/manager/VmwareManager.java
+++ b/core/src/com/cloud/hypervisor/vmware/manager/VmwareManager.java
@@ -65,12 +65,6 @@ public interface VmwareManager {
 
     Map<String, String> getNexusVSMCredentialsByClusterId(Long clusterId);
 
-    String getPrivateVSwitchTypeGlobalParameter();
-
-    String getPublicVSwitchTypeGlobalParameter();
-
-    String getGuestVSwitchTypeGlobalParameter();
-
     String getPrivateVSwitchName(long dcId, HypervisorType hypervisorType);
 
     String getPublicVSwitchName(long dcId, HypervisorType hypervisorType);

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/4ad8845b/core/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java b/core/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
index 2eb9998..73e1754 100755
--- a/core/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
+++ b/core/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
@@ -258,9 +258,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
     protected String _privateNetworkVSwitchName;
     protected String _publicNetworkVSwitchName;
     protected String _guestNetworkVSwitchName;
-    protected VirtualSwitchType _privateNetworkVSwitchType = VirtualSwitchType.StandardVirtualSwitch;
-    protected VirtualSwitchType _publicNetworkVSwitchType = VirtualSwitchType.StandardVirtualSwitch;
-    protected VirtualSwitchType _guestNetworkVSwitchType = VirtualSwitchType.StandardVirtualSwitch;
+    protected VirtualSwitchType _vSwitchType = VirtualSwitchType.StandardVirtualSwitch;
     protected boolean _nexusVSwitch = false;
     
     protected float _cpuOverprovisioningFactor = 1;
@@ -4053,12 +4051,9 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
                     s_logger.info("Stocking credentials while configuring resource.");
                     context.registerStockObject("vsmcredentials", vsmCredentials);
                 }
-                if (mgr.getPrivateVSwitchTypeGlobalParameter().equalsIgnoreCase("nexus"))
-                    _privateNetworkVSwitchName = mgr.getPrivateVSwitchName(Long.parseLong(_dcId), HypervisorType.VMware);
-                if (mgr.getPublicVSwitchTypeGlobalParameter().equalsIgnoreCase("nexus"))
-                    _publicNetworkVSwitchName = mgr.getPublicVSwitchName(Long.parseLong(_dcId), HypervisorType.VMware);
-                if (mgr.getGuestVSwitchTypeGlobalParameter().equalsIgnoreCase("nexus"))
-                    _guestNetworkVSwitchName = mgr.getGuestVSwitchName(Long.parseLong(_dcId), HypervisorType.VMware);
+                _privateNetworkVSwitchName = mgr.getPrivateVSwitchName(Long.parseLong(_dcId), HypervisorType.VMware);
+                _publicNetworkVSwitchName = mgr.getPublicVSwitchName(Long.parseLong(_dcId), HypervisorType.VMware);
+                _guestNetworkVSwitchName = mgr.getGuestVSwitchName(Long.parseLong(_dcId), HypervisorType.VMware);
             }
 
         } catch (Exception e) {
@@ -4104,31 +4099,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
         value = params.get("vmware.use.nexus.vswitch").toString();
         if(value != null && value.equalsIgnoreCase("true"))
         	_nexusVSwitch = true;
-        
-        value = (String)params.get("private.network.vswitch.type");
-        if(value != null && value.equalsIgnoreCase("standard"))
-        	_privateNetworkVSwitchType = VirtualSwitchType.StandardVirtualSwitch;
-        else if(value != null && value.equalsIgnoreCase("nexus"))
-        	_privateNetworkVSwitchType = VirtualSwitchType.NexusDistributedVirtualSwitch;
-        else
-       	_privateNetworkVSwitchType = VirtualSwitchType.VMwareDistributedVirtualSwitch;
-        
-        value = (String)params.get("public.network.vswitch.type");
-        if(value != null && value.equalsIgnoreCase("standard"))
-        	_publicNetworkVSwitchType = VirtualSwitchType.StandardVirtualSwitch;
-        else if(value != null && value.equalsIgnoreCase("nexus"))
-        	_publicNetworkVSwitchType = VirtualSwitchType.NexusDistributedVirtualSwitch;
-        else
-        	_publicNetworkVSwitchType = VirtualSwitchType.VMwareDistributedVirtualSwitch;
-        
-        value = (String)params.get("guest.network.vswitch.type");
-        if(value != null && value.equalsIgnoreCase("standard"))
-        	_guestNetworkVSwitchType = VirtualSwitchType.StandardVirtualSwitch;
-        else if(value != null && value.equalsIgnoreCase("nexus"))
-        	_guestNetworkVSwitchType = VirtualSwitchType.NexusDistributedVirtualSwitch;
-        else
-        	_guestNetworkVSwitchType = VirtualSwitchType.VMwareDistributedVirtualSwitch;
-        
+
         s_logger.info("VmwareResource network configuration info. private vSwitch: " + _privateNetworkVSwitchName + ", public vSwitch: " + _publicNetworkVSwitchName + ", guest network: "
                 + _guestNetworkVSwitchName);
 

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/4ad8845b/server/src/com/cloud/configuration/Config.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/configuration/Config.java b/server/src/com/cloud/configuration/Config.java
index 844de26..8936544 100755
--- a/server/src/com/cloud/configuration/Config.java
+++ b/server/src/com/cloud/configuration/Config.java
@@ -243,9 +243,6 @@ public enum Config {
     VmwarePublicNetworkVSwitch("Hidden", ManagementServer.class, String.class, "vmware.public.vswitch", null, "Specify the vSwitch on host for public network", null),
     VmwareGuestNetworkVSwitch("Hidden", ManagementServer.class, String.class, "vmware.guest.vswitch", null, "Specify the vSwitch on host for guest network", null),
     VmwareUseNexusVSwitch("Network", ManagementServer.class, Boolean.class, "vmware.use.nexus.vswitch", "false", "Enable/Disable Cisco Nexus 1000v vSwitch in VMware environment", null),
-    VmwarePrivateNetworkVSwitchType("Advanced", ManagementServer.class, String.class, "vmware.private.network.vswitch.type", null, "Specify type of (standard/nexus) virtual switch designated for private traffic", null), 
-    VmwarePublicNetworkVSwitchType("Advanced", ManagementServer.class, String.class, "vmware.public.network.vswitch.type", null, "Specify type of (standard/nexus) virtual switch designated for public traffic", null),
-    VmwareGuestNetworkVSwitchType("Advanced", ManagementServer.class, String.class, "vmware.guest.network.vswitch.type", null, "Specify type of (standard/nexus) virtual switch designated for guest traffic", null),
     VmwareServiceConsole("Advanced", ManagementServer.class, String.class, "vmware.service.console", "Service Console", "Specify the service console network name(for ESX hosts)", null),
     VmwareManagementPortGroup("Advanced", ManagementServer.class, String.class, "vmware.management.portgroup", "Management Network", "Specify the management network name(for ESXi hosts)", null),
     VmwareAdditionalVncPortRangeStart("Advanced", ManagementServer.class, Integer.class, "vmware.additional.vnc.portrange.start", "50000", "Start port number of additional VNC port range", null),

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/4ad8845b/server/src/com/cloud/hypervisor/vmware/VmwareManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/hypervisor/vmware/VmwareManagerImpl.java b/server/src/com/cloud/hypervisor/vmware/VmwareManagerImpl.java
index 6be517b..705b46f 100755
--- a/server/src/com/cloud/hypervisor/vmware/VmwareManagerImpl.java
+++ b/server/src/com/cloud/hypervisor/vmware/VmwareManagerImpl.java
@@ -130,9 +130,6 @@ public class VmwareManagerImpl implements VmwareManager, VmwareStorageMount, Lis
     String _privateNetworkVSwitchName;
     String _publicNetworkVSwitchName;
     String _guestNetworkVSwitchName;
-    String _privateNetworkVSwitchType;
-    String _publicNetworkVSwitchType;
-    String _guestNetworkVSwitchType;
     boolean _nexusVSwitchActive;
     String _serviceConsoleName;
     String _managemetPortGroupName;
@@ -229,41 +226,29 @@ public class VmwareManagerImpl implements VmwareManager, VmwareStorageMount, Lis
         }
 
         _privateNetworkVSwitchName = configDao.getValue(Config.VmwarePrivateNetworkVSwitch.key());
-        _privateNetworkVSwitchType = configDao.getValue(Config.VmwarePrivateNetworkVSwitchType.key());
-        if(_privateNetworkVSwitchName == null) {
-        	if(_privateNetworkVSwitchType == null || _privateNetworkVSwitchType.equalsIgnoreCase("standard")) {
-        		_privateNetworkVSwitchName = "vSwitch0";
-        	}
-        	else
-        	{
-        		_privateNetworkVSwitchName = "privateEthernetPortProfile";
-        	}
+
+        if (_privateNetworkVSwitchName == null) {
+            _privateNetworkVSwitchName = "vSwitch0";
+        } else {
+            _privateNetworkVSwitchName = "privateEthernetPortProfile";
         }
 
         _publicNetworkVSwitchName = configDao.getValue(Config.VmwarePublicNetworkVSwitch.key());
-        _publicNetworkVSwitchType = configDao.getValue(Config.VmwarePublicNetworkVSwitchType.key());
-        if(_publicNetworkVSwitchName == null) {
-        	if(_publicNetworkVSwitchType == null || _publicNetworkVSwitchType.equalsIgnoreCase("standard")) {
-        		_publicNetworkVSwitchName = "vSwitch0";
-        	}
-        	else
-        	{
-        		_publicNetworkVSwitchName = "publicEthernetPortProfile";
-        	}
-        }        
 
-        _guestNetworkVSwitchName =  configDao.getValue(Config.VmwareGuestNetworkVSwitch.key());
-        _guestNetworkVSwitchType = configDao.getValue(Config.VmwareGuestNetworkVSwitchType.key());
-        if(_guestNetworkVSwitchName == null) {
-        	if(_guestNetworkVSwitchType == null || _guestNetworkVSwitchType.equalsIgnoreCase("standard")) {
-        		_guestNetworkVSwitchName = "vSwitch0";
-        	}
-        	else
-        	{
-        		_guestNetworkVSwitchName = "guestEthernetPortProfile";
-        	}
+        if (_publicNetworkVSwitchName == null) {
+            _publicNetworkVSwitchName = "vSwitch0";
+        } else {
+            _publicNetworkVSwitchName = "publicEthernetPortProfile";
         }
-        
+
+        _guestNetworkVSwitchName = configDao.getValue(Config.VmwareGuestNetworkVSwitch.key());
+
+        if (_guestNetworkVSwitchName == null) {
+            _guestNetworkVSwitchName = "vSwitch0";
+        } else {
+            _guestNetworkVSwitchName = "guestEthernetPortProfile";
+        }
+
         _serviceConsoleName = configDao.getValue(Config.VmwareServiceConsole.key());
         if(_serviceConsoleName == null) {
             _serviceConsoleName = "Service Console";
@@ -363,18 +348,6 @@ public class VmwareManagerImpl implements VmwareManager, VmwareStorageMount, Lis
         return _nexusVSwitchActive;
     }
 
-    public String getPrivateVSwitchTypeGlobalParameter() {
-        return _privateNetworkVSwitchType;
-    }
-
-    public String getPublicVSwitchTypeGlobalParameter() {
-        return _publicNetworkVSwitchType;
-    }
-
-    public String getGuestVSwitchTypeGlobalParameter() {
-        return _guestNetworkVSwitchType;
-    }
-
     @Override
     public String composeWorkerName() {
         return UUID.randomUUID().toString().replace("-", "");
@@ -592,9 +565,6 @@ public class VmwareManagerImpl implements VmwareManager, VmwareStorageMount, Lis
         params.put("private.network.vswitch.name", _privateNetworkVSwitchName);
         params.put("public.network.vswitch.name", _publicNetworkVSwitchName);
         params.put("guest.network.vswitch.name", _guestNetworkVSwitchName);
-        params.put("private.network.vswitch.type", _privateNetworkVSwitchType);
-        params.put("public.network.vswitch.type", _publicNetworkVSwitchType);
-        params.put("guest.network.vswitch.type", _guestNetworkVSwitchType);
         params.put("vmware.use.nexus.vswitch", _nexusVSwitchActive);
         params.put("service.console.name", _serviceConsoleName);
         params.put("management.portgroup.name", _managemetPortGroupName);

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/4ad8845b/server/src/com/cloud/hypervisor/vmware/VmwareServerDiscoverer.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/hypervisor/vmware/VmwareServerDiscoverer.java b/server/src/com/cloud/hypervisor/vmware/VmwareServerDiscoverer.java
index f100906..8df405a 100755
--- a/server/src/com/cloud/hypervisor/vmware/VmwareServerDiscoverer.java
+++ b/server/src/com/cloud/hypervisor/vmware/VmwareServerDiscoverer.java
@@ -127,27 +127,17 @@ public class VmwareServerDiscoverer extends DiscovererBase implements Discoverer
 
             DataCenterVO zone = _dcDao.findById(dcId);
             NetworkType zoneType = zone.getNetworkType();
-
-            if (zoneType != NetworkType.Basic && _vmwareMgr.getPublicVSwitchTypeGlobalParameter() != null && _vmwareMgr.getPublicVSwitchTypeGlobalParameter().equalsIgnoreCase("nexus")) {
-                // Get physical network label
+            if (zoneType != NetworkType.Basic) {
                 publicTrafficLabel = _netmgr.getDefaultPublicTrafficLabel(dcId, HypervisorType.VMware);
                 if (publicTrafficLabel != null) {
                     s_logger.info("Detected public network label : " + publicTrafficLabel);
                 }
             }
-            else {
-                s_logger.info("Skipping detection of public traffic label as zone type is Basic.");
-            }
-
-            if (_vmwareMgr.getGuestVSwitchTypeGlobalParameter() != null && _vmwareMgr.getGuestVSwitchTypeGlobalParameter().equalsIgnoreCase("nexus")) {
-                // Get physical network label
-                guestTrafficLabel = _netmgr.getDefaultGuestTrafficLabel(dcId, HypervisorType.VMware);
-                if (guestTrafficLabel != null) {
-                    s_logger.info("Detected guest network label : " + guestTrafficLabel);
-                }
+            // Get physical network label
+            guestTrafficLabel = _netmgr.getDefaultGuestTrafficLabel(dcId, HypervisorType.VMware);
+            if (guestTrafficLabel != null) {
+                s_logger.info("Detected guest network label : " + guestTrafficLabel);
             }
-
-            // Get credentials
             vsmCredentials = _vmwareMgr.getNexusVSMCredentialsByClusterId(clusterId);
         }
 

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/4ad8845b/server/src/com/cloud/network/NetworkManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/NetworkManagerImpl.java b/server/src/com/cloud/network/NetworkManagerImpl.java
index 2d8038c..a4121be 100755
--- a/server/src/com/cloud/network/NetworkManagerImpl.java
+++ b/server/src/com/cloud/network/NetworkManagerImpl.java
@@ -6496,8 +6496,9 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
     @Override
     public String getDefaultPublicTrafficLabel(long dcId, HypervisorType hypervisorType) {
         try {
-            PhysicalNetwork mgmtPhyNetwork = getDefaultPhysicalNetworkByZoneAndTrafficType(dcId, TrafficType.Public);
-            PhysicalNetworkTrafficTypeVO publicTraffic = _pNTrafficTypeDao.findBy(mgmtPhyNetwork.getId(), TrafficType.Public);
+            PhysicalNetwork publicPhyNetwork = getOnePhysicalNetworkByZoneAndTrafficType(dcId, TrafficType.Public);
+            PhysicalNetworkTrafficTypeVO publicTraffic = _pNTrafficTypeDao.findBy(publicPhyNetwork.getId(),
+                    TrafficType.Public);
             if (publicTraffic != null) {
                 String label = null;
                 switch (hypervisorType) {
@@ -6524,8 +6525,9 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
     @Override
     public String getDefaultGuestTrafficLabel(long dcId, HypervisorType hypervisorType) {
         try {
-            PhysicalNetwork mgmtPhyNetwork = getDefaultPhysicalNetworkByZoneAndTrafficType(dcId, TrafficType.Guest);
-            PhysicalNetworkTrafficTypeVO guestTraffic = _pNTrafficTypeDao.findBy(mgmtPhyNetwork.getId(), TrafficType.Guest);
+            PhysicalNetwork guestPhyNetwork = getOnePhysicalNetworkByZoneAndTrafficType(dcId, TrafficType.Guest);
+            PhysicalNetworkTrafficTypeVO guestTraffic = _pNTrafficTypeDao.findBy(guestPhyNetwork.getId(),
+                    TrafficType.Guest);
             if (guestTraffic != null) {
                 String label = null;
                 switch (hypervisorType) {
@@ -6548,4 +6550,20 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
         }
         return null;
     }
+
+    private PhysicalNetwork getOnePhysicalNetworkByZoneAndTrafficType(long zoneId, TrafficType trafficType) {
+        List<PhysicalNetworkVO> networkList = _physicalNetworkDao.listByZoneAndTrafficType(zoneId, trafficType);
+
+        if (networkList.isEmpty()) {
+            throw new InvalidParameterValueException("Unable to find the default physical network with traffic="
+                    + trafficType + " in zone id=" + zoneId + ". ");
+        }
+
+        if (networkList.size() > 1) {
+            s_logger.info("More than one physical networks exist in zone id=" + zoneId + " with traffic type="
+                    + trafficType + ". ");
+        }
+
+        return networkList.get(0);
+    }
 }