cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ke4...@apache.org
Subject [1/50] git commit: CS-14956 Support for rate limiting policies in Nexus dvSwith feature for CloudStack
Date Sun, 27 May 2012 22:30:43 GMT
Updated Branches:
  refs/heads/master 799ff32c3 -> 90b87585e


CS-14956 Support for rate limiting policies in Nexus dvSwith feature for CloudStack

Removed global parameters that are not required. Cleanup.
Reviewed-by: Devdeep

Not sure why but changes in VmwareServerDiscoverer.java were not picked up
when cherry-picking from 3.0.x. Putting them in this separate commit.


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

Branch: refs/heads/master
Commit: 90b87585e72d43ac1eaadb8ce3b7a9fdd149ebe2
Parents: 4ad8845
Author: Vijayendra Bhamidipati <vijayendra.bhamidipati@citrix.com>
Authored: Fri May 25 19:50:50 2012 -0700
Committer: Vijayendra Bhamidipati <vijayendra.bhamidipati@citrix.com>
Committed: Fri May 25 19:50:50 2012 -0700

----------------------------------------------------------------------
 .../hypervisor/vmware/VmwareServerDiscoverer.java  |  206 +++++++--------
 1 files changed, 100 insertions(+), 106 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/90b87585/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 8df405a..65a1068 100755
--- a/server/src/com/cloud/hypervisor/vmware/VmwareServerDiscoverer.java
+++ b/server/src/com/cloud/hypervisor/vmware/VmwareServerDiscoverer.java
@@ -10,9 +10,8 @@
 // limitations under the License.
 // 
 // Automatically generated by addcopyright.py at 04/03/2012
-
 package com.cloud.hypervisor.vmware;
-
+
 import java.net.URI;
 import java.net.URLDecoder;
 import java.util.HashMap;
@@ -73,14 +72,12 @@ public class VmwareServerDiscoverer extends DiscovererBase implements
Discoverer
 	@Inject ClusterDao _clusterDao;
 	@Inject VmwareManager _vmwareMgr;
     @Inject AlertManager _alertMgr;
-    @Inject VMTemplateDao _tmpltDao;
+    @Inject VMTemplateDao _tmpltDao;
     @Inject ClusterDetailsDao _clusterDetailsDao;
     @Inject HostDao _hostDao;
     @Inject
     DataCenterDao _dcDao;
-
     @Inject ResourceManager _resourceMgr;
-
     @Inject CiscoNexusVSMDeviceDao _nexusDao;
     @Inject
     NetworkManager _netmgr;
@@ -102,7 +99,7 @@ public class VmwareServerDiscoverer extends DiscovererBase implements Discoverer
         if(cluster == null || cluster.getHypervisorType() != HypervisorType.VMware) {
         	if(s_logger.isInfoEnabled())
         		s_logger.info("invalid cluster id or cluster is not for VMware hypervisors"); 
-    		return null;
+    		return null;
         }
         
         List<HostVO> hosts = _resourceMgr.listAllHostsInCluster(clusterId);
@@ -116,15 +113,13 @@ public class VmwareServerDiscoverer extends DiscovererBase implements
Discoverer
         String publicTrafficLabel = null;
         String guestTrafficLabel = null;
         Map<String, String> vsmCredentials = null;
