bug 7727: Don't create Public network with broadcast_domain_type=vlan for Basic zone

status 7727: resolved fixed
This commit is contained in:
alena 2011-01-05 11:15:27 -08:00
parent d33d61b1b4
commit 02dc187a0c
3 changed files with 27 additions and 35 deletions

View File

@ -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<NetworkOfferingVO> 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

View File

@ -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) {

View File

@ -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);