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

[45/50] git commit: CS-9919 Support for Nexus Swiches (Cisco Vswitches)

CS-9919 Support for Nexus Swiches (Cisco Vswitches)

Description:

	Retreving physical network configuration from
	database. Passing configuration down to resource.
	Cleanup.

Conflicts:

	core/src/com/cloud/hypervisor/vmware/manager/VmwareManager.java
	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/b6687faf
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/b6687faf
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/b6687faf

Branch: refs/heads/master
Commit: b6687faf89958d29fa7ab01b5f88cdb60b042ccf
Parents: 8d1b9c2
Author: Sateesh Chodapuneedi <sa...@citrix.com>
Authored: Sun May 13 03:01:22 2012 +0530
Committer: Vijayendra Bhamidipati <vi...@citrix.com>
Committed: Fri May 25 17:40:38 2012 -0700

----------------------------------------------------------------------
 .../hypervisor/vmware/manager/VmwareManager.java   |    5 +-
 .../cloud/hypervisor/vmware/VmwareManagerImpl.java |   39 +++-
 .../hypervisor/vmware/VmwareServerDiscoverer.java  |  213 +++++++++------
 .../hypervisor/vmware/mo/HypervisorHostHelper.java |   15 +-
 4 files changed, 165 insertions(+), 107 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/b6687faf/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 3d10adc..8c41340 100755
--- a/core/src/com/cloud/hypervisor/vmware/manager/VmwareManager.java
+++ b/core/src/com/cloud/hypervisor/vmware/manager/VmwareManager.java
@@ -16,7 +16,6 @@ import java.io.File;
 import java.util.List;
 import java.util.Map;
 
-//import com.cloud.cluster.CheckPointManager;
 import com.cloud.hypervisor.vmware.mo.HostMO;
 import com.cloud.hypervisor.vmware.util.VmwareContext;
 import com.cloud.utils.Pair;
@@ -62,4 +61,8 @@ public interface VmwareManager {
 	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/b6687faf/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 b7c7aba..1de43fd 100755
--- a/server/src/com/cloud/hypervisor/vmware/VmwareManagerImpl.java
+++ b/server/src/com/cloud/hypervisor/vmware/VmwareManagerImpl.java
@@ -61,7 +61,6 @@ import com.cloud.hypervisor.vmware.manager.VmwareStorageMount;
 import com.cloud.hypervisor.vmware.mo.DiskControllerType;
 import com.cloud.hypervisor.vmware.mo.HostFirewallSystemMO;
 import com.cloud.hypervisor.vmware.mo.HostMO;
-import com.cloud.hypervisor.vmware.mo.HostVirtualNicType;
 import com.cloud.hypervisor.vmware.mo.HypervisorHostHelper;
 import com.cloud.hypervisor.vmware.mo.TaskMO;
 import com.cloud.hypervisor.vmware.mo.VirtualEthernetCardType;
@@ -69,6 +68,7 @@ import com.cloud.hypervisor.vmware.mo.VmwareHostType;
 import com.cloud.hypervisor.vmware.resource.SshHelper;
 import com.cloud.hypervisor.vmware.util.VmwareContext;
 import com.cloud.network.CiscoNexusVSMDeviceVO;
+import com.cloud.network.NetworkManager;
 import com.cloud.network.dao.CiscoNexusVSMDeviceDao;
 import com.cloud.network.router.VirtualNetworkApplianceManager;
 import com.cloud.org.Cluster.ClusterType;
@@ -91,7 +91,6 @@ import com.cloud.utils.script.Script;
 import com.cloud.vm.DomainRouterVO;
 import com.google.gson.Gson;
 import com.vmware.apputils.vim25.ServiceUtil;
-import com.vmware.vim25.AboutInfo;
 import com.vmware.vim25.HostConnectSpec;
 import com.vmware.vim25.HostPortGroupSpec;
 import com.vmware.vim25.ManagedObjectReference;
@@ -110,6 +109,8 @@ public class VmwareManagerImpl implements VmwareManager, VmwareStorageMount, Lis
     private String _instance;
 
     @Inject AgentManager _agentMgr;
+    @Inject
+    protected NetworkManager _netMgr;
     @Inject HostDao _hostDao;
     @Inject ClusterDao _clusterDao;
     @Inject ClusterDetailsDao _clusterDetailsDao;
@@ -132,7 +133,7 @@ public class VmwareManagerImpl implements VmwareManager, VmwareStorageMount, Lis
     String _privateNetworkVSwitchType;
     String _publicNetworkVSwitchType;
     String _guestNetworkVSwitchType;
-    Boolean _nexusVSwitchActive;
+    boolean _nexusVSwitchActive;
     String _serviceConsoleName;
     String _managemetPortGroupName;
     String _defaultSystemVmNicAdapterType = VirtualEthernetCardType.E1000.toString();
@@ -358,6 +359,10 @@ public class VmwareManagerImpl implements VmwareManager, VmwareStorageMount, Lis
         return _name;
     }
 
