Don't allow to create network offering of DirectPodBased type

This commit is contained in:
alena 2010-12-06 17:42:23 -08:00
parent fb4c448762
commit a67e91253f
5 changed files with 13 additions and 9 deletions

View File

@ -43,7 +43,7 @@ public class CreateNetworkOfferingCmd extends BaseCmd {
@Parameter(name=ApiConstants.DISPLAY_TEXT, type=CommandType.STRING, required=true, description="the display text of the network offering")
private String displayText;
@Parameter(name=ApiConstants.TYPE, type=CommandType.STRING, required=true, description="type of the network. Supported types Virtual, Direct, DirectPodBased")
@Parameter(name=ApiConstants.TYPE, type=CommandType.STRING, required=true, description="type of the network. Supported types Virtual, Direct")
private String type;
@Parameter(name=ApiConstants.TRAFFIC_TYPE, type=CommandType.STRING, required=true, description="the traffic type for the network offering, supported types are Public, Management, Control, Guest, Vlan or Storage.")

View File

@ -1118,7 +1118,7 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
if (!(type.equalsIgnoreCase(NetworkType.Basic.toString())) && !(type.equalsIgnoreCase(NetworkType.Advanced.toString()))) {
throw new InvalidParameterValueException("Invalid zone type; only Advanced and Basic values are supported");
} else if (type.endsWith(NetworkType.Basic.toString())) {
} else if (type.equalsIgnoreCase(NetworkType.Basic.toString())) {
isBasic = true;
}
@ -2482,8 +2482,8 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
type = gType;
}
}
if (type == null) {
throw new InvalidParameterValueException("Invalid value for type. Supported types: Virtual, Direct, DirectPodBased");
if (type == null || type == GuestIpType.DirectPodBased) {
throw new InvalidParameterValueException("Invalid value for type. Supported types: Virtual, Direct");
}
if (specifyVlan == null) {

View File

@ -836,12 +836,15 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
@Override
public List<NetworkVO> setupNetworkConfiguration(Account owner, NetworkOfferingVO offering, Network predefined, DeploymentPlan plan, String name, String displayText, boolean isShared) {
List<NetworkVO> configs = _networkConfigDao.listBy(owner.getId(), offering.getId(), plan.getDataCenterId());
if (configs.size() > 0) {
if (s_logger.isDebugEnabled()) {
s_logger.debug("Found existing network configuration for offering " + offering + ": " + configs.get(0));
if (predefined == null || (predefined.getBroadcastUri() == null && predefined.getBroadcastDomainType() != BroadcastDomainType.Vlan)) {
if (configs.size() > 0) {
if (s_logger.isDebugEnabled()) {
s_logger.debug("Found existing network configuration for offering " + offering + ": " + configs.get(0));
}
return configs;
}
return configs;
}
configs = new ArrayList<NetworkVO>();

View File

@ -150,6 +150,7 @@ public class NetworkVO implements Network {
this.dns2 = that.getDns2();
this.cidr = that.getCidr();
this.broadcastUri = that.getBroadcastUri();
this.broadcastDomainType = that.getBroadcastDomainType();
this.guruName = guruName;
this.state = that.getState();
if (state == null) {

View File

@ -71,7 +71,7 @@ public class GuestNetworkGuru extends AdapterBase implements NetworkGuru {
@Override
public Network design(NetworkOffering offering, DeploymentPlan plan, Network userSpecified, Account owner) {
if (offering.getTrafficType() != TrafficType.Guest || offering.getGuestIpType() != GuestIpType.Virtual) {
if (offering.getTrafficType() != TrafficType.Guest) {
return null;
}