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:44 UTC

[35/50] git commit: CS-9919 Support for Nexus Swiches (Cisco Vswitches) Avoid detection of public traffic label for basic zones. Check switch types along with global parameter for enabling a particular vmware vswitch types. Move credentials information i

CS-9919 Support for Nexus Swiches (Cisco Vswitches)
Avoid detection of public traffic label for basic zones. Check switch types along with global parameter for enabling a particular vmware vswitch types. Move credentials information into resource and load during resource configuration. Cleanup.

Conflicts:

	server/src/com/cloud/hypervisor/vmware/VmwareServerDiscoverer.java


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

Branch: refs/heads/master
Commit: 67bfe23d284de00599bf7227250742158d8d2042
Parents: c65199c
Author: Sateesh Chodapuneedi <sa...@citrix.com>
Authored: Wed May 16 19:42:35 2012 +0530
Committer: Vijayendra Bhamidipati <vi...@citrix.com>
Committed: Fri May 25 18:00:13 2012 -0700

----------------------------------------------------------------------
 .../hypervisor/vmware/manager/VmwareManager.java   |    2 -
 .../hypervisor/vmware/resource/VmwareResource.java |   26 +++++---------
 .../cloud/hypervisor/vmware/VmwareManagerImpl.java |   17 ---------
 .../hypervisor/vmware/VmwareServerDiscoverer.java  |   16 ++++++++-
 .../src/com/cloud/network/NetworkManagerImpl.java  |    4 +-
 5 files changed, 26 insertions(+), 39 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/67bfe23d/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 ade3c41..b2a24c2 100755
--- a/core/src/com/cloud/hypervisor/vmware/manager/VmwareManager.java
+++ b/core/src/com/cloud/hypervisor/vmware/manager/VmwareManager.java
@@ -61,8 +61,6 @@ public interface VmwareManager {
 	boolean beginExclusiveOperation(int timeOutSeconds);
 	void endExclusiveOperation();
 
-	Map<String, String> getNexusVSMCredentials(String hostGuid);
-
     boolean getNexusVSwitchGlobalParameter();
 
     Map<String, String> getNexusVSMCredentialsByClusterId(Long clusterId);

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/67bfe23d/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 5a4d1ac..d1d3a81 100755
--- a/core/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
+++ b/core/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
@@ -4032,16 +4032,20 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
 
             VmwareHypervisorHost hostMo = this.getHyperHost(context);
             _hostName = hostMo.getHyperHostName();
-            _privateNetworkVSwitchName = mgr.getPrivateVSwitchName(Long.parseLong(_dcId), HypervisorType.VMware);
-            _publicNetworkVSwitchName = mgr.getPublicVSwitchName(Long.parseLong(_dcId), HypervisorType.VMware);
-            _guestNetworkVSwitchName = mgr.getGuestVSwitchName(Long.parseLong(_dcId), HypervisorType.VMware);
+
             Map<String, String> vsmCredentials;
             if (mgr.getNexusVSwitchGlobalParameter()) {
-                vsmCredentials = mgr.getNexusVSMCredentials(_guid);
+                vsmCredentials = mgr.getNexusVSMCredentialsByClusterId(Long.parseLong(_cluster));
                 if (vsmCredentials != null) {
                     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);
             }
 
         } catch (Exception e) {
@@ -4175,19 +4179,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
             } catch (Exception e) {
                 s_logger.error("Unable to connect to vSphere server: " + _vCenterAddress, e);
                 throw new CloudRuntimeException("Unable to connect to vSphere server: " + _vCenterAddress);
-            }
-            if(_nexusVSwitch)
-            {
-            	VmwareManager mgr = _serviceContext.getStockObject(VmwareManager.CONTEXT_STOCK_NAME);            	
-                Map<String, String> nexusVSwitchCredentials = mgr.getNexusVSMCredentials(_guid);
-                if(nexusVSwitchCredentials != null)
-                {
-                	_serviceContext.registerStockObject("vsmcredentials", nexusVSwitchCredentials);
-                	//_serviceContext.registerStockObject("vsmip", nexusVSwitchCredentials.get("vsmip"));
-                	//_serviceContext.registerStockObject("vsmusername", nexusVSwitchCredentials.get("vsmusername"));
-                	//_serviceContext.registerStockObject("vsmpassword", nexusVSwitchCredentials.get("vsmpassword"));
-                }
-            }            
+            }
         }
         return _serviceContext;
     }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/67bfe23d/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 ac90fb8..01b4263 100755