+    public boolean getNexusVSwitchGlobalParameter() {
+        return _nexusVSwitchActive;
+    }
+
     @Override
     public String composeWorkerName() {
         return UUID.randomUUID().toString().replace("-", "");
@@ -367,6 +372,13 @@ public class VmwareManagerImpl implements VmwareManager, VmwareStorageMount, Lis
     public List<ManagedObjectReference> addHostToPodCluster(VmwareContext serviceContext, long dcId, Long podId, Long clusterId,
             String hostInventoryPath) throws Exception {
         ManagedObjectReference mor = serviceContext.getHostMorByPath(hostInventoryPath);
+        String privateTrafficLabel = null;
+        if (_nexusVSwitchActive) {
+            privateTrafficLabel = serviceContext.getStockObject("privateTrafficLabel");
+            if (privateTrafficLabel == null) {
+                privateTrafficLabel = _privateNetworkVSwitchName;
+            }
+        }
         if(mor != null) {
             List<ManagedObjectReference> returnedHostList = new ArrayList<ManagedObjectReference>();
 
@@ -392,12 +404,12 @@ public class VmwareManagerImpl implements VmwareManager, VmwareStorageMount, Lis
                 if(spec.getVlanId() != 0) {
                     vlanId = String.valueOf(spec.getVlanId());
                 }
-                
+
                 if(!_nexusVSwitchActive) {
                 	HypervisorHostHelper.prepareNetwork(_privateNetworkVSwitchName, "cloud.private", hostMo, vlanId, null, null, 180000, false);
                 }
                 else {
-                	HypervisorHostHelper.prepareNetwork(_privateNetworkVSwitchName, "cloud.private", hostMo, vlanId, null, null, 180000);
+                    HypervisorHostHelper.prepareNetwork(privateTrafficLabel, "cloud.private", hostMo, vlanId, null, null, 180000);
                 }
                 returnedHostList.add(hosts[0]);
                 return returnedHostList;
@@ -435,7 +447,7 @@ public class VmwareManagerImpl implements VmwareManager, VmwareStorageMount, Lis
                     	HypervisorHostHelper.prepareNetwork(_privateNetworkVSwitchName, "cloud.private", hostMo, vlanId, null, null, 180000, false);
                     }
                     else {
-                    	HypervisorHostHelper.prepareNetwork(_privateNetworkVSwitchName, "cloud.private", hostMo, vlanId, null, null, 180000);
+                        HypervisorHostHelper.prepareNetwork(privateTrafficLabel, "cloud.private", hostMo, vlanId, null, null, 180000);
                     }
                     returnedHostList.add(morHost);
                 }
@@ -464,7 +476,7 @@ public class VmwareManagerImpl implements VmwareManager, VmwareStorageMount, Lis
                 	HypervisorHostHelper.prepareNetwork(_privateNetworkVSwitchName, "cloud.private", hostMo, vlanId, null, null, 180000, false);
                 }
                 else {
-                	HypervisorHostHelper.prepareNetwork(_privateNetworkVSwitchName, "cloud.private", hostMo, vlanId, null, null, 180000);
+                    HypervisorHostHelper.prepareNetwork(privateTrafficLabel, "cloud.private", hostMo, vlanId, null, null, 180000);
                 }
                 returnedHostList.add(mor);
                 return returnedHostList;
@@ -962,4 +974,17 @@ public class VmwareManagerImpl implements VmwareManager, VmwareStorageMount, Lis
 	public int getRouterExtraPublicNics() {
 		return this._routerExtraPublicNics;
 	}
