diff --git a/api/src/com/cloud/dc/DataCenter.java b/api/src/com/cloud/dc/DataCenter.java
index 57facf1a5f8..4331d35180d 100644
--- a/api/src/com/cloud/dc/DataCenter.java
+++ b/api/src/com/cloud/dc/DataCenter.java
@@ -9,6 +9,10 @@ import com.cloud.org.Grouping;
*
*/
public interface DataCenter extends Grouping {
+ public enum DataCenterNetworkType {
+ Basic,
+ Advanced
+ }
long getId();
String getDns1();
String getDns2();
diff --git a/core/.classpath b/core/.classpath
index d21c3e31c11..590df8c410b 100644
--- a/core/.classpath
+++ b/core/.classpath
@@ -1,44 +1,44 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/core/src/com/cloud/dc/DataCenterVO.java b/core/src/com/cloud/dc/DataCenterVO.java
index d0d122b252f..77385c8ca6e 100644
--- a/core/src/com/cloud/dc/DataCenterVO.java
+++ b/core/src/com/cloud/dc/DataCenterVO.java
@@ -20,6 +20,8 @@ package com.cloud.dc;
import javax.persistence.Column;
import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
@@ -67,17 +69,21 @@ public class DataCenterVO implements DataCenter {
@Column(name="domain")
private String domain = null;
+
+ @Column(name="networktype")
+ @Enumerated(EnumType.STRING)
+ DataCenterNetworkType networkType;
@Column(name="mac_address", updatable = false, nullable=false)
@TableGenerator(name="mac_address_sq", table="data_center", pkColumnName="id", valueColumnName="mac_address", allocationSize=1)
private long macAddress = 1;
- public DataCenterVO(long id, String name, String description, String dns1, String dns2, String dns3, String dns4, String vnet, String guestCidr, String domain, Long domainId) {
- this(name, description, dns1, dns2, dns3, dns4, vnet, guestCidr, domain, domainId);
+ public DataCenterVO(long id, String name, String description, String dns1, String dns2, String dns3, String dns4, String vnet, String guestCidr, String domain, Long domainId, DataCenterNetworkType zoneType) {
+ this(name, description, dns1, dns2, dns3, dns4, vnet, guestCidr, domain, domainId, zoneType);
this.id = id;
}
- public DataCenterVO(String name, String description, String dns1, String dns2, String dns3, String dns4, String vnet, String guestCidr, String domain, Long domainId) {
+ public DataCenterVO(String name, String description, String dns1, String dns2, String dns3, String dns4, String vnet, String guestCidr, String domain, Long domainId, DataCenterNetworkType zoneType) {
this.name = name;
this.description = description;
this.dns1 = dns1;
@@ -88,6 +94,7 @@ public class DataCenterVO implements DataCenter {
this.guestNetworkCidr = guestCidr;
this.domain = domain;
this.domainId = domainId;
+ this.networkType = zoneType;
}
public Long getDomainId() {
@@ -183,5 +190,13 @@ public class DataCenterVO implements DataCenter {
public void setDomain(String domain) {
this.domain = domain;
}
+
+ public void setNetworkType(DataCenterNetworkType zoneNetworkType) {
+ this.networkType = zoneNetworkType;
+ }
+
+ public DataCenterNetworkType getNetworkType() {
+ return networkType;
+ }
}
diff --git a/server/.classpath b/server/.classpath
index 6d7912d4ca3..933be26330d 100644
--- a/server/.classpath
+++ b/server/.classpath
@@ -1,26 +1,26 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/server/src/com/cloud/api/ApiConstants.java b/server/src/com/cloud/api/ApiConstants.java
index 23674d26f25..619baa5c5ac 100644
--- a/server/src/com/cloud/api/ApiConstants.java
+++ b/server/src/com/cloud/api/ApiConstants.java
@@ -160,4 +160,5 @@ public class ApiConstants {
public static final String VNET = "vnet";
public static final String VOLUME_ID = "volumeid";
public static final String ZONE_ID = "zoneid";
+ public static final String NETWORK_TYPE = "networktype";
}
diff --git a/server/src/com/cloud/api/ApiResponseHelper.java b/server/src/com/cloud/api/ApiResponseHelper.java
index d58ec0a19dd..2d07c81ad83 100644
--- a/server/src/com/cloud/api/ApiResponseHelper.java
+++ b/server/src/com/cloud/api/ApiResponseHelper.java
@@ -101,7 +101,6 @@ import com.cloud.vm.SystemVm;
import com.cloud.vm.UserVmVO;
import com.cloud.vm.VMInstanceVO;
import com.cloud.vm.VmStats;
-import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type;
public class ApiResponseHelper {
@@ -810,6 +809,7 @@ public class ApiResponseHelper {
zoneResponse.setDomain(dataCenter.getDomain());
zoneResponse.setDomainId(dataCenter.getDomainId());
+ zoneResponse.setType(dataCenter.getNetworkType().toString());
zoneResponse.setObjectName("zone");
return zoneResponse;
}
diff --git a/server/src/com/cloud/api/ResponseObjectTypeAdapter.java b/server/src/com/cloud/api/ResponseObjectTypeAdapter.java
index 5b1e5afbf7e..ebea2312ee3 100644
--- a/server/src/com/cloud/api/ResponseObjectTypeAdapter.java
+++ b/server/src/com/cloud/api/ResponseObjectTypeAdapter.java
@@ -31,52 +31,8 @@ public class ResponseObjectTypeAdapter implements JsonSerializer
obj.addProperty("errortext", ((ExceptionResponse)responseObj).getErrorText());
return obj;
} else {
- // Get the declared fields from the response obj, create a new JSON Object, add props to it.
- // Once that object is done, create a new JSON Object with the response name and the JSON Obj as the name/value pair. Return that as the serialized element.
- Field[] fields = responseObj.getClass().getDeclaredFields();
- for (Field field : fields) {
- if ((field.getModifiers() & Modifier.TRANSIENT) != 0) {
- continue; // skip transient fields
- }
-
- SerializedName serializedName = field.getAnnotation(SerializedName.class);
- if (serializedName == null) {
- continue; // skip fields w/o serialized name
- }
-
- String propName = field.getName();
- Method method = getGetMethod(responseObj, propName);
- if (method != null) {
- try {
- Object fieldValue = method.invoke(responseObj);
- if (fieldValue != null) {
- if (fieldValue instanceof ResponseObject) {
- ResponseObject subObj = (ResponseObject)fieldValue;
- obj.add(serializedName.value(), serialize(subObj, subObj.getClass(), ctx));
- } else {
- if (fieldValue instanceof Number) {
- obj.addProperty(serializedName.value(), (Number)fieldValue);
- } else if (fieldValue instanceof Character) {
- obj.addProperty(serializedName.value(), (Character)fieldValue);
- } else if (fieldValue instanceof Boolean) {
- obj.addProperty(serializedName.value(), (Boolean)fieldValue);
- } else {
- obj.addProperty(serializedName.value(), fieldValue.toString());
- }
- }
- }
- } catch (IllegalArgumentException e) {
- s_logger.error("Illegal argument exception when calling ResponseObject " + responseObj.getClass().getName() + " get method for property: " + propName);
- } catch (IllegalAccessException e) {
- s_logger.error("Illegal access exception when calling ResponseObject " + responseObj.getClass().getName() + " get method for property: " + propName);
- } catch (InvocationTargetException e) {
- s_logger.error("Invocation target exception when calling ResponseObject " + responseObj.getClass().getName() + " get method for property: " + propName);
- }
- }
- }
- JsonObject response = new JsonObject();
- response.add(responseObj.getObjectName(), obj);
- return response;
+ obj.add(responseObj.getObjectName(), ApiGsonHelper.getBuilder().create().toJsonTree(responseObj));
+ return obj;
}
}
diff --git a/server/src/com/cloud/api/commands/CreateZoneCmd.java b/server/src/com/cloud/api/commands/CreateZoneCmd.java
index 643b1fd5bb4..51b5eeef057 100644
--- a/server/src/com/cloud/api/commands/CreateZoneCmd.java
+++ b/server/src/com/cloud/api/commands/CreateZoneCmd.java
@@ -57,9 +57,8 @@ public class CreateZoneCmd extends BaseCmd {
@Parameter(name=ApiConstants.NAME, type=CommandType.STRING, required=true, description="the name of the Zone")
private String zoneName;
-
- //FIXME - this parameter is called "vnet" in updateZone. Have to figure out which one is right
- @Parameter(name=ApiConstants.VLAN, type=CommandType.STRING, description="the VNET for the Zone")
+
+ @Parameter(name=ApiConstants.VLAN, type=CommandType.STRING, description="the VLAN for the Zone")
private String vlan;
@Parameter(name=ApiConstants.DOMAIN, type=CommandType.STRING, description="Domain name for the Vms in the zone")
@@ -67,6 +66,9 @@ public class CreateZoneCmd extends BaseCmd {
@Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="the ID of the containing domain, null for public zones")
private Long domainId;
+
+ @Parameter(name=ApiConstants.NETWORK_TYPE, type=CommandType.STRING, required=true, description="network type of the zone, can be Basic or Advanced")
+ private String networkType;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
@@ -108,6 +110,10 @@ public class CreateZoneCmd extends BaseCmd {
return domainId;
}
+ public String getNetworkType(){
+ return networkType;
+ }
+
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
diff --git a/server/src/com/cloud/api/commands/UpdateZoneCmd.java b/server/src/com/cloud/api/commands/UpdateZoneCmd.java
index 124b293f660..2843e138cb3 100644
--- a/server/src/com/cloud/api/commands/UpdateZoneCmd.java
+++ b/server/src/com/cloud/api/commands/UpdateZoneCmd.java
@@ -61,8 +61,8 @@ public class UpdateZoneCmd extends BaseCmd {
@Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="the name of the Zone")
private String zoneName;
- @Parameter(name=ApiConstants.VNET, type=CommandType.STRING, description="the VNET for the Zone")
- private String vnet;
+ @Parameter(name=ApiConstants.VLAN, type=CommandType.STRING, description="the VLAN for the Zone")
+ private String vlan;
// @Parameter(name=ApiConstants.DOMAIN, type=CommandType.STRING, description="Domain name for the Vms in the zone")
// private String domain;
@@ -102,8 +102,8 @@ public class UpdateZoneCmd extends BaseCmd {
return zoneName;
}
- public String getVnet() {
- return vnet;
+ public String getVlan() {
+ return vlan;
}
// public String getDomain() {
diff --git a/server/src/com/cloud/api/response/ZoneResponse.java b/server/src/com/cloud/api/response/ZoneResponse.java
index ad975b474da..daa40c07483 100644
--- a/server/src/com/cloud/api/response/ZoneResponse.java
+++ b/server/src/com/cloud/api/response/ZoneResponse.java
@@ -63,6 +63,9 @@ public class ZoneResponse extends BaseResponse {
@SerializedName(ApiConstants.DOMAIN_ID) @Param(description="the ID of the containing domain, null for public zones")
private Long domainId;
+ @SerializedName(ApiConstants.NETWORK_TYPE) @Param(description="the network type of the zone; can be Basic or Advanced")
+ private String networkType;
+
public Long getId() {
return id;
}
@@ -166,5 +169,13 @@ public class ZoneResponse extends BaseResponse {
public void setDomainId(Long domainId) {
this.domainId = domainId;
}
+
+ public String getNetworkType() {
+ return networkType;
+ }
+
+ public void setType(String networkType) {
+ this.networkType = networkType;
+ }
}
diff --git a/server/src/com/cloud/configuration/ConfigurationManager.java b/server/src/com/cloud/configuration/ConfigurationManager.java
index de38aaadba5..cad2d478858 100644
--- a/server/src/com/cloud/configuration/ConfigurationManager.java
+++ b/server/src/com/cloud/configuration/ConfigurationManager.java
@@ -20,6 +20,7 @@ package com.cloud.configuration;
import java.util.List;
import com.cloud.dc.DataCenter;
+import com.cloud.dc.DataCenter.DataCenterNetworkType;
import com.cloud.dc.DataCenterVO;
import com.cloud.dc.HostPodVO;
import com.cloud.exception.ConcurrentOperationException;
@@ -97,11 +98,12 @@ public interface ConfigurationManager extends Manager {
* @param internalDns2
* @param vnetRange
* @param guestCidr
+ * @param zoneType
* @return
* @throws
* @throws
*/
- DataCenterVO createZone(long userId, String zoneName, String dns1, String dns2, String internalDns1, String internalDns2, String vnetRange, String guestCidr, String domain, Long domainId);
+ DataCenterVO createZone(long userId, String zoneName, String dns1, String dns2, String internalDns1, String internalDns2, String vnetRange, String guestCidr, String domain, Long domainId, DataCenterNetworkType zoneType);
/**
* Associates an ip address list to an account. The list of ip addresses are all addresses associated with the given vlan id.
diff --git a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
index 7d03fc4804c..2926dd31bbb 100755
--- a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
+++ b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
@@ -52,6 +52,7 @@ import com.cloud.configuration.ResourceCount.ResourceType;
import com.cloud.configuration.dao.ConfigurationDao;
import com.cloud.dc.AccountVlanMapVO;
import com.cloud.dc.DataCenter;
+import com.cloud.dc.DataCenter.DataCenterNetworkType;
import com.cloud.dc.DataCenterIpAddressVO;
import com.cloud.dc.DataCenterVO;
import com.cloud.dc.HostPodVO;
@@ -858,7 +859,7 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
String dns2 = cmd.getDns2();
String internalDns1 = cmd.getInternalDns1();
String internalDns2 = cmd.getInternalDns2();
- String vnetRange = cmd.getVnet();
+ String vnetRange = cmd.getVlan();
String guestCidr = cmd.getGuestCidrAddress();
// String domain = cmd.getDomain();
Long userId = UserContext.current().getUserId();
@@ -992,12 +993,11 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
}
@Override @DB
- public DataCenterVO createZone(long userId, String zoneName, String dns1, String dns2, String internalDns1, String internalDns2, String vnetRange, String guestCidr, String domain, Long domainId) {
- int vnetStart = -1;
- int vnetEnd = -1;
+ public DataCenterVO createZone(long userId, String zoneName, String dns1, String dns2, String internalDns1, String internalDns2, String vnetRange, String guestCidr, String domain, Long domainId, DataCenterNetworkType zoneType) {
+ int vnetStart = 0;
+ int vnetEnd = 0;
if (vnetRange != null) {
String[] tokens = vnetRange.split("-");
-
try {
vnetStart = Integer.parseInt(tokens[0]);
if (tokens.length == 1) {
@@ -1008,14 +1008,8 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
} catch (NumberFormatException e) {
throw new InvalidParameterValueException("Please specify valid integers for the vlan range.");
}
- } else {
- String networkType = _configDao.getValue("network.type");
- if (networkType != null && networkType.equals("vnet")) {
- vnetStart = 1000;
- vnetEnd = 2000;
- }
- }
-
+ }
+
//checking the following params outside checkzoneparams method as we do not use these params for updatezone
//hence the method below is generic to check for common params
if ((guestCidr != null) && !NetUtils.isValidCIDR(guestCidr)) {
@@ -1025,15 +1019,19 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
checkZoneParameters(zoneName, dns1, dns2, internalDns1, internalDns2, true, domainId);
// Create the new zone in the database
- DataCenterVO zone = new DataCenterVO(zoneName, null, dns1, dns2, internalDns1, internalDns2, vnetRange, guestCidr, domain, domainId);
+ DataCenterVO zone = new DataCenterVO(zoneName, null, dns1, dns2, internalDns1, internalDns2, vnetRange, guestCidr, domain, domainId, zoneType);
zone = _zoneDao.persist(zone);
- // Add vnet entries for the new zone
- if (vnetStart != -1 && vnetEnd != -1) {
+ // Add vnet entries for the new zone if zone type is Advanced
+ if (vnetRange != null) {
_zoneDao.addVnet(zone.getId(), vnetStart, vnetEnd);
}
- saveConfigurationEvent(userId, null, EventTypes.EVENT_ZONE_CREATE, "Successfully created new zone with name: " + zoneName + ".", "dcId=" + zone.getId(), "dns1=" + dns1, "dns2=" + dns2, "internalDns1=" + internalDns1, "internalDns2=" + internalDns2, "vnetRange=" + vnetRange, "guestCidr=" + guestCidr);
-
+
+ if (vnetRange != null) {
+ saveConfigurationEvent(userId, null, EventTypes.EVENT_ZONE_CREATE, "Successfully created new zone with name: " + zoneName + ".", "dcId=" + zone.getId(), "dns1=" + dns1, "dns2=" + dns2, "internalDns1=" + internalDns1, "internalDns2=" + internalDns2, "vnetRange=" + vnetRange, "guestCidr=" + guestCidr);
+ } else {
+ saveConfigurationEvent(userId, null, EventTypes.EVENT_ZONE_CREATE, "Successfully created new zone with name: " + zoneName + ".", "dcId=" + zone.getId(), "dns1=" + dns1, "dns2=" + dns2, "internalDns1=" + internalDns1, "internalDns2=" + internalDns2, "guestCidr=" + guestCidr);
+ }
return zone;
}
@@ -1050,6 +1048,17 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
String guestCidr = cmd.getGuestCidrAddress();
String domain = cmd.getDomain();//we are not passing domain right now, always null
Long domainId = cmd.getDomainId();
+ String type = cmd.getNetworkType();
+ Boolean isBasic = false;
+
+
+ if (!(type.equalsIgnoreCase(DataCenterNetworkType.Basic.toString())) && !(type.equalsIgnoreCase(DataCenterNetworkType.Advanced.toString()))) {
+ throw new InvalidParameterValueException("Invalid zone type; only Advanced and Basic values are supported");
+ } else if (type.endsWith(DataCenterNetworkType.Basic.toString())) {
+ isBasic = true;
+ }
+
+ DataCenterNetworkType zoneType = isBasic ? DataCenterNetworkType.Basic : DataCenterNetworkType.Advanced;
DomainVO domainVO = null;
if (userId == null) {
@@ -1059,7 +1068,12 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
if(domainId != null){
domainVO = _domainDao.findById(domainId);
}
- return createZone(userId, zoneName, dns1, dns2, internalDns1, internalDns2, vnetRange, guestCidr, domainVO != null ? domainVO.getName() : null, domainId);
+
+ //Verify zone type
+ if (zoneType == DataCenterNetworkType.Basic && vnetRange != null) {
+ vnetRange = null;
+ }
+ return createZone(userId, zoneName, dns1, dns2, internalDns1, internalDns2, vnetRange, guestCidr, domainVO != null ? domainVO.getName() : null, domainId, zoneType);
}
@Override
@@ -1378,10 +1392,27 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
@Override
public Vlan createVlanAndPublicIpRange(CreateVlanIpRangeCmd cmd) throws InsufficientCapacityException, ConcurrentOperationException {
+ Long zoneId = cmd.getZoneId();
+ Long podId = cmd.getPodId();
+ String startIP = cmd.getStartIp();
+ String endIP = cmd.getEndIp();
+ String vlanGateway = cmd.getGateway();
+ String vlanNetmask = cmd.getNetmask();
Long userId = UserContext.current().getUserId();
+
if (userId == null) {
userId = Long.valueOf(User.UID_SYSTEM);
}
+
+ // Check that the pod ID is valid
+ if (podId != null && ((_podDao.findById(podId)) == null)) {
+ throw new InvalidParameterValueException("Please specify a valid pod.");
+ }
+
+
+ if (podId != null && _podDao.findById(podId).getDataCenterId() != zoneId) {
+ throw new InvalidParameterValueException("Pod id=" + podId + " doesn't belong to zone id=" + zoneId);
+ }
// If forVirtualNetworks isn't specified, default it to true
Boolean forVirtualNetwork = cmd.isForVirtualNetwork();
@@ -1394,6 +1425,23 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
if (vlanId == null) {
vlanId = Vlan.UNTAGGED;
}
+
+ DataCenterVO zone;
+ if (zoneId == null || ((zone = _zoneDao.findById(zoneId)) == null)) {
+ throw new InvalidParameterValueException("Please specify a valid zone.");
+ }
+
+ //Allow adding untagged direct vlan only for Basic zone
+ if (zone.getNetworkType() == DataCenterNetworkType.Advanced && vlanId.equals(Vlan.UNTAGGED) && !forVirtualNetwork) {
+ throw new InvalidParameterValueException("Direct untagged network is not supported for the zone " + zone.getId() + " of type " + zone.getNetworkType());
+ } else if (zone.getNetworkType() == DataCenterNetworkType.Basic && !(vlanId.equals(Vlan.UNTAGGED) && !forVirtualNetwork)) {
+ throw new InvalidParameterValueException("Only direct untagged network is supported in the zone " + zone.getId() + " of type " + zone.getNetworkType());
+ }
+
+ //don't allow to create a virtual vlan when zone's vnet is NULL
+ if (zone.getVnet() == null && forVirtualNetwork) {
+ throw new InvalidParameterValueException("Can't add virtual network to the zone id=" + zone.getId() + " as zone doesn't have guest vlan configured");
+ }
// If an account name and domain ID are specified, look up the account
String accountName = cmd.getAccountName();
@@ -1407,12 +1455,7 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
}
VlanType vlanType = forVirtualNetwork ? VlanType.VirtualNetwork : VlanType.DirectAttached;
- Long zoneId = cmd.getZoneId();
- Long podId = cmd.getPodId();
- String startIP = cmd.getStartIp();
- String endIP = cmd.getEndIp();
- String vlanGateway = cmd.getGateway();
- String vlanNetmask = cmd.getNetmask();
+
//check for hypervisor type to be xenserver
String hypervisorType = _configDao.getValue("hypervisor.type");
@@ -1439,10 +1482,7 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
+",whilst you are trying to associate it with vlan type "+vlanType.toString());
}
- DataCenterVO zone;
- if (zoneId == null || ((zone = _zoneDao.findById(zoneId)) == null)) {
- throw new InvalidParameterValueException("Please specify a valid zone.");
- }
+
// //check if the account's domain is a child of the zone's domain, for adding vlan ip ranges
// if(domainId != null && !_domainDao.isChildDomain(zone.getDomainId(), domainId)){
@@ -1491,11 +1531,7 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
throw new InvalidParameterValueException("Direct Attached IP ranges for a pod must be untagged.");
}
- // Check that the pod ID is valid
- if (podId != null && ((_podDao.findById(podId)) == null)) {
- throw new InvalidParameterValueException("Please specify a valid pod.");
- }
-
+
// Make sure there aren't any account VLANs in this zone
List accountVlanMaps = _accountVlanMapDao.listAllIncludingRemoved();
for (AccountVlanMapVO accountVlanMap : accountVlanMaps) {
diff --git a/server/src/com/cloud/server/ConfigurationServerImpl.java b/server/src/com/cloud/server/ConfigurationServerImpl.java
index 5cdd7aad726..59b0163b74c 100644
--- a/server/src/com/cloud/server/ConfigurationServerImpl.java
+++ b/server/src/com/cloud/server/ConfigurationServerImpl.java
@@ -45,6 +45,7 @@ import com.cloud.configuration.ConfigurationVO;
import com.cloud.configuration.dao.ConfigurationDao;
import com.cloud.dc.DataCenterVO;
import com.cloud.dc.HostPodVO;
+import com.cloud.dc.DataCenter.DataCenterNetworkType;
import com.cloud.dc.dao.DataCenterDao;
import com.cloud.dc.dao.HostPodDao;
import com.cloud.domain.DomainVO;
@@ -194,7 +195,7 @@ public class ConfigurationServerImpl implements ConfigurationServer {
if (dns == null) {
dns = "4.2.2.2";
}
- DataCenterVO zone = createZone(User.UID_SYSTEM, "Default", dns, null, dns, null, "1000-2000","10.1.1.0/24", null, null);
+ DataCenterVO zone = createZone(User.UID_SYSTEM, "Default", dns, null, dns, null, null,"10.1.1.0/24", null, null, DataCenterNetworkType.Basic);
// Create a default pod
String networkType = _configDao.getValue("network.type");
@@ -531,7 +532,7 @@ public class ConfigurationServerImpl implements ConfigurationServer {
}
}
- private DataCenterVO createZone(long userId, String zoneName, String dns1, String dns2, String internalDns1, String internalDns2, String vnetRange, String guestCidr, String domain, Long domainId) throws InvalidParameterValueException, InternalErrorException {
+ private DataCenterVO createZone(long userId, String zoneName, String dns1, String dns2, String internalDns1, String internalDns2, String vnetRange, String guestCidr, String domain, Long domainId, DataCenterNetworkType zoneType) throws InvalidParameterValueException, InternalErrorException {
int vnetStart, vnetEnd;
if (vnetRange != null) {
String[] tokens = vnetRange.split("-");
@@ -569,7 +570,7 @@ public class ConfigurationServerImpl implements ConfigurationServer {
throw new InvalidParameterValueException("Please specify a valid domain id");
}
// Create the new zone in the database
- DataCenterVO zone = new DataCenterVO(zoneName, null, dns1, dns2, internalDns1, internalDns2, vnetRange, guestCidr, domain, domainId);
+ DataCenterVO zone = new DataCenterVO(zoneName, null, dns1, dns2, internalDns1, internalDns2, vnetRange, guestCidr, domain, domainId, zoneType);
zone = _zoneDao.persist(zone);
// Add vnet entries for the new zone
diff --git a/server/src/com/cloud/server/ManagementServerImpl.java b/server/src/com/cloud/server/ManagementServerImpl.java
index ef351603dcc..e9e261730c3 100755
--- a/server/src/com/cloud/server/ManagementServerImpl.java
+++ b/server/src/com/cloud/server/ManagementServerImpl.java
@@ -1408,7 +1408,6 @@ public class ManagementServerImpl implements ManagementServer {
return singleZone;
}
}
-
return dcs;
}
diff --git a/setup/db/create-schema.sql b/setup/db/create-schema.sql
index c3f375c5440..cde395f6a4b 100755
--- a/setup/db/create-schema.sql
+++ b/setup/db/create-schema.sql
@@ -370,6 +370,7 @@ CREATE TABLE `cloud`.`data_center` (
`guest_network_cidr` varchar(18),
`domain` varchar(100) COMMENT 'Network domain name of the Vms of the zone',
`domain_id` bigint unsigned COMMENT 'domain id for the parent domain to this zone (null signifies public zone)',
+ `networktype` varchar(255) NOT NULL COMMENT 'Network type of the zone',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;