--- a/server/src/com/cloud/hypervisor/vmware/VmwareManagerImpl.java
+++ b/server/src/com/cloud/hypervisor/vmware/VmwareManagerImpl.java
@@ -871,23 +871,6 @@ public class VmwareManagerImpl implements VmwareManager, VmwareStorageMount, Lis
             }
         }
     }
-    
-    @DB
-    public Map<String, String> getNexusVSMCredentials(String hostGuid) {
-        s_logger.info("Reading credentials from DB.");
-        HostVO host = _hostDao.findByGuid(hostGuid);
-        Map<String, String> vsmCredentials = null;
-        long clusterId;
-        if (host != null) {
-            clusterId = host.getClusterId();
-            s_logger.info("cluster is : " + clusterId);
-            vsmCredentials = getNexusVSMCredentialsByClusterId(clusterId);
-        }
-        else {
-            s_logger.info("Found invalid host object for hostGuid : " + hostGuid);
-        }
-        return vsmCredentials;
-    }
 
     @Override @DB
     public boolean processAnswers(long agentId, long seq, Answer[] answers) {

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/67bfe23d/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 803b642..5ce2532 100755
--- a/server/src/com/cloud/hypervisor/vmware/VmwareServerDiscoverer.java
+++ b/server/src/com/cloud/hypervisor/vmware/VmwareServerDiscoverer.java
@@ -31,7 +31,10 @@ import com.cloud.alert.AlertManager;
 import com.cloud.configuration.dao.ConfigurationDao;
 import com.cloud.dc.ClusterDetailsDao;
 import com.cloud.dc.ClusterVO;
+import com.cloud.dc.DataCenter.NetworkType;
+import com.cloud.dc.DataCenterVO;
 import com.cloud.dc.dao.ClusterDao;
+import com.cloud.dc.dao.DataCenterDao;
 import com.cloud.exception.DiscoveredWithErrorException;
 import com.cloud.exception.DiscoveryException;
 import com.cloud.host.HostVO;
@@ -73,6 +76,9 @@ public class VmwareServerDiscoverer extends DiscovererBase implements Discoverer
     @Inject VMTemplateDao _tmpltDao;
     @Inject ClusterDetailsDao _clusterDetailsDao;
     @Inject HostDao _hostDao;
+    @Inject
+    DataCenterDao _dcDao;
+
     @Inject ResourceManager _resourceMgr;
 
     @Inject CiscoNexusVSMDeviceDao _nexusDao;
@@ -118,13 +124,21 @@ public class VmwareServerDiscoverer extends DiscovererBase implements Discoverer
                     s_logger.info("Detected private network label : " + privateTrafficLabel);
                 }
             }
-            if (_vmwareMgr.getPublicVSwitchTypeGlobalParameter().equalsIgnoreCase("nexus")) {
+
+            DataCenterVO zone = _dcDao.findById(dcId);
+            NetworkType zoneType = zone.getNetworkType();
+
+            if (zoneType != NetworkType.Basic && _vmwareMgr.getPublicVSwitchTypeGlobalParameter().equalsIgnoreCase("nexus")) {
                 // Get physical network label
                 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().equalsIgnoreCase("nexus")) {
                 // Get physical network label
                 guestTrafficLabel = _netmgr.getDefaultGuestTrafficLabel(dcId, HypervisorType.VMware);

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/67bfe23d/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 371dad2..96f9fda 100755
--- a/server/src/com/cloud/network/NetworkManagerImpl.java
+++ b/server/src/com/cloud/network/NetworkManagerImpl.java
@@ -6514,7 +6514,7 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
             }
         } catch (Exception ex) {
             if (s_logger.isDebugEnabled()) {
-                s_logger.debug("Failed to retrive the default label for management traffic:" + "zone: " + dcId + " hypervisor: " + hypervisorType + " due to:" + ex.getMessage());
+                s_logger.debug("Failed to retrieve the default label for public traffic." + "zone: " + dcId + " hypervisor: " + hypervisorType + " due to: " + ex.getMessage());
             }
         }
         return null;
@@ -6542,7 +6542,7 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
             }
         } catch (Exception ex) {
             if (s_logger.isDebugEnabled()) {
-                s_logger.debug("Failed to retrive the default label for management traffic:" + "zone: " + dcId + " hypervisor: " + hypervisorType + " due to:" + ex.getMessage());
+                s_logger.debug("Failed to retrieve the default label for guest traffic." + "zone: " + dcId + " hypervisor: " + hypervisorType + " due to: " + ex.getMessage());
             }
         }
         return null;