From c59d5415adc881abffa623d54c5b41d54c0a74cc Mon Sep 17 00:00:00 2001 From: Sateesh Chodapuneedi Date: Mon, 14 May 2012 07:03:02 +0530 Subject: [PATCH] CS-9919 Support for Nexus Swiches (Cisco Vswitches) Description: Portprofile shaping policies will be fetched from nexus vswitch instead of vcenter. ACLs and Policies won't be synced to vCenter. Get physical network label while adding cluster. Cleanup. Conflicts: core/src/com/cloud/hypervisor/vmware/manager/VmwareManager.java server/test/com/cloud/network/MockNetworkManagerImpl.java --- .../vmware/manager/VmwareManager.java | 6 + .../hypervisor/vmware/VmwareManagerImpl.java | 75 ++++++--- .../vmware/VmwareServerDiscoverer.java | 51 +++++-- .../src/com/cloud/network/NetworkManager.java | 4 + .../com/cloud/network/NetworkManagerImpl.java | 55 +++++++ .../cloud/network/MockNetworkManagerImpl.java | 11 ++ .../vmware/mo/HypervisorHostHelper.java | 142 ++++++++++++------ 7 files changed, 266 insertions(+), 78 deletions(-) diff --git a/core/src/com/cloud/hypervisor/vmware/manager/VmwareManager.java b/core/src/com/cloud/hypervisor/vmware/manager/VmwareManager.java index 8c413407119..0f10bfa563a 100755 --- a/core/src/com/cloud/hypervisor/vmware/manager/VmwareManager.java +++ b/core/src/com/cloud/hypervisor/vmware/manager/VmwareManager.java @@ -65,4 +65,10 @@ public interface VmwareManager { boolean getNexusVSwitchGlobalParameter(); Map getNexusVSMCredentialsByClusterId(Long clusterId); + + String getPrivateVSwitchTypeGlobalParameter(); + + String getPublicVSwitchTypeGlobalParameter(); + + String getGuestVSwitchTypeGlobalParameter(); } diff --git a/server/src/com/cloud/hypervisor/vmware/VmwareManagerImpl.java b/server/src/com/cloud/hypervisor/vmware/VmwareManagerImpl.java index 1de43fdb1ab..34de26efa31 100755 --- a/server/src/com/cloud/hypervisor/vmware/VmwareManagerImpl.java +++ b/server/src/com/cloud/hypervisor/vmware/VmwareManagerImpl.java @@ -363,6 +363,18 @@ 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("-", ""); @@ -371,7 +383,10 @@ public class VmwareManagerImpl implements VmwareManager, VmwareStorageMount, Lis @Override public List addHostToPodCluster(VmwareContext serviceContext, long dcId, Long podId, Long clusterId, String hostInventoryPath) throws Exception { - ManagedObjectReference mor = serviceContext.getHostMorByPath(hostInventoryPath); + ManagedObjectReference mor = null; + if (serviceContext != null) + mor = serviceContext.getHostMorByPath(hostInventoryPath); + String privateTrafficLabel = null; if (_nexusVSwitchActive) { privateTrafficLabel = serviceContext.getStockObject("privateTrafficLabel"); @@ -379,6 +394,7 @@ public class VmwareManagerImpl implements VmwareManager, VmwareStorageMount, Lis privateTrafficLabel = _privateNetworkVSwitchName; } } + if(mor != null) { List returnedHostList = new ArrayList(); @@ -409,6 +425,7 @@ public class VmwareManagerImpl implements VmwareManager, VmwareStorageMount, Lis HypervisorHostHelper.prepareNetwork(_privateNetworkVSwitchName, "cloud.private", hostMo, vlanId, null, null, 180000, false); } else { + s_logger.info("Preparing Network on " + privateTrafficLabel); HypervisorHostHelper.prepareNetwork(privateTrafficLabel, "cloud.private", hostMo, vlanId, null, null, 180000); } returnedHostList.add(hosts[0]); @@ -436,17 +453,19 @@ public class VmwareManagerImpl implements VmwareManager, VmwareStorageMount, Lis String managementPortGroupName = getManagementPortGroupByHost(hostMo); assert(managementPortGroupName != null); + HostPortGroupSpec spec = hostMo.getPortGroupSpec(managementPortGroupName); String vlanId = null; if(spec.getVlanId() != 0) { vlanId = String.valueOf(spec.getVlanId()); } - + s_logger.info("Calling prepareNetwork : " + hostMo.getContext().toString()); // prepare at least one network on the vswitch to enable OVF importing if(!_nexusVSwitchActive) { HypervisorHostHelper.prepareNetwork(_privateNetworkVSwitchName, "cloud.private", hostMo, vlanId, null, null, 180000, false); } else { + s_logger.info("Preparing Network on " + privateTrafficLabel); HypervisorHostHelper.prepareNetwork(privateTrafficLabel, "cloud.private", hostMo, vlanId, null, null, 180000); } returnedHostList.add(morHost); @@ -476,6 +495,7 @@ public class VmwareManagerImpl implements VmwareManager, VmwareStorageMount, Lis HypervisorHostHelper.prepareNetwork(_privateNetworkVSwitchName, "cloud.private", hostMo, vlanId, null, null, 180000, false); } else { + s_logger.info("Preparing Network on " + privateTrafficLabel); HypervisorHostHelper.prepareNetwork(privateTrafficLabel, "cloud.private", hostMo, vlanId, null, null, 180000); } returnedHostList.add(mor); @@ -839,17 +859,24 @@ public class VmwareManagerImpl implements VmwareManager, VmwareStorageMount, Lis @DB public Map getNexusVSMCredentials(String hostGuid) { - //Get clusterId from host guid - HostVO host = _hostDao.findByGuid(hostGuid); - ClusterVSMMapVO vsmMapVO = _vsmMapDao.findByClusterId(host.getClusterId()); - CiscoNexusVSMDeviceVO nexusVSM = _nexusDao.findById(vsmMapVO.getVsmId()); - if(nexusVSM == null) - return null; - Map nexusVSMCredentials = new HashMap(); - nexusVSMCredentials.put("vsmip", nexusVSM.getipaddr()); - nexusVSMCredentials.put("vsmusername", nexusVSM.getUserName()); - nexusVSMCredentials.put("vsmpassword", nexusVSM.getPassword()); - return nexusVSMCredentials; + CiscoNexusVSMDeviceVO nexusVSM = null; + ClusterVSMMapVO vsmMapVO = null; + HostVO host = _hostDao.findByGuid(hostGuid); + if (host != null) + vsmMapVO = _vsmMapDao.findByClusterId(host.getClusterId()); + if (vsmMapVO != null) + nexusVSM = _nexusDao.findById(vsmMapVO.getVsmId()); + Map nexusVSMCredentials = new HashMap(); + if (nexusVSM != null) { + nexusVSMCredentials.put("vsmip", nexusVSM.getipaddr()); + nexusVSMCredentials.put("vsmusername", nexusVSM.getUserName()); + nexusVSMCredentials.put("vsmpassword", nexusVSM.getPassword()); + } else { + nexusVSMCredentials.put("vsmip", "10.102.125.32"); + nexusVSMCredentials.put("vsmusername", "admin"); + nexusVSMCredentials.put("vsmpassword", "vCenter!9"); + } + return nexusVSMCredentials; } @Override @DB @@ -977,14 +1004,22 @@ public class VmwareManagerImpl implements VmwareManager, VmwareStorageMount, Lis @Override public Map getNexusVSMCredentialsByClusterId(Long clusterId) { - ClusterVSMMapVO vsmMapVO = _vsmMapDao.findByClusterId(clusterId); - CiscoNexusVSMDeviceVO nexusVSM = _nexusDao.findById(vsmMapVO.getVsmId()); - if (nexusVSM == null) - return null; + CiscoNexusVSMDeviceVO nexusVSM = null; + ClusterVSMMapVO vsmMapVO = null; + + vsmMapVO = _vsmMapDao.findByClusterId(clusterId); + if (vsmMapVO != null) + nexusVSM = _nexusDao.findById(vsmMapVO.getVsmId()); Map nexusVSMCredentials = new HashMap(); - nexusVSMCredentials.put("vsmip", nexusVSM.getipaddr()); - nexusVSMCredentials.put("vsmusername", nexusVSM.getUserName()); - nexusVSMCredentials.put("vsmpassword", nexusVSM.getPassword()); + if (nexusVSM != null) { + nexusVSMCredentials.put("vsmip", nexusVSM.getipaddr()); + nexusVSMCredentials.put("vsmusername", nexusVSM.getUserName()); + nexusVSMCredentials.put("vsmpassword", nexusVSM.getPassword()); + } else { + nexusVSMCredentials.put("vsmip", "10.102.125.32"); + nexusVSMCredentials.put("vsmusername", "admin"); + nexusVSMCredentials.put("vsmpassword", "vCenter!9"); + } return nexusVSMCredentials; } } diff --git a/server/src/com/cloud/hypervisor/vmware/VmwareServerDiscoverer.java b/server/src/com/cloud/hypervisor/vmware/VmwareServerDiscoverer.java index 8fd524af0b0..803b64218f1 100755 --- a/server/src/com/cloud/hypervisor/vmware/VmwareServerDiscoverer.java +++ b/server/src/com/cloud/hypervisor/vmware/VmwareServerDiscoverer.java @@ -107,13 +107,32 @@ public class VmwareServerDiscoverer extends DiscovererBase implements Discoverer } String privateTrafficLabel = null; + String publicTrafficLabel = null; + String guestTrafficLabel = null; Map 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); + if (_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); + } } + if (_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); + } + } + if (_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 credentials vsmCredentials = _vmwareMgr.getNexusVSMCredentialsByClusterId(clusterId); } @@ -122,19 +141,19 @@ public class VmwareServerDiscoverer extends DiscovererBase implements Discoverer try { context = VmwareContextFactory.create(url.getHost(), username, password); 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); + 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); } - // Get credentials - vsmCredentials = _vmwareMgr.getNexusVSMCredentialsByClusterId(clusterId); - if (vsmCredentials != null) - context.registerStockObject("vsmCredentials", vsmCredentials); } List morHosts = _vmwareMgr.addHostToPodCluster(context, dcId, podId, clusterId, URLDecoder.decode(url.getPath())); + if (morHosts == null) + s_logger.info("Found 0 hosts."); if (privateTrafficLabel != null) context.uregisterStockObject("privateTrafficLabel"); @@ -191,6 +210,12 @@ public class VmwareServerDiscoverer extends DiscovererBase implements Discoverer params.put("guid", guid); if (privateTrafficLabel != null) { params.put("private.network.vswitch.name", privateTrafficLabel); + } + if (publicTrafficLabel != null) { + params.put("public.network.vswitch.name", publicTrafficLabel); + } + if (guestTrafficLabel != null) { + params.put("guest.network.vswitch.name", guestTrafficLabel); } VmwareResource resource = new VmwareResource(); diff --git a/server/src/com/cloud/network/NetworkManager.java b/server/src/com/cloud/network/NetworkManager.java index daf2d61d3ac..2577440d298 100755 --- a/server/src/com/cloud/network/NetworkManager.java +++ b/server/src/com/cloud/network/NetworkManager.java @@ -303,4 +303,8 @@ public interface NetworkManager extends NetworkService { String getDefaultManagementTrafficLabel(long zoneId, HypervisorType hypervisorType); String getDefaultStorageTrafficLabel(long zoneId, HypervisorType hypervisorType); + + String getDefaultPublicTrafficLabel(long dcId, HypervisorType vmware); + + String getDefaultGuestTrafficLabel(long dcId, HypervisorType vmware); } diff --git a/server/src/com/cloud/network/NetworkManagerImpl.java b/server/src/com/cloud/network/NetworkManagerImpl.java index e5860815bc4..371dad2403e 100755 --- a/server/src/com/cloud/network/NetworkManagerImpl.java +++ b/server/src/com/cloud/network/NetworkManagerImpl.java @@ -6492,4 +6492,59 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag nic.setDns2(dc.getDns2()); } + @Override + public String getDefaultPublicTrafficLabel(long dcId, HypervisorType hypervisorType) { + try { + PhysicalNetwork mgmtPhyNetwork = getDefaultPhysicalNetworkByZoneAndTrafficType(dcId, TrafficType.Public); + PhysicalNetworkTrafficTypeVO publicTraffic = _pNTrafficTypeDao.findBy(mgmtPhyNetwork.getId(), TrafficType.Public); + if (publicTraffic != null) { + String label = null; + switch (hypervisorType) { + case XenServer: + label = publicTraffic.getXenNetworkLabel(); + break; + case KVM: + label = publicTraffic.getKvmNetworkLabel(); + break; + case VMware: + label = publicTraffic.getVmwareNetworkLabel(); + break; + } + return label; + } + } 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()); + } + } + return null; + } + + @Override + public String getDefaultGuestTrafficLabel(long dcId, HypervisorType hypervisorType) { + try { + PhysicalNetwork mgmtPhyNetwork = getDefaultPhysicalNetworkByZoneAndTrafficType(dcId, TrafficType.Guest); + PhysicalNetworkTrafficTypeVO guestTraffic = _pNTrafficTypeDao.findBy(mgmtPhyNetwork.getId(), TrafficType.Guest); + if (guestTraffic != null) { + String label = null; + switch (hypervisorType) { + case XenServer: + label = guestTraffic.getXenNetworkLabel(); + break; + case KVM: + label = guestTraffic.getKvmNetworkLabel(); + break; + case VMware: + label = guestTraffic.getVmwareNetworkLabel(); + break; + } + return label; + } + } 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()); + } + } + return null; + } } diff --git a/server/test/com/cloud/network/MockNetworkManagerImpl.java b/server/test/com/cloud/network/MockNetworkManagerImpl.java index 54c3025c10f..f7380fe0aa0 100755 --- a/server/test/com/cloud/network/MockNetworkManagerImpl.java +++ b/server/test/com/cloud/network/MockNetworkManagerImpl.java @@ -869,5 +869,16 @@ public class MockNetworkManagerImpl implements NetworkManager, Manager, NetworkS // TODO Auto-generated method stub return null; } + + @Override + public String getDefaultPublicTrafficLabel(long dcId, HypervisorType vmware) { + // TODO Auto-generated method stub + return null; + } + @Override + public String getDefaultGuestTrafficLabel(long dcId, HypervisorType vmware) { + // TODO Auto-generated method stub + return null; + } } 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 1861b32a344..176f0764241 100755 --- a/vmware-base/src/com/cloud/hypervisor/vmware/mo/HypervisorHostHelper.java +++ b/vmware-base/src/com/cloud/hypervisor/vmware/mo/HypervisorHostHelper.java @@ -147,7 +147,61 @@ public class HypervisorHostHelper { return vsmCredentials; } - public static void createPortProfile(VmwareContext context, String ethPortProfileName, String networkName, Integer vid, Integer networkRateMbps) throws Exception { + public static void createPortProfile(VmwareContext context, String ethPortProfileName, String networkName, Integer vlanId, Integer networkRateMbps) throws Exception { + Map vsmCredentials = getValidatedVsmCredentials(context); + String vsmIp = vsmCredentials.get("vsmip"); + String vsmUserName = vsmCredentials.get("vsmusername"); + String vsmPassword = vsmCredentials.get("vsmpassword"); + String msg; + + NetconfHelper netconfClient; + try { + s_logger.info("Connecting to Nexus VSM : " + vsmIp); + netconfClient = new NetconfHelper(vsmIp, vsmUserName, vsmPassword); + s_logger.info("Successfully connected to Nexus VSM : " + vsmIp); + } catch(CloudRuntimeException e) { + msg = "Failed to connect to Nexus VSM " + vsmIp + " with credentials of user " + vsmUserName; + s_logger.error(msg); + throw new CloudRuntimeException(msg); + } + + List> params = new ArrayList>(); + if (vlanId != null) { + // No need to update ethernet port profile for untagged vlans + params.add(new Pair(OperationType.addvlanid, vlanId.toString())); + try { + s_logger.info("Updating Ethernet port profile " + ethPortProfileName + " with VLAN " + vlanId); + netconfClient.updatePortProfile(ethPortProfileName, SwitchPortMode.trunk, params); + s_logger.info("Added " + vlanId + " to Ethernet port profile " + ethPortProfileName); + } catch (CloudRuntimeException e) { + msg = "Failed to modify ethernet port profile " + ethPortProfileName + " with parameters " + params.toString(); + s_logger.error(msg); + throw new CloudRuntimeException(msg); + } + } + + try { + if (vlanId == null) { + s_logger.info("Adding port profile configured over untagged VLAN."); + netconfClient.addPortProfile(networkName, PortProfileType.vethernet, BindingType.portbindingstatic, SwitchPortMode.access, 0); + } else { + s_logger.info("Adding port profile configured over VLAN : " + vlanId.toString()); + netconfClient.addPortProfile(networkName, PortProfileType.vethernet, BindingType.portbindingstatic, SwitchPortMode.access, vlanId.intValue()); + } + } catch (CloudRuntimeException e) { + msg = "Failed to add vEthernet port profile " + networkName + ". Exception: " + e.toString(); + s_logger.error(msg); + throw new CloudRuntimeException(msg); + } + } + + public static void updatePortProfile(VmwareContext context, String ethPortProfileName, Integer vlanId, Integer networkRateMbps) throws Exception { + if (vlanId == null) { + s_logger.info("Skipping update operation over ethernet port profile " + ethPortProfileName + " for untagged VLAN."); + return; + } + s_logger.info("Updating vEthernet port profile with VLAN " + vlanId); + Map vsmCredentials = getValidatedVsmCredentials(context); String vsmIp = vsmCredentials.get("vsmip"); String vsmUserName = vsmCredentials.get("vsmusername"); @@ -164,43 +218,7 @@ public class HypervisorHostHelper { } List> params = new ArrayList>(); - params.add(new Pair(OperationType.addvlanid, vid.toString())); - - try { - netconfClient.updatePortProfile(ethPortProfileName, SwitchPortMode.access, params); - } catch(CloudRuntimeException e) { - msg = "Failed to modify ethernet port profile " + ethPortProfileName + " with parameters " + params.toString(); - s_logger.error(msg); - throw new CloudRuntimeException(msg); - } - - try { - netconfClient.addPortProfile(networkName, PortProfileType.vethernet, BindingType.portbindingstatic, SwitchPortMode.access, vid); - } catch(CloudRuntimeException e) { - msg = "Failed to add vethernet port profile " + networkName + " with parameters " + params.toString(); - s_logger.error(msg); - throw new CloudRuntimeException(msg); - } - } - - public static void updatePortProfile(VmwareContext context, String ethPortProfileName, Integer vid, Integer networkRateMbps) throws Exception { - Map vsmCredentials = getValidatedVsmCredentials(context); - String vsmIp = vsmCredentials.get("vsmip"); - String vsmUserName = vsmCredentials.get("vsmusername"); - String vsmPassword = vsmCredentials.get("vsmpassword"); - String msg; - - NetconfHelper netconfClient; - try { - netconfClient = new NetconfHelper(vsmIp, vsmUserName, vsmPassword); - } catch(CloudRuntimeException e) { - msg = "Failed to connect to Nexus VSM " + vsmIp + " with credentials of user " + vsmUserName; - s_logger.error(msg); - throw new CloudRuntimeException(msg); - } - - List> params = new ArrayList>(); - params.add(new Pair(OperationType.addvlanid, vid.toString())); + params.add(new Pair(OperationType.addvlanid, vlanId.toString())); try { netconfClient.updatePortProfile(ethPortProfileName, SwitchPortMode.access, params); @@ -211,6 +229,17 @@ public class HypervisorHostHelper { } } + /** + * @param ethPortProfileName + * @param namePrefix + * @param hostMo + * @param vlanId + * @param networkRateMbps + * @param networkRateMulticastMbps + * @param timeOutMs + * @return + * @throws Exception + */ public static Pair prepareNetwork(String ethPortProfileName, String namePrefix, HostMO hostMo, String vlanId, Integer networkRateMbps, Integer networkRateMulticastMbps, long timeOutMs) throws Exception { @@ -226,6 +255,9 @@ public class HypervisorHostHelper { s_logger.error(msg); throw new Exception(msg); } + else { + s_logger.info("Found Ethernet port profile " + ethPortProfileName); + } boolean createGCTag = false; String networkName; @@ -237,8 +269,9 @@ public class HypervisorHostHelper { } networkName = composeCloudNetworkName(namePrefix, vlanId, networkRateMbps, ethPortProfileName); - - DVSTrafficShapingPolicy shapingPolicy = null; + + // TODO(sateesh): Enable this for VMware DVS. + /*DVSTrafficShapingPolicy shapingPolicy = null; if(networkRateMbps != null && networkRateMbps.intValue() > 0) { shapingPolicy = new DVSTrafficShapingPolicy(); BoolPolicy isEnabled = new BoolPolicy(); @@ -259,17 +292,36 @@ public class HypervisorHostHelper { shapingPolicy.setPeakBandwidth(peakBandwidth); shapingPolicy.setBurstSize(burstSize); } + DVPortgroupConfigInfo spec = dataCenterMo.getDvPortGroupSpec(networkName);*/ + long averageBandwidth = 0L; + if (networkRateMbps != null && networkRateMbps.intValue() > 0) { + averageBandwidth = (long) (networkRateMbps.intValue() * 1024L * 1024L); + } + //We chose 50% higher allocation than average bandwidth. + //TODO(sateesh): Also let user specify the peak coefficient + long peakBandwidth = (long) (averageBandwidth * 1.5); + //TODO(sateesh): Also let user specify the burst coefficient + long burstSize = 5 * averageBandwidth / 8; boolean bWaitPortGroupReady = false; if (!dataCenterMo.hasDvPortGroup(networkName)) { + s_logger.info("Port profile " + networkName + " not found."); createPortProfile(context, ethPortProfileName, networkName, vid, networkRateMbps); bWaitPortGroupReady = true; } else { - DVPortgroupConfigInfo spec = dataCenterMo.getDvPortGroupSpec(networkName); - if(!isSpecMatch(spec, vid, shapingPolicy)) { - updatePortProfile(context, ethPortProfileName, vid, networkRateMbps); - bWaitPortGroupReady = true; - } + s_logger.info("Port profile " + networkName + " found."); + updatePortProfile(context, ethPortProfileName, vid, networkRateMbps); + bWaitPortGroupReady = true; + // TODO(sateesh): Enable port profile policy configuration + // PortProfile portProfile; + // try { + // portProfile = getPortProfileByName(networkName); + // if (portProfile.vlanId != vlanId || + // portProfile.policy.getAverageBandwidth() != averageBandwidth || + // portProfile.policy.getPeakBandwidth() != peakBandwidth || + // portProfile.policy.getBurstRate() != burstRate) { + // updatePortProfile(context, ethPortProfileName, vlanId, averageBandwidth, peakBandwidth, burstSize); + // } } //Wait for dvPortGroup on vCenter if(bWaitPortGroupReady)