From 02dc187a0cb8be4f856a42faa10054f660c66acc Mon Sep 17 00:00:00 2001 From: alena Date: Wed, 5 Jan 2011 11:15:27 -0800 Subject: [PATCH] bug 7727: Don't create Public network with broadcast_domain_type=vlan for Basic zone status 7727: resolved fixed --- .../ConfigurationManagerImpl.java | 39 +++++++------------ .../cloud/network/guru/PublicNetworkGuru.java | 2 + .../cloud/server/ConfigurationServerImpl.java | 21 +++++----- 3 files changed, 27 insertions(+), 35 deletions(-) diff --git a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java index 67bc0fcd483..c0dcd4e7673 100755 --- a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java +++ b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java @@ -1207,36 +1207,23 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura Account systemAccount = _accountDao.findById(Account.ACCOUNT_ID_SYSTEM); BroadcastDomainType broadcastDomainType = null; - if (offering.getGuestIpType() != GuestIpType.DirectPodBased) { - if (offering.getTrafficType() == TrafficType.Management) { + if (offering.getTrafficType() == TrafficType.Management) { + broadcastDomainType = BroadcastDomainType.Native; + } else if (offering.getTrafficType() == TrafficType.Control) { + broadcastDomainType = BroadcastDomainType.LinkLocal; + } else if (offering.getTrafficType() == TrafficType.Public) { + if (zone.getNetworkType() == NetworkType.Basic && offering.getGuestIpType() == GuestIpType.DirectPodBased) { broadcastDomainType = BroadcastDomainType.Native; - } else if (offering.getTrafficType() == TrafficType.Public) { + } else if (zone.getNetworkType() == NetworkType.Advanced && offering.getGuestIpType() == null) { broadcastDomainType = BroadcastDomainType.Vlan; - } else if (offering.getTrafficType() == TrafficType.Control) { - broadcastDomainType = BroadcastDomainType.LinkLocal; - } - userNetwork.setBroadcastDomainType(broadcastDomainType); - _networkMgr.setupNetwork(systemAccount, offering, userNetwork, plan, null, null, true); - } + } else { + continue; + } + } + userNetwork.setBroadcastDomainType(broadcastDomainType); + _networkMgr.setupNetwork(systemAccount, offering, userNetwork, plan, null, null, true); } } - - //if zone is basic, create a untagged network - if (zone != null && zone.getNetworkType() == NetworkType.Basic) { - //Create network - DataCenterDeployment plan = new DataCenterDeployment(zone.getId(), null, null, null); - NetworkVO userNetwork = new NetworkVO(); - userNetwork.setBroadcastDomainType(BroadcastDomainType.Native); - - Account systemAccount = _accountDao.findById(Account.ACCOUNT_ID_SYSTEM); - - List networkOffering = _networkOfferingDao.findByType(GuestIpType.DirectPodBased); - if (networkOffering == null || networkOffering.isEmpty()) { - throw new CloudRuntimeException("No default DirectPodBased network offering is found"); - } - - _networkMgr.setupNetwork(systemAccount, networkOffering.get(0), userNetwork, plan, null, null, true); - } } @Override diff --git a/server/src/com/cloud/network/guru/PublicNetworkGuru.java b/server/src/com/cloud/network/guru/PublicNetworkGuru.java index 59dbce2b260..17bf1d50a0d 100644 --- a/server/src/com/cloud/network/guru/PublicNetworkGuru.java +++ b/server/src/com/cloud/network/guru/PublicNetworkGuru.java @@ -50,6 +50,8 @@ public class PublicNetworkGuru extends AdapterBase implements NetworkGuru { @Inject VlanDao _vlanDao; @Inject NetworkManager _networkMgr; @Inject IPAddressDao _ipAddressDao; + + @Override public Network design(NetworkOffering offering, DeploymentPlan plan, Network network, Account owner) { diff --git a/server/src/com/cloud/server/ConfigurationServerImpl.java b/server/src/com/cloud/server/ConfigurationServerImpl.java index c9bff361a5f..d51d3459629 100644 --- a/server/src/com/cloud/server/ConfigurationServerImpl.java +++ b/server/src/com/cloud/server/ConfigurationServerImpl.java @@ -748,17 +748,20 @@ public class ConfigurationServerImpl implements ConfigurationServer { BroadcastDomainType broadcastDomainType = null; TrafficType trafficType= offering.getTrafficType(); GuestIpType guestIpType = offering.getGuestIpType(); - if (offering.getGuestIpType() != GuestIpType.DirectPodBased) { - if (trafficType == TrafficType.Management || trafficType == TrafficType.Storage) { + + if (trafficType == TrafficType.Management || trafficType == TrafficType.Storage) { + broadcastDomainType = BroadcastDomainType.Native; + } else if (trafficType == TrafficType.Control) { + broadcastDomainType = BroadcastDomainType.LinkLocal; + } else if (offering.getTrafficType() == TrafficType.Public) { + if (zone.getNetworkType() == NetworkType.Basic && offering.getGuestIpType() == GuestIpType.DirectPodBased) { broadcastDomainType = BroadcastDomainType.Native; - } else if (trafficType == TrafficType.Public) { + } else if (zone.getNetworkType() == NetworkType.Advanced && offering.getGuestIpType() == null) { broadcastDomainType = BroadcastDomainType.Vlan; - } else if (trafficType == TrafficType.Control) { - broadcastDomainType = BroadcastDomainType.LinkLocal; - } - } else if (zone.getNetworkType() == NetworkType.Basic && offering.getGuestIpType() == GuestIpType.DirectPodBased){ - broadcastDomainType = BroadcastDomainType.Vlan; - } + } else { + continue; + } + } if (broadcastDomainType != null) { NetworkVO network = new NetworkVO(id, trafficType, guestIpType, mode, broadcastDomainType, networkOfferingId, zoneId, domainId, accountId, related, null, null, true);