diff --git a/api/src/com/cloud/api/commands/CreateNetworkOfferingCmd.java b/api/src/com/cloud/api/commands/CreateNetworkOfferingCmd.java index a8c452286bb..d63c6391082 100644 --- a/api/src/com/cloud/api/commands/CreateNetworkOfferingCmd.java +++ b/api/src/com/cloud/api/commands/CreateNetworkOfferingCmd.java @@ -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.") diff --git a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java index 3789c51e8db..82da106633d 100755 --- a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java +++ b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java @@ -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) { diff --git a/server/src/com/cloud/network/NetworkManagerImpl.java b/server/src/com/cloud/network/NetworkManagerImpl.java index cf0c687c54d..1443f9ae1ab 100755 --- a/server/src/com/cloud/network/NetworkManagerImpl.java +++ b/server/src/com/cloud/network/NetworkManagerImpl.java @@ -836,12 +836,15 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag @Override public List setupNetworkConfiguration(Account owner, NetworkOfferingVO offering, Network predefined, DeploymentPlan plan, String name, String displayText, boolean isShared) { + List 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(); diff --git a/server/src/com/cloud/network/NetworkVO.java b/server/src/com/cloud/network/NetworkVO.java index 2ed12346c43..8d64b4f4b6f 100644 --- a/server/src/com/cloud/network/NetworkVO.java +++ b/server/src/com/cloud/network/NetworkVO.java @@ -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) { diff --git a/server/src/com/cloud/network/guru/GuestNetworkGuru.java b/server/src/com/cloud/network/guru/GuestNetworkGuru.java index 4e548571245..f604b40bc01 100644 --- a/server/src/com/cloud/network/guru/GuestNetworkGuru.java +++ b/server/src/com/cloud/network/guru/GuestNetworkGuru.java @@ -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; }