+        
+        privateTrafficLabel = _netmgr.getDefaultManagementTrafficLabel(dcId, HypervisorType.VMware);
+        if (privateTrafficLabel != null) {
+            s_logger.info("Detected private network label : " + privateTrafficLabel);
+        }
+        
         if (_vmwareMgr.getNexusVSwitchGlobalParameter()) {
-            if (_vmwareMgr.getPrivateVSwitchTypeGlobalParameter() != null && _vmwareMgr.getPrivateVSwitchTypeGlobalParameter().equalsIgnoreCase("nexus"))
{
-                // Get physical network label
-                privateTrafficLabel = _netmgr.getDefaultManagementTrafficLabel(dcId, HypervisorType.VMware);
-                if (privateTrafficLabel != null) {
-                    s_logger.info("Detected private network label : " + privateTrafficLabel);
-                }
-            }
-
             DataCenterVO zone = _dcDao.findById(dcId);
             NetworkType zoneType = zone.getNetworkType();
             if (zoneType != NetworkType.Basic) {
@@ -144,11 +139,10 @@ public class VmwareServerDiscoverer extends DiscovererBase implements
Discoverer
 		VmwareContext context = null;
 		try {
 			context = VmwareContextFactory.create(url.getHost(), username, password);
+            if (privateTrafficLabel != null)
+                context.registerStockObject("privateTrafficLabel", privateTrafficLabel);
+			
             if (_vmwareMgr.getNexusVSwitchGlobalParameter()) {
-                if (_vmwareMgr.getPrivateVSwitchTypeGlobalParameter().equalsIgnoreCase("nexus"))
{
-                    if (privateTrafficLabel != null)
-                        context.registerStockObject("privateTrafficLabel", privateTrafficLabel);
-                }
                 if (vsmCredentials != null) {
                     s_logger.info("Stocking credentials of Nexus VSM");
                     context.registerStockObject("vsmcredentials", vsmCredentials);
@@ -238,95 +232,95 @@ public class VmwareServerDiscoverer extends DiscovererBase implements
Discoverer
             cluster.setGuid(UUID.nameUUIDFromBytes(String.valueOf(clusterId).getBytes()).toString());
             _clusterDao.update(clusterId, cluster);
             
-            return resources;
+            return resources;
 		} catch (DiscoveredWithErrorException e) {
 			throw e;
-		} catch (Exception e) {
-			s_logger.warn("Unable to connect to Vmware vSphere server. service address: " + url.getHost());
-			return null;
-		} finally {
-			if(context != null)
-				context.close();
-		}
-    }
-    
-    private boolean validateDiscoveredHosts(VmwareContext context, ManagedObjectReference
morCluster, List<ManagedObjectReference> morHosts) throws Exception {
-    	if(morCluster == null) {
-    		for(ManagedObjectReference morHost : morHosts) {
-    			ManagedObjectReference morParent = (ManagedObjectReference)context.getServiceUtil().getDynamicProperty(morHost,
"parent");
-    			if(morParent.getType().equalsIgnoreCase("ClusterComputeResource"))
-    				return false;
-    		}
-    	} else {
-    		for(ManagedObjectReference morHost : morHosts) {
-    			ManagedObjectReference morParent = (ManagedObjectReference)context.getServiceUtil().getDynamicProperty(morHost,
"parent");
-    			if(!morParent.getType().equalsIgnoreCase("ClusterComputeResource"))
-    				return false;
-    			
-    			if(!morParent.get_value().equals(morCluster.get_value()))
-    				return false;
-    		}
-    	}
-    	
-    	return true;
-    }
-    
-    @Override
-    public void postDiscovery(List<HostVO> hosts, long msId) {
-        // do nothing
-    }
-    
-    @Override
-	public boolean matchHypervisor(String hypervisor) {
-    	if(hypervisor == null)
-    		return true;
-    	
-    	return Hypervisor.HypervisorType.VMware.toString().equalsIgnoreCase(hypervisor);
-    }
-    
-    @Override
-	public Hypervisor.HypervisorType getHypervisorType() {
-    	return Hypervisor.HypervisorType.VMware;
-    }
-    
-    @Override
-    public boolean configure(String name, Map<String, Object> params) throws ConfigurationException
{
-        if(s_logger.isInfoEnabled())
-        	s_logger.info("Configure VmwareServerDiscoverer, discover name: " + name);
-        
-        super.configure(name, params);
-        
-        ComponentLocator locator = ComponentLocator.getCurrentLocator();
-        ConfigurationDao configDao = locator.getDao(ConfigurationDao.class);
-        if (configDao == null) {
-            throw new ConfigurationException("Unable to get the configuration dao.");
-        }
-        
-        createVmwareToolsIso();
-
-		if(s_logger.isInfoEnabled()) {
+		} catch (Exception e) {
+			s_logger.warn("Unable to connect to Vmware vSphere server. service address: " + url.getHost());
+			return null;
+		} finally {
+			if(context != null)
+				context.close();
+		}
+    }
+    
+    private boolean validateDiscoveredHosts(VmwareContext context, ManagedObjectReference
morCluster, List<ManagedObjectReference> morHosts) throws Exception {
+    	if(morCluster == null) {
+    		for(ManagedObjectReference morHost : morHosts) {
+    			ManagedObjectReference morParent = (ManagedObjectReference)context.getServiceUtil().getDynamicProperty(morHost,
"parent");
+    			if(morParent.getType().equalsIgnoreCase("ClusterComputeResource"))
+    				return false;
+    		}
+    	} else {
+    		for(ManagedObjectReference morHost : morHosts) {
+    			ManagedObjectReference morParent = (ManagedObjectReference)context.getServiceUtil().getDynamicProperty(morHost,
"parent");
+    			if(!morParent.getType().equalsIgnoreCase("ClusterComputeResource"))
+    				return false;
+    			
+    			if(!morParent.get_value().equals(morCluster.get_value()))
+    				return false;
+    		}
+    	}
+    	
+    	return true;
+    }
+    
+    @Override
+    public void postDiscovery(List<HostVO> hosts, long msId) {
+        // do nothing
+    }
+    
+    @Override
+	public boolean matchHypervisor(String hypervisor) {
+    	if(hypervisor == null)
+    		return true;
+    	
+    	return Hypervisor.HypervisorType.VMware.toString().equalsIgnoreCase(hypervisor);
+    }
+    
+    @Override
+	public Hypervisor.HypervisorType getHypervisorType() {
+    	return Hypervisor.HypervisorType.VMware;
+    }
+    
+    @Override
+    public boolean configure(String name, Map<String, Object> params) throws ConfigurationException
{
+        if(s_logger.isInfoEnabled())
+        	s_logger.info("Configure VmwareServerDiscoverer, discover name: " + name);
+        
+        super.configure(name, params);
+        
+        ComponentLocator locator = ComponentLocator.getCurrentLocator();
+        ConfigurationDao configDao = locator.getDao(ConfigurationDao.class);
+        if (configDao == null) {
+            throw new ConfigurationException("Unable to get the configuration dao.");
+        }
+        
+        createVmwareToolsIso();
+
+		if(s_logger.isInfoEnabled()) {
 			s_logger.info("VmwareServerDiscoverer has been successfully configured");
 		}
-		_resourceMgr.registerResourceStateAdapter(this.getClass().getSimpleName(), this);
-        return true;
-    }
-    
-    private void createVmwareToolsIso() {
-        String isoName = "vmware-tools.iso";
-        VMTemplateVO tmplt = _tmpltDao.findByTemplateName(isoName);
-        Long id;
-        if (tmplt == null) {
-            id = _tmpltDao.getNextInSequence(Long.class, "id");
-            VMTemplateVO template = new VMTemplateVO(id, isoName, isoName, ImageFormat.ISO,
true, true,
-                    TemplateType.PERHOST, null, null, true, 64,
-                    Account.ACCOUNT_ID_SYSTEM, null, "VMware Tools Installer ISO", false,
1, false, HypervisorType.VMware);
-            _tmpltDao.persist(template);
-        } else {
-            id = tmplt.getId();
-            tmplt.setTemplateType(TemplateType.PERHOST);
-            tmplt.setUrl(null);
-            _tmpltDao.update(id, tmplt);
-        }
+		_resourceMgr.registerResourceStateAdapter(this.getClass().getSimpleName(), this);
+        return true;
+    }
+    
+    private void createVmwareToolsIso() {
+        String isoName = "vmware-tools.iso";
+        VMTemplateVO tmplt = _tmpltDao.findByTemplateName(isoName);
+        Long id;
+        if (tmplt == null) {
+            id = _tmpltDao.getNextInSequence(Long.class, "id");
+            VMTemplateVO template = new VMTemplateVO(id, isoName, isoName, ImageFormat.ISO,
true, true,
+                    TemplateType.PERHOST, null, null, true, 64,
+                    Account.ACCOUNT_ID_SYSTEM, null, "VMware Tools Installer ISO", false,
1, false, HypervisorType.VMware);
+            _tmpltDao.persist(template);
+        } else {
+            id = tmplt.getId();
+            tmplt.setTemplateType(TemplateType.PERHOST);
+            tmplt.setUrl(null);
+            _tmpltDao.update(id, tmplt);
+        }
     }
 
 	@Override
@@ -365,6 +359,6 @@ public class VmwareServerDiscoverer extends DiscovererBase implements
Discoverer
     public boolean stop() {
     	_resourceMgr.unregisterResourceStateAdapter(this.getClass().getSimpleName());
         return super.stop();
-    }
-}
-
+    }
+}
+


Mime
View raw message