+
+    @Override
+    public Map<String, String> getNexusVSMCredentialsByClusterId(Long clusterId) {
+        ClusterVSMMapVO vsmMapVO = _vsmMapDao.findByClusterId(clusterId);
+        CiscoNexusVSMDeviceVO nexusVSM = _nexusDao.findById(vsmMapVO.getVsmId());
+        if (nexusVSM == null)
+            return null;
+        Map<String, String> nexusVSMCredentials = new HashMap<String, String>();
+        nexusVSMCredentials.put("vsmip", nexusVSM.getipaddr());
+        nexusVSMCredentials.put("vsmusername", nexusVSM.getUserName());
+        nexusVSMCredentials.put("vsmpassword", nexusVSM.getPassword());
+        return nexusVSMCredentials;
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/b6687faf/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 ee75b9e..8fd524a 100755
--- a/server/src/com/cloud/hypervisor/vmware/VmwareServerDiscoverer.java
+++ b/server/src/com/cloud/hypervisor/vmware/VmwareServerDiscoverer.java
@@ -10,7 +10,8 @@
 // limitations under the License.
 // 
 // Automatically generated by addcopyright.py at 04/03/2012
-package com.cloud.hypervisor.vmware;
+
+package com.cloud.hypervisor.vmware;
 
 import java.net.URI;
 import java.net.URLDecoder;
@@ -35,22 +36,22 @@ import com.cloud.exception.DiscoveredWithErrorException;
 import com.cloud.exception.DiscoveryException;
 import com.cloud.host.HostVO;
 import com.cloud.host.dao.HostDao;
-import com.cloud.hypervisor.Hypervisor;
-import com.cloud.hypervisor.Hypervisor.HypervisorType;
-import com.cloud.hypervisor.vmware.manager.VmwareManager;
-import com.cloud.hypervisor.vmware.mo.ClusterMO;
-import com.cloud.hypervisor.vmware.mo.HostMO;
-import com.cloud.hypervisor.vmware.resource.VmwareContextFactory;
-import com.cloud.hypervisor.vmware.resource.VmwareResource;
-import com.cloud.hypervisor.vmware.util.VmwareContext;
+import com.cloud.hypervisor.Hypervisor;
+import com.cloud.hypervisor.Hypervisor.HypervisorType;
+import com.cloud.hypervisor.vmware.manager.VmwareManager;
+import com.cloud.hypervisor.vmware.mo.ClusterMO;
+import com.cloud.hypervisor.vmware.mo.HostMO;
+import com.cloud.hypervisor.vmware.resource.VmwareContextFactory;
+import com.cloud.hypervisor.vmware.resource.VmwareResource;
+import com.cloud.hypervisor.vmware.util.VmwareContext;
+import com.cloud.network.NetworkManager;
 import com.cloud.network.dao.CiscoNexusVSMDeviceDao;
-import com.cloud.resource.Discoverer;
+import com.cloud.resource.Discoverer;
 import com.cloud.resource.DiscovererBase;
 import com.cloud.resource.ResourceManager;
 import com.cloud.resource.ResourceStateAdapter;
 import com.cloud.resource.ServerResource;
 import com.cloud.resource.UnableDeleteHostException;
-import com.cloud.resource.ResourceStateAdapter.DeleteHostAnswer;
 import com.cloud.storage.Storage.ImageFormat;
 import com.cloud.storage.Storage.TemplateType;
 import com.cloud.storage.VMTemplateVO;
@@ -61,20 +62,22 @@ import com.cloud.utils.component.ComponentLocator;
 import com.cloud.utils.component.Inject;
 import com.vmware.vim25.ClusterDasConfigInfo;
 import com.vmware.vim25.ManagedObjectReference;
-
-@Local(value=Discoverer.class)
-public class VmwareServerDiscoverer extends DiscovererBase implements Discoverer, ResourceStateAdapter {
-	private static final Logger s_logger = Logger.getLogger(VmwareServerDiscoverer.class);
-	
-	@Inject ClusterDao _clusterDao;
-	@Inject VmwareManager _vmwareMgr;
-    @Inject AlertManager _alertMgr;
+
+@Local(value=Discoverer.class)
+public class VmwareServerDiscoverer extends DiscovererBase implements Discoverer, ResourceStateAdapter {
+	private static final Logger s_logger = Logger.getLogger(VmwareServerDiscoverer.class);
+	
+	@Inject ClusterDao _clusterDao;
+	@Inject VmwareManager _vmwareMgr;
+    @Inject AlertManager _alertMgr;
     @Inject VMTemplateDao _tmpltDao;
     @Inject ClusterDetailsDao _clusterDetailsDao;
     @Inject HostDao _hostDao;
     @Inject ResourceManager _resourceMgr;
 
     @Inject CiscoNexusVSMDeviceDao _nexusDao;
+    @Inject
+    NetworkManager _netmgr;
     
     @Override
     public Map<? extends ServerResource, Map<String, String>> find(long dcId, Long podId, Long clusterId, URI url, 
@@ -102,80 +105,110 @@ public class VmwareServerDiscoverer extends DiscovererBase implements Discoverer
         	s_logger.error(msg);
         	throw new DiscoveredWithErrorException(msg);
         }
-    	
-		VmwareContext context = null;
-		try {
+
+        String privateTrafficLabel = null;
+        Map<String, String> vsmCredentials = null;
+        if (_vmwareMgr.getNexusVSwitchGlobalParameter()) {
+            // Get physical network label
+            privateTrafficLabel = _netmgr.getDefaultManagementTrafficLabel(dcId, HypervisorType.VMware);
+            if (privateTrafficLabel != null) {
+                s_logger.info("Detected private network label : " + privateTrafficLabel);
+            }
+            // Get credentials
+            vsmCredentials = _vmwareMgr.getNexusVSMCredentialsByClusterId(clusterId);
+        }
+
+		VmwareContext context = null;
+		try {
 			context = VmwareContextFactory.create(url.getHost(), username, password);
-			List<ManagedObjectReference> morHosts = _vmwareMgr.addHostToPodCluster(context, dcId, podId, clusterId,
+            if (_vmwareMgr.getNexusVSwitchGlobalParameter()) {
+                // Get physical network label
+                privateTrafficLabel = _netmgr.getDefaultManagementTrafficLabel(dcId, HypervisorType.VMware);
+                if (privateTrafficLabel != null) {
+                    context.registerStockObject("privateTrafficLabel", privateTrafficLabel);
+                    s_logger.info("Detected private network label : " + privateTrafficLabel);
+                }
+                // Get credentials
+                vsmCredentials = _vmwareMgr.getNexusVSMCredentialsByClusterId(clusterId);
+                if (vsmCredentials != null)
+                    context.registerStockObject("vsmCredentials", vsmCredentials);
+            }
+			List<ManagedObjectReference> morHosts = _vmwareMgr.addHostToPodCluster(context, dcId, podId, clusterId,
 				URLDecoder.decode(url.getPath()));
-			if(morHosts == null) {
-				s_logger.error("Unable to find host or cluster based on url: " + URLDecoder.decode(url.getPath()));
-				return null;
-			}
-			
-			ManagedObjectReference morCluster = null;
-			Map<String, String> clusterDetails = _clusterDetailsDao.findDetails(clusterId);
-			if(clusterDetails.get("url") != null) {
-				URI uriFromCluster = new URI(UriUtils.encodeURIComponent(clusterDetails.get("url")));
-				morCluster = context.getHostMorByPath(URLDecoder.decode(uriFromCluster.getPath()));
-				
-				if(morCluster == null || !morCluster.getType().equalsIgnoreCase("ClusterComputeResource")) {
-					s_logger.warn("Cluster url does not point to a valid vSphere cluster, url: " + clusterDetails.get("url"));
-					return null;
-				} else {
-					ClusterMO clusterMo = new ClusterMO(context, morCluster);
-					ClusterDasConfigInfo dasConfig = clusterMo.getDasConfig();
-					if(dasConfig != null && dasConfig.getEnabled() != null && dasConfig.getEnabled().booleanValue()) {
-						clusterDetails.put("NativeHA", "true");
-						_clusterDetailsDao.persist(clusterId, clusterDetails);
-					}
-				}
-			}
-			
-			if(!validateDiscoveredHosts(context, morCluster, morHosts)) {
-				if(morCluster == null)
-					s_logger.warn("The discovered host is not standalone host, can not be added to a standalone cluster");
-				else
-					s_logger.warn("The discovered host does not belong to the cluster");
-				return null;
-			}
-			
-            Map<VmwareResource, Map<String, String>> resources = new HashMap<VmwareResource, Map<String, String>>();
-			for(ManagedObjectReference morHost : morHosts) {
-	            Map<String, String> details = new HashMap<String, String>();
-	            Map<String, Object> params = new HashMap<String, Object>();
-	            
-	            HostMO hostMo = new HostMO(context, morHost);
-	            details.put("url", hostMo.getHostName());
-	            details.put("username", username);
-	            details.put("password", password);
-	            String guid = morHost.getType() + ":" + morHost.get_value() + "@"+ url.getHost();
-	            details.put("guid", guid);
-	            
-	            params.put("url", hostMo.getHostName());
-	            params.put("username", username);
-	            params.put("password", password);
-	            params.put("zone", Long.toString(dcId));
-	            params.put("pod", Long.toString(podId));
-	            params.put("cluster", Long.toString(clusterId));
+            if (privateTrafficLabel != null)
+                context.uregisterStockObject("privateTrafficLabel");
+
+			if(morHosts == null) {
+				s_logger.error("Unable to find host or cluster based on url: " + URLDecoder.decode(url.getPath()));
+				return null;
+			}
+			
+			ManagedObjectReference morCluster = null;
+			Map<String, String> clusterDetails = _clusterDetailsDao.findDetails(clusterId);
+			if(clusterDetails.get("url") != null) {
+				URI uriFromCluster = new URI(UriUtils.encodeURIComponent(clusterDetails.get("url")));
+				morCluster = context.getHostMorByPath(URLDecoder.decode(uriFromCluster.getPath()));
+				
+				if(morCluster == null || !morCluster.getType().equalsIgnoreCase("ClusterComputeResource")) {
+					s_logger.warn("Cluster url does not point to a valid vSphere cluster, url: " + clusterDetails.get("url"));
+					return null;
+				} else {
+					ClusterMO clusterMo = new ClusterMO(context, morCluster);
+					ClusterDasConfigInfo dasConfig = clusterMo.getDasConfig();
+					if(dasConfig != null && dasConfig.getEnabled() != null && dasConfig.getEnabled().booleanValue()) {
+						clusterDetails.put("NativeHA", "true");
+						_clusterDetailsDao.persist(clusterId, clusterDetails);
+					}
+				}
+			}
+			
+			if(!validateDiscoveredHosts(context, morCluster, morHosts)) {
+				if(morCluster == null)
+					s_logger.warn("The discovered host is not standalone host, can not be added to a standalone cluster");
+				else
+					s_logger.warn("The discovered host does not belong to the cluster");
+				return null;
+			}
+
+            Map<VmwareResource, Map<String, String>> resources = new HashMap<VmwareResource, Map<String, String>>();
+			for(ManagedObjectReference morHost : morHosts) {
+	            Map<String, String> details = new HashMap<String, String>();
+	            Map<String, Object> params = new HashMap<String, Object>();
+	            
+	            HostMO hostMo = new HostMO(context, morHost);
+	            details.put("url", hostMo.getHostName());
+	            details.put("username", username);
+	            details.put("password", password);
+	            String guid = morHost.getType() + ":" + morHost.get_value() + "@"+ url.getHost();
+	            details.put("guid", guid);
+	            
+	            params.put("url", hostMo.getHostName());
+	            params.put("username", username);
+	            params.put("password", password);
+	            params.put("zone", Long.toString(dcId));
+	            params.put("pod", Long.toString(podId));
+	            params.put("cluster", Long.toString(clusterId));
 	            params.put("guid", guid);
-	            
-	            VmwareResource resource = new VmwareResource(); 
-	            try {
-	                resource.configure("VMware", params);
-	            } catch (ConfigurationException e) {
-	                _alertMgr.sendAlert(AlertManager.ALERT_TYPE_HOST, dcId, podId, "Unable to add " + url.getHost(), "Error is " + e.getMessage());
-	                s_logger.warn("Unable to instantiate " + url.getHost(), e);
-	            }
-	            resource.start();
-	            
-	            resources.put(resource, details);
-			}
-            
-            // place a place holder guid derived from cluster ID
-            cluster.setGuid(UUID.nameUUIDFromBytes(String.valueOf(clusterId).getBytes()).toString());
-            _clusterDao.update(clusterId, cluster);
-            
+                if (privateTrafficLabel != null) {
+                    params.put("private.network.vswitch.name", privateTrafficLabel);
+                }
+	            
+	            VmwareResource resource = new VmwareResource(); 
+	            try {
+	                resource.configure("VMware", params);
+	            } catch (ConfigurationException e) {
+	                _alertMgr.sendAlert(AlertManager.ALERT_TYPE_HOST, dcId, podId, "Unable to add " + url.getHost(), "Error is " + e.getMessage());
+	                s_logger.warn("Unable to instantiate " + url.getHost(), e);
+	            }
+	            resource.start();
+	            
+	            resources.put(resource, details);
+			}
+            
+            // place a place holder guid derived from cluster ID
+            cluster.setGuid(UUID.nameUUIDFromBytes(String.valueOf(clusterId).getBytes()).toString());
+            _clusterDao.update(clusterId, cluster);
+            
             return resources;
 		} catch (DiscoveredWithErrorException e) {
 			throw e;

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/b6687faf/vmware-base/src/com/cloud/hypervisor/vmware/mo/HypervisorHostHelper.java
----------------------------------------------------------------------
diff --git a/vmware-base/src/com/cloud/hypervisor/vmware/mo/HypervisorHostHelper.java b/vmware-base/src/com/cloud/hypervisor/vmware/mo/HypervisorHostHelper.java
index a5d90cf..160c4e7 100755
--- a/vmware-base/src/com/cloud/hypervisor/vmware/mo/HypervisorHostHelper.java
+++ b/vmware-base/src/com/cloud/hypervisor/vmware/mo/HypervisorHostHelper.java
@@ -20,7 +20,6 @@ import java.util.List;
 import java.util.Map;
 
 import org.apache.log4j.Logger;
-import org.mortbay.jetty.servlet.Context;
 
 import com.cloud.hypervisor.vmware.util.VmwareContext;
 import com.cloud.hypervisor.vmware.util.VmwareHelper;
@@ -35,10 +34,8 @@ import com.cloud.utils.db.GlobalLock;
 import com.cloud.utils.exception.CloudRuntimeException;
 import com.cloud.utils.net.NetUtils;
 import com.vmware.vim25.BoolPolicy;
-import com.vmware.vim25.DVPortgroupConfigSpec;
-import com.vmware.vim25.DVSTrafficShapingPolicy;
-//import com.vmware.vim25.DistributedVirtualSwitchKeyedOpaqueBlob;
 import com.vmware.vim25.DVPortgroupConfigInfo;
+import com.vmware.vim25.DVSTrafficShapingPolicy;
 import com.vmware.vim25.DynamicProperty;
 import com.vmware.vim25.HostNetworkTrafficShapingPolicy;
 import com.vmware.vim25.HostPortGroupSpec;
@@ -130,7 +127,7 @@ public class HypervisorHostHelper {
 		return sb.toString();
 	}
 	
-	public static Map<String, String> getValidatedVsmCredentials(VmwareContext context) throws Exception, CloudRuntimeException {
+    public static Map<String, String> getValidatedVsmCredentials(VmwareContext context) throws Exception {
 		Map<String, String> vsmCredentials = context.getStockObject("vsmcredentials");
 		String msg;
 		if(vsmCredentials == null || vsmCredentials.size() != 3) {
@@ -145,12 +142,12 @@ public class HypervisorHostHelper {
 		if(vsmIp == null || vsmIp.isEmpty() || vsmUserName == null || vsmUserName.isEmpty() || vsmPassword == null || vsmPassword.isEmpty()) {
 			msg = "Detected invalid credentials for Nexus VSM";
 			s_logger.error(msg);
-			throw new CloudRuntimeException(msg);
+            throw new Exception(msg);
 		}
 		return vsmCredentials;
 	}
 	
-	public static void createPortProfile(VmwareContext context, String ethPortProfileName, String networkName, Integer vid, Integer networkRateMbps) throws Exception, CloudRuntimeException {
+    public static void createPortProfile(VmwareContext context, String ethPortProfileName, String networkName, Integer vid, Integer networkRateMbps) throws Exception {
 		Map<String, String> vsmCredentials = getValidatedVsmCredentials(context);
 		String vsmIp = vsmCredentials.get("vsmip");
 		String vsmUserName = vsmCredentials.get("vsmusername");
@@ -187,7 +184,7 @@ public class HypervisorHostHelper {
 		}
 	}
 	
-	public static void updatePortProfile(VmwareContext context, String ethPortProfileName, Integer vid, Integer networkRateMbps) throws CloudRuntimeException, Exception {
+    public static void updatePortProfile(VmwareContext context, String ethPortProfileName, Integer vid, Integer networkRateMbps) throws Exception {
 		Map<String, String> vsmCredentials = getValidatedVsmCredentials(context);
 		String vsmIp = vsmCredentials.get("vsmip");
 		String vsmUserName = vsmCredentials.get("vsmusername");
@@ -218,7 +215,7 @@ public class HypervisorHostHelper {
 	
 	public static Pair<ManagedObjectReference, String> prepareNetwork(String ethPortProfileName, String namePrefix,
             HostMO hostMo, String vlanId, Integer networkRateMbps, Integer networkRateMulticastMbps, 
-            long timeOutMs) throws Exception, CloudRuntimeException {		
+            long timeOutMs) throws Exception {
 		ManagedObjectReference morNetwork = null;
 		VmwareContext context = hostMo.getContext();
 		ManagedObjectReference dcMor = hostMo.getHyperHostDatacenter();