Return-Path: X-Original-To: apmail-incubator-cloudstack-commits-archive@minotaur.apache.org Delivered-To: apmail-incubator-cloudstack-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 398B1D6A6 for ; Mon, 4 Mar 2013 13:43:07 +0000 (UTC) Received: (qmail 84483 invoked by uid 500); 4 Mar 2013 13:43:05 -0000 Delivered-To: apmail-incubator-cloudstack-commits-archive@incubator.apache.org Received: (qmail 84414 invoked by uid 500); 4 Mar 2013 13:43:05 -0000 Mailing-List: contact cloudstack-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: cloudstack-dev@incubator.apache.org Delivered-To: mailing list cloudstack-commits@incubator.apache.org Received: (qmail 82628 invoked by uid 99); 4 Mar 2013 13:43:01 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 04 Mar 2013 13:43:01 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id AEA76314549; Mon, 4 Mar 2013 13:43:00 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: tsp@apache.org To: cloudstack-commits@incubator.apache.org X-Mailer: ASF-Git Admin Mailer Subject: [34/44] git commit: refs/heads/marvin-refactor - In basic zone, skip checks for physical network configuration with multiple virtual switches. Message-Id: <20130304134300.AEA76314549@tyr.zones.apache.org> Date: Mon, 4 Mar 2013 13:43:00 +0000 (UTC) In basic zone, skip checks for physical network configuration with multiple virtual switches. Signed-off-by: Sateesh Chodapuneedi Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/7c52d7d1 Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/7c52d7d1 Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/7c52d7d1 Branch: refs/heads/marvin-refactor Commit: 7c52d7d1c92e57335958cd43f5185481043eb1aa Parents: 6a1ecae Author: Sateesh Chodapuneedi Authored: Sun Mar 3 08:22:40 2013 +0530 Committer: Sateesh Chodapuneedi Committed: Sun Mar 3 08:22:40 2013 +0530 ---------------------------------------------------------------------- .../hypervisor/vmware/VmwareServerDiscoverer.java | 75 +++++++++------ 1 files changed, 45 insertions(+), 30 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7c52d7d1/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareServerDiscoverer.java ---------------------------------------------------------------------- diff --git a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareServerDiscoverer.java b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareServerDiscoverer.java index 90fe461..e6d708c 100755 --- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareServerDiscoverer.java +++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareServerDiscoverer.java @@ -159,10 +159,12 @@ public class VmwareServerDiscoverer extends DiscovererBase implements VmwareTrafficLabel guestTrafficLabelObj = new VmwareTrafficLabel(TrafficType.Guest); VmwareTrafficLabel publicTrafficLabelObj = new VmwareTrafficLabel(TrafficType.Public); Map clusterDetails = _clusterDetailsDao.findDetails(clusterId); + DataCenterVO zone = _dcDao.findById(dcId); + NetworkType zoneType = zone.getNetworkType(); _readGlobalConfigParameters(); // Set default physical network end points for public and guest traffic - // Private traffic will be only on standard vSwitch for now. See below TODO. + // Private traffic will be only on standard vSwitch for now. if (useDVS) { // Parse url parameters for type of vswitch and name of vswitch specified at cluster level paramGuestVswitchType = _urlParams.get(ApiConstants.VSWITCH_TYPE_GUEST_TRAFFIC); @@ -171,13 +173,6 @@ public class VmwareServerDiscoverer extends DiscovererBase implements paramPublicVswitchName = _urlParams.get(ApiConstants.VSWITCH_NAME_PUBLIC_TRAFFIC); defaultVirtualSwitchType = getDefaultVirtualSwitchType(); } - // Get zone wide traffic labels for Guest traffic and Public traffic - guestTrafficLabel = _netmgr.getDefaultGuestTrafficLabel(dcId, HypervisorType.VMware); - publicTrafficLabel = _netmgr.getDefaultPublicTrafficLabel(dcId, HypervisorType.VMware); - - // Process traffic label information provided at zone level and cluster level - guestTrafficLabelObj = getTrafficInfo(TrafficType.Guest, guestTrafficLabel, defaultVirtualSwitchType, paramGuestVswitchType, paramGuestVswitchName, clusterId); - publicTrafficLabelObj = getTrafficInfo(TrafficType.Public, publicTrafficLabel, defaultVirtualSwitchType, paramPublicVswitchType, paramPublicVswitchName, clusterId); // Zone level vSwitch Type depends on zone level traffic labels // @@ -196,28 +191,50 @@ public class VmwareServerDiscoverer extends DiscovererBase implements // 'vmwaresvs' is for vmware standard vswitch // 'vmwaredvs' is for vmware distributed virtual switch // 'nexusdvs' is for cisco nexus distributed virtual switch + // Get zone wide traffic labels for Guest traffic and Public traffic + guestTrafficLabel = _netmgr.getDefaultGuestTrafficLabel(dcId, HypervisorType.VMware); - // Configuration Check: A physical network cannot be shared by different types of virtual switches. - // - // Check if different vswitch types are chosen for same physical network - // 1. Get physical network for guest traffic - multiple networks - // 2. Get physical network for public traffic - single network - // See if 2 is in 1 - // if no - pass - // if yes - compare publicTrafficLabelObj.getVirtualSwitchType() == guestTrafficLabelObj.getVirtualSwitchType() - // true - pass - // false - throw exception - fail cluster add operation - List pNetworkListGuestTraffic = _netmgr.getPhysicalNtwksSupportingTrafficType(dcId, TrafficType.Guest); - List pNetworkListPublicTraffic = _netmgr.getPhysicalNtwksSupportingTrafficType(dcId, TrafficType.Public); - // Public network would be on single physical network hence getting first object of the list would suffice. - PhysicalNetwork pNetworkPublic = pNetworkListPublicTraffic.get(0); - if (pNetworkListGuestTraffic.contains(pNetworkPublic)) { - if (publicTrafficLabelObj.getVirtualSwitchType() != guestTrafficLabelObj.getVirtualSwitchType()) { - String msg = "Both public traffic and guest traffic is over same physical network " + pNetworkPublic + - ". And virtual switch type chosen for each traffic is different" + - ". A physical network cannot be shared by different types of virtual switches."; + // Process traffic label information provided at zone level and cluster level + guestTrafficLabelObj = getTrafficInfo(TrafficType.Guest, guestTrafficLabel, defaultVirtualSwitchType, paramGuestVswitchType, paramGuestVswitchName, clusterId); + + if (zoneType == NetworkType.Advanced) { + // Get zone wide traffic label for Public traffic + publicTrafficLabel = _netmgr.getDefaultPublicTrafficLabel(dcId, HypervisorType.VMware); + + // Process traffic label information provided at zone level and cluster level + publicTrafficLabelObj = getTrafficInfo(TrafficType.Public, publicTrafficLabel, defaultVirtualSwitchType, paramPublicVswitchType, paramPublicVswitchName, clusterId); + + // Configuration Check: A physical network cannot be shared by different types of virtual switches. + // + // Check if different vswitch types are chosen for same physical network + // 1. Get physical network for guest traffic - multiple networks + // 2. Get physical network for public traffic - single network + // See if 2 is in 1 + // if no - pass + // if yes - compare publicTrafficLabelObj.getVirtualSwitchType() == guestTrafficLabelObj.getVirtualSwitchType() + // true - pass + // false - throw exception - fail cluster add operation + + List pNetworkListGuestTraffic = _netmgr.getPhysicalNtwksSupportingTrafficType(dcId, TrafficType.Guest); + List pNetworkListPublicTraffic = _netmgr.getPhysicalNtwksSupportingTrafficType(dcId, TrafficType.Public); + // Public network would be on single physical network hence getting first object of the list would suffice. + PhysicalNetwork pNetworkPublic = pNetworkListPublicTraffic.get(0); + if (pNetworkListGuestTraffic.contains(pNetworkPublic)) { + if (publicTrafficLabelObj.getVirtualSwitchType() != guestTrafficLabelObj.getVirtualSwitchType()) { + String msg = "Both public traffic and guest traffic is over same physical network " + pNetworkPublic + + ". And virtual switch type chosen for each traffic is different" + + ". A physical network cannot be shared by different types of virtual switches."; + s_logger.error(msg); + throw new InvalidParameterValueException(msg); + } + } + } else { + // Distributed virtual switch is not supported in Basic zone for now. + // Private / Management network traffic is not yet supported over distributed virtual switch. + if (guestTrafficLabelObj.getVirtualSwitchType() != VirtualSwitchType.StandardVirtualSwitch) { + String msg = "Detected that Guest traffic is over Distributed virtual switch in Basic zone. Only Standard vSwitch is supported in Basic zone."; s_logger.error(msg); - throw new InvalidParameterValueException(msg); + throw new DiscoveredWithErrorException(msg); } } @@ -227,8 +244,6 @@ public class VmwareServerDiscoverer extends DiscovererBase implements } if (nexusDVS) { - DataCenterVO zone = _dcDao.findById(dcId); - NetworkType zoneType = zone.getNetworkType(); if (zoneType != NetworkType.Basic) { publicTrafficLabel = _netmgr.getDefaultPublicTrafficLabel(dcId, HypervisorType.VMware); if (publicTrafficLabel != null) {