diff --git a/api/src/com/cloud/api/ApiConstants.java b/api/src/com/cloud/api/ApiConstants.java index e754dfcdac4..ea2fd64111f 100755 --- a/api/src/com/cloud/api/ApiConstants.java +++ b/api/src/com/cloud/api/ApiConstants.java @@ -209,7 +209,6 @@ public class ApiConstants { public static final String IS_SYSTEM = "issystem"; public static final String AVAILABILITY = "availability"; public static final String NETWORKRATE = "networkrate"; - public static final String GUEST_IP_TYPE = "guestiptype"; public static final String HOST_TAGS = "hosttags"; public static final String SSH_KEYPAIR = "keypair"; public static final String HOST_CPU_CAPACITY = "hostcpucapacity"; diff --git a/api/src/com/cloud/api/commands/CreateNetworkOfferingCmd.java b/api/src/com/cloud/api/commands/CreateNetworkOfferingCmd.java index 5ff1018f685..2799cc6a05b 100644 --- a/api/src/com/cloud/api/commands/CreateNetworkOfferingCmd.java +++ b/api/src/com/cloud/api/commands/CreateNetworkOfferingCmd.java @@ -33,7 +33,6 @@ import com.cloud.api.Implementation; import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.api.response.NetworkOfferingResponse; -import com.cloud.network.Network.GuestIpType; import com.cloud.offering.NetworkOffering; import com.cloud.offering.NetworkOffering.Availability; import com.cloud.user.Account; @@ -56,11 +55,6 @@ public class CreateNetworkOfferingCmd extends BaseCmd { @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.") private String traffictype; - @Deprecated - //this parameter is deprecated, we have to use "type" parameter instead - @Parameter(name=ApiConstants.GUEST_IP_TYPE, type=CommandType.STRING, description="the guest ip type for the network offering, supported types are Direct and Virtual.") - private String guestIpType; - @Parameter(name=ApiConstants.MAX_CONNECTIONS, type=CommandType.INTEGER, description="maximum number of concurrent connections supported by the network offering") private Integer maxConnections; @@ -186,19 +180,7 @@ public class CreateNetworkOfferingCmd extends BaseCmd { } public String getType() { - if (type != null) { - return type; - } - - if (guestIpType != null) { - // Verify guest ip type - for (GuestIpType gType : GuestIpType.values()) { - if (gType.name().equalsIgnoreCase(guestIpType)) { - return guestIpType; - } - } - } - return null; + return type; } public Map> getServiceProviders() { diff --git a/api/src/com/cloud/api/commands/ListNetworkOfferingsCmd.java b/api/src/com/cloud/api/commands/ListNetworkOfferingsCmd.java index a1cefb5a70a..1fcd3a4de35 100644 --- a/api/src/com/cloud/api/commands/ListNetworkOfferingsCmd.java +++ b/api/src/com/cloud/api/commands/ListNetworkOfferingsCmd.java @@ -65,9 +65,6 @@ public class ListNetworkOfferingsCmd extends BaseListCmd { @Parameter(name=ApiConstants.AVAILABILITY, type=CommandType.STRING, description="the availability of network offering. Default value is Required") private String availability; - @Parameter(name=ApiConstants.GUEST_IP_TYPE, type=CommandType.STRING, description="the guest ip type for the network offering, supported types are Direct and Virtual.") - private String guestIpType; - @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, description="list netowrk offerings available for network creation in specific zone") private Long zoneId; @@ -79,6 +76,9 @@ public class ListNetworkOfferingsCmd extends BaseListCmd { @Parameter(name=ApiConstants.NETWORK_ID, type=CommandType.LONG, description="the ID of the network. Pass this in if you want to see the available network offering that a network can be changed to.") private Long networkId; + + @Parameter(name=ApiConstants.TYPE, type=CommandType.STRING, description="list network offerings by type: Shared or Isolated") + private String type; ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// @@ -116,10 +116,6 @@ public class ListNetworkOfferingsCmd extends BaseListCmd { return availability; } - public String getGuestIpType() { - return guestIpType; - } - public Long getZoneId() { return zoneId; } @@ -136,6 +132,10 @@ public class ListNetworkOfferingsCmd extends BaseListCmd { return networkId; } + public String getType() { + return type; + } + ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// diff --git a/api/src/com/cloud/api/response/NetworkOfferingResponse.java b/api/src/com/cloud/api/response/NetworkOfferingResponse.java index 26b3833ee73..5e6f8505c94 100644 --- a/api/src/com/cloud/api/response/NetworkOfferingResponse.java +++ b/api/src/com/cloud/api/response/NetworkOfferingResponse.java @@ -59,9 +59,6 @@ public class NetworkOfferingResponse extends BaseResponse{ @SerializedName(ApiConstants.AVAILABILITY) @Param(description="availability of the network offering") private String availability; - @SerializedName(ApiConstants.GUEST_IP_TYPE) @Param(description="guest ip type of the network offering") - private String guestIpType; - @SerializedName(ApiConstants.NETWORKRATE) @Param(description="data transfer rate in megabits per second allowed.") private Integer networkRate; @@ -125,10 +122,6 @@ public class NetworkOfferingResponse extends BaseResponse{ this.networkRate = networkRate; } - public void setGuestIpType(String guestIpType) { - this.guestIpType = guestIpType; - } - public void setIsSecurityGroupEnabled(Boolean isSecurityGroupEnabled) { this.isSecurityGroupEnabled = isSecurityGroupEnabled; } diff --git a/api/src/com/cloud/api/response/NicResponse.java b/api/src/com/cloud/api/response/NicResponse.java index 9e73aaa60fb..49e8aa07ec6 100755 --- a/api/src/com/cloud/api/response/NicResponse.java +++ b/api/src/com/cloud/api/response/NicResponse.java @@ -17,24 +17,26 @@ */ package com.cloud.api.response; +import com.cloud.api.ApiConstants; import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; +@SuppressWarnings("unused") public class NicResponse extends BaseResponse { - @SerializedName("id") @Param(description="the ID of the nic") + @SerializedName(ApiConstants.ID) @Param(description="the ID of the nic") private Long id; - @SerializedName("networkid") @Param(description="the ID of the corresponding network") + @SerializedName(ApiConstants.NETWORK_ID) @Param(description="the ID of the corresponding network") private Long networkid; - @SerializedName("netmask") @Param(description="the netmask of the nic") + @SerializedName(ApiConstants.NETMASK) @Param(description="the netmask of the nic") private String netmask; - @SerializedName("gateway") @Param(description="the gateway of the nic") + @SerializedName(ApiConstants.GATEWAY) @Param(description="the gateway of the nic") private String gateway; - @SerializedName("ipaddress") @Param(description="the ip address of the nic") + @SerializedName(ApiConstants.IP_ADDRESS) @Param(description="the ip address of the nic") private String ipaddress; @SerializedName("isolationuri") @Param(description="the isolation uri of the nic") @@ -43,102 +45,58 @@ public class NicResponse extends BaseResponse { @SerializedName("broadcasturi") @Param(description="the broadcast uri of the nic") private String broadcastUri; - @SerializedName("traffictype") @Param(description="the traffic type of the nic") + @SerializedName(ApiConstants.TRAFFIC_TYPE) @Param(description="the traffic type of the nic") private String trafficType; - @SerializedName("type") @Param(description="the type of the nic") + @SerializedName(ApiConstants.TYPE) @Param(description="the type of the nic") private String type; - @SerializedName("isdefault") @Param(description="true if nic is default, false otherwise") + @SerializedName(ApiConstants.IS_DEFAULT) @Param(description="true if nic is default, false otherwise") private Boolean isDefault; @SerializedName("macaddress") @Param(description="true if nic is default, false otherwise") private String macAddress; - public Long getId() { - return id; - } - public void setId(Long id) { this.id = id; } - public Long getNetworkid() { - return networkid; - } - public void setNetworkid(Long networkid) { this.networkid = networkid; } - public String getNetmask() { - return netmask; - } - public void setNetmask(String netmask) { this.netmask = netmask; } - public String getGateway() { - return gateway; - } - public void setGateway(String gateway) { this.gateway = gateway; } - public String getIpaddress() { - return ipaddress; - } - public void setIpaddress(String ipaddress) { this.ipaddress = ipaddress; } - public String getIsolationUri() { - return isolationUri; - } - public void setIsolationUri(String isolationUri) { this.isolationUri = isolationUri; } - public String getBroadcastUri() { - return broadcastUri; - } - public void setBroadcastUri(String broadcastUri) { this.broadcastUri = broadcastUri; } - public String getTrafficType() { - return trafficType; - } - public void setTrafficType(String trafficType) { this.trafficType = trafficType; } - public String getType() { - return type; - } - public void setType(String type) { this.type = type; } - public Boolean getIsDefault() { - return isDefault; - } - public void setIsDefault(Boolean isDefault) { this.isDefault = isDefault; } - public String getMacAddress() { - return macAddress; - } - public void setMacAddress(String macAddress) { this.macAddress = macAddress; } diff --git a/api/src/com/cloud/network/Network.java b/api/src/com/cloud/network/Network.java index 99f3f18250c..e020d2a4c75 100644 --- a/api/src/com/cloud/network/Network.java +++ b/api/src/com/cloud/network/Network.java @@ -38,12 +38,6 @@ import com.cloud.utils.fsm.StateMachine; * owned by an account. */ public interface Network extends ControlledEntity { - - @Deprecated - public enum GuestIpType { - Virtual, - Direct, - } public enum Type { Shared, @@ -260,9 +254,6 @@ public interface Network extends ControlledEntity { URI getBroadcastUri(); - @Deprecated - GuestIpType getGuestType(); - String getDisplayText(); String getReservationId(); diff --git a/api/src/com/cloud/network/NetworkProfile.java b/api/src/com/cloud/network/NetworkProfile.java index b6f85994440..be243997683 100644 --- a/api/src/com/cloud/network/NetworkProfile.java +++ b/api/src/com/cloud/network/NetworkProfile.java @@ -50,8 +50,6 @@ public class NetworkProfile implements Network { private boolean isSecurityGroupEnabled; private List tags; private Network.Type type; - @Deprecated - private GuestIpType guestIpType; private boolean isShared; private Long physicalNetworkId; @@ -76,7 +74,6 @@ public class NetworkProfile implements Network { this.domainId = network.getDomainId(); this.isSecurityGroupEnabled = network.isSecurityGroupEnabled(); this.type = network.getType(); - this.guestIpType = network.getGuestType(); this.isShared = network.getIsShared(); this.physicalNetworkId = network.getPhysicalNetworkId(); } @@ -171,11 +168,6 @@ public class NetworkProfile implements Network { return related; } - @Override - public GuestIpType getGuestType() { - return guestIpType; - } - @Override public String getDisplayText() { return displayText; diff --git a/api/src/com/cloud/offering/NetworkOffering.java b/api/src/com/cloud/offering/NetworkOffering.java index 530e8ac5016..8a5fe3a9195 100644 --- a/api/src/com/cloud/offering/NetworkOffering.java +++ b/api/src/com/cloud/offering/NetworkOffering.java @@ -17,7 +17,6 @@ */ package com.cloud.offering; -import com.cloud.network.Network.GuestIpType; import com.cloud.network.Network.Type; import com.cloud.network.Networks.TrafficType; @@ -88,9 +87,6 @@ public interface NetworkOffering { Availability getAvailability(); boolean isSharedSourceNatService(); - - @Deprecated - GuestIpType getGuestType(); String getUniqueName(); diff --git a/core/src/com/cloud/event/dao/UsageEventDaoImpl.java b/core/src/com/cloud/event/dao/UsageEventDaoImpl.java index ebc04b97981..99aa5177272 100644 --- a/core/src/com/cloud/event/dao/UsageEventDaoImpl.java +++ b/core/src/com/cloud/event/dao/UsageEventDaoImpl.java @@ -28,10 +28,10 @@ import javax.ejb.Local; import org.apache.log4j.Logger; +import com.cloud.dc.Vlan; import com.cloud.event.EventTypes; import com.cloud.event.UsageEventVO; import com.cloud.exception.UsageServerException; -import com.cloud.network.Network.GuestIpType; import com.cloud.utils.DateUtil; import com.cloud.utils.db.DB; import com.cloud.utils.db.Filter; @@ -180,7 +180,7 @@ public class UsageEventDaoImpl extends GenericDaoBase implem sc.setParameters("assignEvent", EventTypes.EVENT_NET_IP_ASSIGN); sc.setParameters("releaseEvent", EventTypes.EVENT_NET_IP_RELEASE); sc.setParameters("zoneid", zoneId); - sc.setParameters("networktype", GuestIpType.Direct.toString()); + sc.setParameters("networktype", Vlan.VlanType.DirectAttached.toString()); return listBy(sc, filter); } diff --git a/server/src/com/cloud/api/ApiResponseHelper.java b/server/src/com/cloud/api/ApiResponseHelper.java index 8bfd99dc72f..d80d375eeb7 100755 --- a/server/src/com/cloud/api/ApiResponseHelper.java +++ b/server/src/com/cloud/api/ApiResponseHelper.java @@ -2113,10 +2113,6 @@ public class ApiResponseHelper implements ResponseGenerator { if (offering.getType() != null) { response.setType(offering.getType().toString()); } - - if (offering.getGuestType() != null) { - response.setGuestIpType(offering.getGuestType().toString()); - } response.setState(offering.getState().name()); @@ -2158,10 +2154,6 @@ public class ApiResponseHelper implements ResponseGenerator { response.setTrafficType(network.getTrafficType().name()); } - if (network.getGuestType() != null) { - response.setType(network.getGuestType().name()); - } - // get start ip and end ip of corresponding vlan List vlan = ApiDBUtils.listVlanByNetworkId(network.getId()); if (vlan != null && !vlan.isEmpty()) { diff --git a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java index 52c262d11d1..9110515ca02 100755 --- a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java +++ b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java @@ -96,7 +96,6 @@ import com.cloud.exception.ResourceUnavailableException; import com.cloud.host.dao.HostDetailsDao; import com.cloud.hypervisor.Hypervisor.HypervisorType; import com.cloud.network.Network; -import com.cloud.network.Network.GuestIpType; import com.cloud.network.Network.Provider; import com.cloud.network.Network.Service; import com.cloud.network.NetworkManager; @@ -1395,20 +1394,17 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura } else { continue; } - } /*else if (offering.getTrafficType() == TrafficType.Guest) { + } else if (offering.getTrafficType() == TrafficType.Guest) { if (zone.getNetworkType() == NetworkType.Basic) { isNetworkDefault = true; broadcastDomainType = BroadcastDomainType.Native; - userNetwork.setSecurityGroupEnabled(isSecurityGroupEnabled); - } else if (offering.getGuestType() == GuestIpType.Direct && isSecurityGroupEnabled) { - isNetworkDefault = true; - userNetwork.setSecurityGroupEnabled(isSecurityGroupEnabled); + userNetwork.setSecurityGroupEnabled(offering.isSecurityGroupEnabled()); } else { continue; } networkDomain = "cs" + Long.toHexString(Account.ACCOUNT_ID_SYSTEM) + _networkMgr.getGlobalGuestDomainSuffix(); - }*/ + } userNetwork.setBroadcastDomainType(broadcastDomainType); userNetwork.setNetworkDomain(networkDomain); _networkMgr.setupNetwork(systemAccount, offering, userNetwork, plan, null, null, isNetworkDefault, false, null, null, true); @@ -2885,12 +2881,12 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura Object specifyVlan = cmd.getSpecifyVlan(); Object isShared = cmd.getIsShared(); Object availability = cmd.getAvailability(); - Object guestIpType = cmd.getGuestIpType(); Object sgEnabled = cmd.getSecurityGroupEnabled(); Object state = cmd.getState(); Long zoneId = cmd.getZoneId(); DataCenter zone = null; Long networkId = cmd.getNetworkId(); + String type = cmd.getType(); if (zoneId != null) { zone = getZone(zoneId); @@ -2906,13 +2902,14 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura sc.addAnd("name", SearchCriteria.Op.SC, ssc); } - if (guestIpType != null) { - sc.addAnd("guestType", SearchCriteria.Op.EQ, guestIpType); - } - if (name != null) { sc.addAnd("name", SearchCriteria.Op.LIKE, "%" + name + "%"); } + + if (type != null) { + sc.addAnd("type", SearchCriteria.Op.EQ, type); + } + if (displayText != null) { sc.addAnd("displayText", SearchCriteria.Op.LIKE, "%" + displayText + "%"); } @@ -2949,8 +2946,6 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura if (zone.getNetworkType() == NetworkType.Basic) { // return empty list as we don't allow to create networks in basic zone, and shouldn't display networkOfferings return new ArrayList(); - } else if (zone.isSecurityGroupEnabled()) { - sc.addAnd("guestType", SearchCriteria.Op.EQ, GuestIpType.Direct); } } diff --git a/server/src/com/cloud/migration/Db20to21MigrationUtil.java b/server/src/com/cloud/migration/Db20to21MigrationUtil.java index e3b752dee2a..014f2a32c3d 100644 --- a/server/src/com/cloud/migration/Db20to21MigrationUtil.java +++ b/server/src/com/cloud/migration/Db20to21MigrationUtil.java @@ -56,7 +56,6 @@ import com.cloud.host.Host; import com.cloud.host.HostVO; import com.cloud.host.dao.HostDao; import com.cloud.migration.DiskOffering21VO.Type; -import com.cloud.network.Network; import com.cloud.storage.Storage.StoragePoolType; import com.cloud.storage.StoragePoolVO; import com.cloud.storage.Volume; @@ -305,8 +304,8 @@ public class Db20to21MigrationUtil { List oldServiceOfferings = _serviceOffering20Dao.listAllIncludingRemoved(); for(ServiceOffering20VO so20 : oldServiceOfferings) { ServiceOffering21VO so21 = new ServiceOffering21VO(so20.getName(), so20.getCpu(), so20.getRamSize(), so20.getSpeed(), so20.getRateMbps(), - so20.getMulticastRateMbps(), so20.getOfferHA(), so20.getDisplayText(), so20.getGuestIpType(), - so20.getUseLocalStorage(), false, null); + so20.getMulticastRateMbps(), so20.getOfferHA(), so20.getDisplayText(), so20.getUseLocalStorage(), + false, null); so21.setId(seq++); so21.setDiskSize(0); so21 = _serviceOffering21Dao.persist(so21); @@ -324,8 +323,8 @@ public class Db20to21MigrationUtil { _configDao.getValue(Config.ConsoleProxyRamSize.key()), ConsoleProxyManager.DEFAULT_PROXY_VM_RAMSIZE); ServiceOffering21VO soConsoleProxy = new ServiceOffering21VO("Fake Offering For DomP", 1, - proxyRamSize, 0, 0, 0, false, null, Network.GuestIpType.Virtual, - useLocalStorage, true, null); + proxyRamSize, 0, 0, 0, false, null, useLocalStorage, + true, null); soConsoleProxy.setId(seq++); soConsoleProxy.setUniqueName("Cloud.com-ConsoleProxy"); soConsoleProxy = _serviceOffering21Dao.persist(soConsoleProxy); @@ -335,7 +334,7 @@ public class Db20to21MigrationUtil { _configDao.getValue(Config.SecStorageVmRamSize.key()), SecondaryStorageVmManager.DEFAULT_SS_VM_RAMSIZE); ServiceOffering21VO soSecondaryVm = new ServiceOffering21VO("Fake Offering For Secondary Storage VM", 1, - secStorageVmRamSize, 0, 0, 0, false, null, Network.GuestIpType.Virtual, useLocalStorage, true, null); + secStorageVmRamSize, 0, 0, 0, false, null, useLocalStorage, true, null); soSecondaryVm.setId(seq++); soSecondaryVm.setUniqueName("Cloud.com-SecondaryStorage"); soSecondaryVm = _serviceOffering21Dao.persist(soSecondaryVm); @@ -343,7 +342,7 @@ public class Db20to21MigrationUtil { int routerRamSize = NumbersUtil.parseInt(_configDao.getValue("router.ram.size"), 128); ServiceOffering21VO soDomainRouter = new ServiceOffering21VO("Fake Offering For DomR", 1, - routerRamSize, 0, 0, 0, false, null, Network.GuestIpType.Virtual, useLocalStorage, true, null); + routerRamSize, 0, 0, 0, false, null, useLocalStorage, true, null); soDomainRouter.setId(seq++); soDomainRouter.setUniqueName("Cloud.Com-SoftwareRouter"); soDomainRouter = _serviceOffering21Dao.persist(soDomainRouter); diff --git a/server/src/com/cloud/migration/ServiceOffering20VO.java b/server/src/com/cloud/migration/ServiceOffering20VO.java index 32af408537e..2189dc12f22 100644 --- a/server/src/com/cloud/migration/ServiceOffering20VO.java +++ b/server/src/com/cloud/migration/ServiceOffering20VO.java @@ -18,19 +18,20 @@ package com.cloud.migration; -import java.util.Date; - -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; -import javax.persistence.Table; - -import com.cloud.network.Network; -import com.cloud.utils.db.GenericDao; +import java.util.Date; + +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; +import javax.persistence.Table; + +import com.cloud.dc.Vlan; +import com.cloud.dc.Vlan.VlanType; +import com.cloud.utils.db.GenericDao; @Entity @Table(name="service_offering") @@ -69,7 +70,7 @@ public class ServiceOffering20VO { @Column(name="guest_ip_type") @Enumerated(EnumType.STRING) - private Network.GuestIpType guestIpType = Network.GuestIpType.Virtual; + private Vlan.VlanType guestIpType = Vlan.VlanType.VirtualNetwork; @Column(name="use_local_storage") private boolean useLocalStorage; @@ -84,10 +85,10 @@ public class ServiceOffering20VO { } public ServiceOffering20VO(Long id, String name, int cpu, int ramSize, int speed, int rateMbps, int multicastRateMbps, boolean offerHA, String displayText, boolean localStorageRequired) { - this(id, name, cpu, ramSize, speed, rateMbps, multicastRateMbps, offerHA, displayText, Network.GuestIpType.Virtual, localStorageRequired); + this(id, name, cpu, ramSize, speed, rateMbps, multicastRateMbps, offerHA, displayText, Vlan.VlanType.VirtualNetwork, localStorageRequired); } - public ServiceOffering20VO(Long id, String name, int cpu, int ramSize, int speed, int rateMbps, int multicastRateMbps, boolean offerHA, String displayText, Network.GuestIpType guestIpType, boolean useLocalStorage) { + public ServiceOffering20VO(Long id, String name, int cpu, int ramSize, int speed, int rateMbps, int multicastRateMbps, boolean offerHA, String displayText, VlanType guestIpType, boolean useLocalStorage) { this.id = id; this.name = name; this.cpu = cpu; @@ -185,11 +186,11 @@ public class ServiceOffering20VO { return multicastRateMbps; } - public void setGuestIpType(Network.GuestIpType guestIpType) { + public void setGuestIpType(Vlan.VlanType guestIpType) { this.guestIpType = guestIpType; } - public Network.GuestIpType getGuestIpType() { + public Vlan.VlanType getGuestIpType() { return guestIpType; } diff --git a/server/src/com/cloud/migration/ServiceOffering21VO.java b/server/src/com/cloud/migration/ServiceOffering21VO.java index 37b34fc0c60..345d3929caf 100644 --- a/server/src/com/cloud/migration/ServiceOffering21VO.java +++ b/server/src/com/cloud/migration/ServiceOffering21VO.java @@ -18,17 +18,14 @@ package com.cloud.migration; -import javax.persistence.Column; -import javax.persistence.DiscriminatorValue; -import javax.persistence.Entity; -import javax.persistence.EnumType; -import javax.persistence.Enumerated; -import javax.persistence.PrimaryKeyJoinColumn; -import javax.persistence.Table; -import javax.persistence.Transient; - -import com.cloud.network.Network; -import com.cloud.offering.ServiceOffering; +import javax.persistence.Column; +import javax.persistence.DiscriminatorValue; +import javax.persistence.Entity; +import javax.persistence.PrimaryKeyJoinColumn; +import javax.persistence.Table; +import javax.persistence.Transient; + +import com.cloud.offering.ServiceOffering; @Entity @Table(name="service_offering_21") @@ -53,10 +50,6 @@ public class ServiceOffering21VO extends DiskOffering21VO implements ServiceOffe @Column(name="ha_enabled") private boolean offerHA; - @Column(name="guest_ip_type") - @Enumerated(EnumType.STRING) - private Network.GuestIpType guestIpType; - @Column(name="host_tag") private String hostTag; @@ -64,7 +57,7 @@ public class ServiceOffering21VO extends DiskOffering21VO implements ServiceOffe super(); } - public ServiceOffering21VO(String name, int cpu, int ramSize, int speed, Integer rateMbps, Integer multicastRateMbps, boolean offerHA, String displayText, Network.GuestIpType guestIpType, boolean useLocalStorage, boolean recreatable, String tags) { + public ServiceOffering21VO(String name, int cpu, int ramSize, int speed, Integer rateMbps, Integer multicastRateMbps, boolean offerHA, String displayText, boolean useLocalStorage, boolean recreatable, String tags) { super(name, displayText, false, tags, recreatable, useLocalStorage); this.cpu = cpu; this.ramSize = ramSize; @@ -72,11 +65,10 @@ public class ServiceOffering21VO extends DiskOffering21VO implements ServiceOffe this.rateMbps = rateMbps; this.multicastRateMbps = multicastRateMbps; this.offerHA = offerHA; - this.guestIpType = guestIpType; } - public ServiceOffering21VO(String name, int cpu, int ramSize, int speed, Integer rateMbps, Integer multicastRateMbps, boolean offerHA, String displayText, Network.GuestIpType guestIpType, boolean useLocalStorage, boolean recreatable, String tags, String hostTag) { - this(name, cpu, ramSize, speed, rateMbps, multicastRateMbps, offerHA, displayText, guestIpType, useLocalStorage, recreatable, tags); + public ServiceOffering21VO(String name, int cpu, int ramSize, int speed, Integer rateMbps, Integer multicastRateMbps, boolean offerHA, String displayText, boolean useLocalStorage, boolean recreatable, String tags, String hostTag) { + this(name, cpu, ramSize, speed, rateMbps, multicastRateMbps, offerHA, displayText, useLocalStorage, recreatable, tags); this.hostTag = hostTag; } @@ -151,10 +143,6 @@ public class ServiceOffering21VO extends DiskOffering21VO implements ServiceOffe return multicastRateMbps; } - public void setGuestIpType(Network.GuestIpType guestIpType) { - this.guestIpType = guestIpType; - } - public String gethypervisorType() { return null; } diff --git a/server/src/com/cloud/network/ExternalNetworkDeviceManagerImpl.java b/server/src/com/cloud/network/ExternalNetworkDeviceManagerImpl.java index 83bfa1d1359..e3688fae8cb 100644 --- a/server/src/com/cloud/network/ExternalNetworkDeviceManagerImpl.java +++ b/server/src/com/cloud/network/ExternalNetworkDeviceManagerImpl.java @@ -1204,7 +1204,7 @@ public class ExternalNetworkDeviceManagerImpl implements ExternalNetworkDeviceMa try { txn.start(); - List networksForAccount = _networkDao.listBy(accountId, zoneId, Network.GuestIpType.Virtual); + List networksForAccount = _networkDao.listBy(accountId, zoneId, Network.Type.Isolated); for (NetworkVO network : networksForAccount) { String networkErrorMsg = accountErrorMsg + ", network ID = " + network.getId(); diff --git a/server/src/com/cloud/network/NetworkManager.java b/server/src/com/cloud/network/NetworkManager.java index 5fc88d1f594..3f2c9951739 100644 --- a/server/src/com/cloud/network/NetworkManager.java +++ b/server/src/com/cloud/network/NetworkManager.java @@ -29,7 +29,6 @@ import com.cloud.exception.InsufficientAddressCapacityException; import com.cloud.exception.InsufficientCapacityException; import com.cloud.exception.ResourceUnavailableException; import com.cloud.network.Network.Capability; -import com.cloud.network.Network.GuestIpType; import com.cloud.network.Network.Provider; import com.cloud.network.Network.Service; import com.cloud.network.Networks.TrafficType; @@ -203,7 +202,7 @@ public interface NetworkManager extends NetworkService { String getIpOfNetworkElementInVirtualNetwork(long accountId, long dataCenterId); - List listNetworksForAccount(long accountId, long zoneId, GuestIpType guestType, Boolean isDefault); + List listNetworksForAccount(long accountId, long zoneId, Network.Type type, Boolean isDefault); IPAddressVO markIpAsUnavailable(long addrId); diff --git a/server/src/com/cloud/network/NetworkManagerImpl.java b/server/src/com/cloud/network/NetworkManagerImpl.java index 90f9d51c1ed..142db9a8bac 100755 --- a/server/src/com/cloud/network/NetworkManagerImpl.java +++ b/server/src/com/cloud/network/NetworkManagerImpl.java @@ -90,7 +90,6 @@ import com.cloud.exception.ResourceUnavailableException; import com.cloud.exception.UnsupportedServiceException; import com.cloud.network.IpAddress.State; import com.cloud.network.Network.Capability; -import com.cloud.network.Network.GuestIpType; import com.cloud.network.Network.Provider; import com.cloud.network.Network.Service; import com.cloud.network.Networks.AddressFormat; @@ -367,12 +366,10 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag // Save usage event if (owner.getAccountId() != Account.ACCOUNT_ID_SYSTEM) { - long networkId = addr.getSourceNetworkId(); - NetworkVO network = _networksDao.findByIdIncludingRemoved(networkId); - String guestType = ""; - if( (network != null) && (network.getGuestType() != null) ){ - guestType = network.getGuestType().toString(); - } + VlanVO vlan = _vlanDao.findById(addr.getVlanId()); + + String guestType = vlan.getVlanType().toString(); + UsageEventVO usageEvent = new UsageEventVO(EventTypes.EVENT_NET_IP_ASSIGN, owner.getId(), addr.getDataCenterId(), addr.getId(), addr.getAddress().toString(), isSourceNat, guestType); _usageEventDao.persist(usageEvent); // don't increment resource count for direct ip addresses @@ -556,7 +553,7 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag @Override public List getVirtualNetworksOwnedByAccountInZone(long zoneId, Account owner) { - return _networksDao.listBy(owner.getId(), zoneId, GuestIpType.Virtual); + return _networksDao.listBy(owner.getId(), zoneId, Network.Type.Isolated); } @Override @@ -1017,7 +1014,7 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag NetworkVO vo = new NetworkVO(id, network, offering.getId(), guru.getName(), owner.getDomainId(), owner.getId(), related, name, displayText, isDefault, predefined.isSecurityGroupEnabled(), (domainId != null), predefined.getNetworkDomain(), offering.getType(), isShared, plan.getDataCenterId(), plan.getPhysicalNetworkId()); vo.setTags(tags); - networks.add(_networksDao.persist(vo, vo.getGuestType() != null)); + networks.add(_networksDao.persist(vo, vo.getType() == Network.Type.Isolated)); if (domainId != null) { _networksDao.addDomainToNetwork(id, domainId); @@ -1691,10 +1688,10 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag cidr = NetUtils.ipAndNetMaskToCidr(gateway, netmask); } - // Regular user can create guest virtual network only - if (caller.getType() == Account.ACCOUNT_TYPE_NORMAL && (networkOffering.getTrafficType() != TrafficType.Guest || networkOffering.getGuestType() != GuestIpType.Virtual)) { - throw new InvalidParameterValueException("Regular user can create a network only from the network offering having traffic type " + TrafficType.Guest + " and Guest Ip type " - + GuestIpType.Virtual); + // Regular user can create Guest Isolated network only + if (caller.getType() == Account.ACCOUNT_TYPE_NORMAL && (networkOffering.getTrafficType() != TrafficType.Guest || networkOffering.getType() != Network.Type.Isolated)) { + throw new InvalidParameterValueException("Regular user can create a network only from the network offering having traffic type " + TrafficType.Guest + " and network type " + + Network.Type.Isolated); } // Don't allow to specify cidr if the caller is a regular user @@ -1781,9 +1778,9 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag throw new InvalidParameterValueException("Can't specify vlan because network offering doesn't support it"); } - // Don't allow to create guest virtual network with Vlan specified - if (networkOffering.getGuestType() == GuestIpType.Virtual && vlanId != null) { - throw new InvalidParameterValueException("Can't specify vlan when create network with Guest IP Type " + GuestIpType.Virtual); + // Don't allow to create guest isolated network with Vlan specified + if (networkOffering.getType() == Network.Type.Isolated && vlanId != null) { + throw new InvalidParameterValueException("Can't specify vlan when create " + Network.Type.Isolated + " network"); } // If networkDomain is not specified, take it from the global configuration @@ -1825,12 +1822,12 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag // Cidr for Direct network can't be NULL - 2.2.x limitation, remove after we introduce support for multiple ip ranges // with different Cidrs for the same Shared network - if (cidr == null && networkOffering.getTrafficType() == TrafficType.Guest && networkOffering.getGuestType() == GuestIpType.Direct) { + if (cidr == null && networkOffering.getTrafficType() == TrafficType.Guest && networkOffering.getType() == Network.Type.Shared) { throw new InvalidParameterValueException("StartIp/endIp/gateway/netmask are required for Direct network creation"); } - // Check if cidr is RFC1918 compliant if the network is Guest Virtual - if (cidr != null && networkOffering.getGuestType() == GuestIpType.Virtual && networkOffering.getTrafficType() == TrafficType.Guest) { + // Check if cidr is RFC1918 compliant if the network is Guest Isolated + if (cidr != null && networkOffering.getType() == Network.Type.Isolated && networkOffering.getTrafficType() == TrafficType.Guest) { if (!NetUtils.validateGuestCidr(cidr)) { throw new InvalidParameterValueException("Virtual Guest Cidr " + cidr + " is not RFC1918 compliant"); } @@ -2976,7 +2973,7 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag @Override public String getIpOfNetworkElementInVirtualNetwork(long accountId, long dataCenterId) { - List virtualNetworks = _networksDao.listBy(accountId, dataCenterId, GuestIpType.Virtual); + List virtualNetworks = _networksDao.listBy(accountId, dataCenterId, Network.Type.Isolated); if (virtualNetworks.isEmpty()) { s_logger.trace("Unable to find default Virtual network account id=" + accountId); @@ -2996,7 +2993,7 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag } @Override - public List listNetworksForAccount(long accountId, long zoneId, GuestIpType guestType, Boolean isDefault) { + public List listNetworksForAccount(long accountId, long zoneId, Network.Type type, Boolean isDefault) { List accountNetworks = new ArrayList(); List zoneNetworks = _networksDao.listByZone(zoneId); @@ -3004,7 +3001,7 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag NetworkOfferingVO no = _networkOfferingDao.findById(network.getNetworkOfferingId()); if (!no.isSystemOnly()) { if (network.getType() == Network.Type.Shared || !_networksDao.listBy(accountId, network.getId()).isEmpty()) { - if ((guestType == null || guestType == network.getGuestType()) && (isDefault == null || isDefault.booleanValue() == network.isDefault)) { + if ((type == null || type == network.getType()) && (isDefault == null || isDefault.booleanValue() == network.isDefault)) { accountNetworks.add(network); } } @@ -3038,10 +3035,9 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag // Save usage event if (ip.getAccountId() != Account.ACCOUNT_ID_SYSTEM) { NetworkVO network = _networksDao.findByIdIncludingRemoved(ip.getSourceNetworkId()); - String guestType = ""; - if( (network != null) && (network.getGuestType() != null)){ - guestType = network.getGuestType().toString(); - } + VlanVO vlan = _vlanDao.findById(ip.getVlanId()); + + String guestType = vlan.getVlanType().toString(); UsageEventVO usageEvent = new UsageEventVO(EventTypes.EVENT_NET_IP_RELEASE, ip.getAccountId(), ip.getDataCenterId(), addrId, ip.getAddress().addr(), isSourceNat, guestType); _usageEventDao.persist(usageEvent); @@ -3217,7 +3213,7 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag if (vm != null) { if (vm.getType() == Type.User && network.isDefault()) { isUserVmsDefaultNetwork = true; - } else if (vm.getType() == Type.DomainRouter && ((ntwkOff.getTrafficType() == TrafficType.Public && ntwkOff.getGuestType() == null) || (ntwkOff.getGuestType() != null && ntwkOff.getTrafficType() == TrafficType.Guest))) { + } else if (vm.getType() == Type.DomainRouter && (ntwkOff.getTrafficType() == TrafficType.Public || ntwkOff.getTrafficType() == TrafficType.Guest)) { isDomRGuestOrPublicNetwork = true; } } diff --git a/server/src/com/cloud/network/NetworkUsageManagerImpl.java b/server/src/com/cloud/network/NetworkUsageManagerImpl.java index d2a98f4caf5..664e9f7a8c1 100644 --- a/server/src/com/cloud/network/NetworkUsageManagerImpl.java +++ b/server/src/com/cloud/network/NetworkUsageManagerImpl.java @@ -62,7 +62,6 @@ import com.cloud.host.HostVO; import com.cloud.host.Status; import com.cloud.host.dao.HostDao; import com.cloud.host.dao.HostDetailsDao; -import com.cloud.network.Network.GuestIpType; import com.cloud.network.dao.IPAddressDao; import com.cloud.network.dao.NetworkDao; import com.cloud.network.resource.TrafficSentinelResource; @@ -215,7 +214,7 @@ public class NetworkUsageManagerImpl implements NetworkUsageManager { AllocatedIpSearch.and("allocated", AllocatedIpSearch.entity().getAllocatedTime(), Op.NNULL); AllocatedIpSearch.and("dc", AllocatedIpSearch.entity().getDataCenterId(), Op.EQ); SearchBuilder networkJoin = _networksDao.createSearchBuilder(); - networkJoin.and("guestType", networkJoin.entity().getGuestType(), Op.EQ); + networkJoin.and("type", networkJoin.entity().getType(), Op.EQ); AllocatedIpSearch.join("network", networkJoin, AllocatedIpSearch.entity().getSourceNetworkId(), networkJoin.entity().getId(), JoinBuilder.JoinType.INNER); AllocatedIpSearch.done(); @@ -243,7 +242,7 @@ public class NetworkUsageManagerImpl implements NetworkUsageManager { public List listAllocatedDirectIps(long zoneId) { SearchCriteria sc = AllocatedIpSearch.create(); sc.setParameters("dc", zoneId); - sc.setJoinParameters("network", "guestType", GuestIpType.Direct); + sc.setJoinParameters("network", "type", Network.Type.Shared); return _ipAddressDao.search(sc, null); } diff --git a/server/src/com/cloud/network/NetworkVO.java b/server/src/com/cloud/network/NetworkVO.java index 2af1f1a555e..9928ec673b9 100644 --- a/server/src/com/cloud/network/NetworkVO.java +++ b/server/src/com/cloud/network/NetworkVO.java @@ -66,10 +66,6 @@ public class NetworkVO implements Network { @Enumerated(value=EnumType.STRING) TrafficType trafficType; - @Deprecated - @Column(name="guest_type") - GuestIpType guestType; - @Column(name="name") String name; @@ -172,7 +168,7 @@ public class NetworkVO implements Network { * @param dataCenterId * @param physicalNetworkId TODO */ - public NetworkVO(TrafficType trafficType, GuestIpType guestType, Mode mode, BroadcastDomainType broadcastDomainType, long networkOfferingId, State state, long dataCenterId, Long physicalNetworkId) { + public NetworkVO(TrafficType trafficType, Mode mode, BroadcastDomainType broadcastDomainType, long networkOfferingId, State state, long dataCenterId, Long physicalNetworkId) { this.trafficType = trafficType; this.mode = mode; this.broadcastDomainType = broadcastDomainType; @@ -185,11 +181,10 @@ public class NetworkVO implements Network { this.state = state; } this.id = -1; - this.guestType = guestType; } public NetworkVO(long id, Network that, long offeringId, String guruName, long domainId, long accountId, long related, String name, String displayText, boolean isDefault, boolean isSecurityGroupEnabled, boolean isDomainSpecific, String networkDomain, Type type, boolean isShared, long dcId, Long physicalNetworkId) { - this(id, that.getTrafficType(), that.getGuestType(), that.getMode(), that.getBroadcastDomainType(), offeringId, domainId, accountId, related, name, displayText,isDefault, isDomainSpecific, networkDomain, type, isShared, dcId, physicalNetworkId); + this(id, that.getTrafficType(), that.getMode(), that.getBroadcastDomainType(), offeringId, domainId, accountId, related, name, displayText, isDefault,isDomainSpecific, networkDomain, type, isShared, dcId, physicalNetworkId); this.gateway = that.getGateway(); this.cidr = that.getCidr(); this.broadcastUri = that.getBroadcastUri(); @@ -208,7 +203,6 @@ public class NetworkVO implements Network { * @param mode * @param broadcastDomainType * @param networkOfferingId - * @param dataCenterId * @param domainId * @param accountId * @param name @@ -219,9 +213,10 @@ public class NetworkVO implements Network { * @param type TODO * @param isShared TODO * @param isShared + * @param dataCenterId */ - public NetworkVO(long id, TrafficType trafficType, GuestIpType guestType, Mode mode, BroadcastDomainType broadcastDomainType, long networkOfferingId, long domainId, long accountId, long related, String name, String displayText, boolean isDefault, boolean isDomainSpecific, String networkDomain, Type type, boolean isShared, long dcId, Long physicalNetworkId) { - this(trafficType, guestType, mode, broadcastDomainType, networkOfferingId, State.Allocated, dcId, physicalNetworkId); + public NetworkVO(long id, TrafficType trafficType, Mode mode, BroadcastDomainType broadcastDomainType, long networkOfferingId, long domainId, long accountId, long related, String name, String displayText, boolean isDefault, boolean isDomainSpecific, String networkDomain, Type type, boolean isShared, long dcId, Long physicalNetworkId) { + this(trafficType, mode, broadcastDomainType, networkOfferingId, State.Allocated, dcId, physicalNetworkId); this.domainId = domainId; this.accountId = accountId; this.related = related; @@ -279,11 +274,6 @@ public class NetworkVO implements Network { this.tags = tags; } - @Override - public GuestIpType getGuestType() { - return guestType; - } - @Override public Mode getMode() { return mode; diff --git a/server/src/com/cloud/network/dao/NetworkDao.java b/server/src/com/cloud/network/dao/NetworkDao.java index e27a8fb58e4..001df77b9f7 100644 --- a/server/src/com/cloud/network/dao/NetworkDao.java +++ b/server/src/com/cloud/network/dao/NetworkDao.java @@ -19,7 +19,7 @@ package com.cloud.network.dao; import java.util.List; -import com.cloud.network.Network.GuestIpType; +import com.cloud.network.Network; import com.cloud.network.NetworkAccountVO; import com.cloud.network.NetworkVO; import com.cloud.utils.db.GenericDao; @@ -30,7 +30,7 @@ public interface NetworkDao extends GenericDao { List listByOwner(long ownerId); List listBy(long accountId, long offeringId, long dataCenterId); List listBy(long accountId, long offeringId, long dataCenterId, String cidr); - List listBy(long accountId, long dataCenterId, GuestIpType type); + List listBy(long accountId, long dataCenterId, Network.Type type); NetworkVO persist(NetworkVO network, boolean gc); void addAccountToNetwork(long networkId, long accountId); SearchBuilder createSearchBuilderForAccount(); diff --git a/server/src/com/cloud/network/dao/NetworkDaoImpl.java b/server/src/com/cloud/network/dao/NetworkDaoImpl.java index 129b6b114c9..ba708971189 100644 --- a/server/src/com/cloud/network/dao/NetworkDaoImpl.java +++ b/server/src/com/cloud/network/dao/NetworkDaoImpl.java @@ -24,7 +24,6 @@ import javax.ejb.Local; import javax.persistence.TableGenerator; import com.cloud.network.Network; -import com.cloud.network.Network.GuestIpType; import com.cloud.network.NetworkAccountDaoImpl; import com.cloud.network.NetworkAccountVO; import com.cloud.network.NetworkDomainVO; @@ -76,7 +75,6 @@ public class NetworkDaoImpl extends GenericDaoBase implements N AllFieldsSearch.and("offering", AllFieldsSearch.entity().getNetworkOfferingId(), Op.EQ); AllFieldsSearch.and("datacenter", AllFieldsSearch.entity().getDataCenterId(), Op.EQ); AllFieldsSearch.and("account", AllFieldsSearch.entity().getAccountId(), Op.EQ); - AllFieldsSearch.and("guesttype", AllFieldsSearch.entity().getGuestType(), Op.EQ); AllFieldsSearch.and("related", AllFieldsSearch.entity().getRelated(), Op.EQ); AllFieldsSearch.and("type", AllFieldsSearch.entity().getType(), Op.EQ); AllFieldsSearch.and("physicalNetwork", AllFieldsSearch.entity().getPhysicalNetworkId(), Op.EQ); @@ -137,12 +135,12 @@ public class NetworkDaoImpl extends GenericDaoBase implements N } @Override - public List listBy(long accountId, long dataCenterId, GuestIpType type) { + public List listBy(long accountId, long dataCenterId, Network.Type type) { SearchCriteria sc = AllFieldsSearch.create(); sc.setParameters("datacenter", dataCenterId); sc.setParameters("account", accountId); if (type != null) { - sc.setParameters("guesttype", type); + sc.setParameters("type", type); } return listBy(sc, null); } @@ -166,12 +164,6 @@ public class NetworkDaoImpl extends GenericDaoBase implements N return listBy(sc); } - // @Override - // public void loadTags(NetworkVO network) { - // network.setTags(_tagDao.getTags(network.getId())); - // } - - @Override public List listBy(long accountId, long offeringId, long dataCenterId) { SearchCriteria sc = AccountSearch.create(); diff --git a/server/src/com/cloud/network/element/RedundantVirtualRouterElement.java b/server/src/com/cloud/network/element/RedundantVirtualRouterElement.java index 72adee1fc9d..4e5ae3ad771 100644 --- a/server/src/com/cloud/network/element/RedundantVirtualRouterElement.java +++ b/server/src/com/cloud/network/element/RedundantVirtualRouterElement.java @@ -14,15 +14,13 @@ import com.cloud.exception.ConcurrentOperationException; import com.cloud.exception.InsufficientCapacityException; import com.cloud.exception.ResourceUnavailableException; import com.cloud.network.Network; -import com.cloud.network.Network.GuestIpType; import com.cloud.network.Network.Provider; import com.cloud.network.Network.Service; import com.cloud.network.Network.Type; import com.cloud.network.NetworkManager; -import com.cloud.network.router.VirtualRouter; import com.cloud.network.dao.VirtualRouterElementsDao; -import com.cloud.network.element.RedundantVirtualRouterElementService; import com.cloud.network.element.VirtualRouterElements.VirtualRouterElementsType; +import com.cloud.network.router.VirtualRouter; import com.cloud.offering.NetworkOffering; import com.cloud.uservm.UserVm; import com.cloud.utils.component.Inject; @@ -42,7 +40,7 @@ public class RedundantVirtualRouterElement extends VirtualRouterElement implemen private boolean canHandle(Type networkType, long offeringId) { boolean result = (networkType == Network.Type.Isolated && _networkMgr.isProviderSupported(offeringId, Service.Gateway, Provider.VirtualRouter)); if (!result) { - s_logger.trace("Virtual router element only takes care of guest ip type " + GuestIpType.Virtual + " for provider " + Provider.VirtualRouter.getName()); + s_logger.trace("Virtual router element only takes care of networktype " + Network.Type.Isolated + " for provider " + Provider.VirtualRouter.getName()); } return result; } diff --git a/server/src/com/cloud/network/guru/ControlNetworkGuru.java b/server/src/com/cloud/network/guru/ControlNetworkGuru.java index 6d40fe00016..9e29f328eec 100644 --- a/server/src/com/cloud/network/guru/ControlNetworkGuru.java +++ b/server/src/com/cloud/network/guru/ControlNetworkGuru.java @@ -77,7 +77,7 @@ public class ControlNetworkGuru extends PodBasedNetworkGuru implements NetworkGu return null; } - NetworkVO config = new NetworkVO(offering.getTrafficType(), offering.getGuestType(), Mode.Static, BroadcastDomainType.LinkLocal, offering.getId(), Network.State.Setup, plan.getDataCenterId(), plan.getPhysicalNetworkId()); + NetworkVO config = new NetworkVO(offering.getTrafficType(), Mode.Static, BroadcastDomainType.LinkLocal, offering.getId(), Network.State.Setup, plan.getDataCenterId(), plan.getPhysicalNetworkId()); config.setCidr(_cidr); config.setGateway(_gateway); diff --git a/server/src/com/cloud/network/guru/DirectNetworkGuru.java b/server/src/com/cloud/network/guru/DirectNetworkGuru.java index 72c5e6ba6a5..0d5219ec8c8 100644 --- a/server/src/com/cloud/network/guru/DirectNetworkGuru.java +++ b/server/src/com/cloud/network/guru/DirectNetworkGuru.java @@ -102,7 +102,7 @@ public class DirectNetworkGuru extends AdapterBase implements NetworkGuru { state = State.Setup; } - NetworkVO config = new NetworkVO(offering.getTrafficType(), offering.getGuestType(), Mode.Dhcp, BroadcastDomainType.Vlan, offering.getId(), state, plan.getDataCenterId(), plan.getPhysicalNetworkId()); + NetworkVO config = new NetworkVO(offering.getTrafficType(), Mode.Dhcp, BroadcastDomainType.Vlan, offering.getId(), state, plan.getDataCenterId(), plan.getPhysicalNetworkId()); if (userSpecified != null) { if ((userSpecified.getCidr() == null && userSpecified.getGateway() != null) || (userSpecified.getCidr() != null && userSpecified.getGateway() == null)) { diff --git a/server/src/com/cloud/network/guru/ExternalGuestNetworkGuru.java b/server/src/com/cloud/network/guru/ExternalGuestNetworkGuru.java index 9d811ea05c1..5bca18cecaa 100644 --- a/server/src/com/cloud/network/guru/ExternalGuestNetworkGuru.java +++ b/server/src/com/cloud/network/guru/ExternalGuestNetworkGuru.java @@ -108,8 +108,8 @@ public class ExternalGuestNetworkGuru extends GuestNetworkGuru { } DataCenter zone = dest.getDataCenter(); - NetworkVO implemented = new NetworkVO(config.getTrafficType(), config.getGuestType(), config.getMode(), config.getBroadcastDomainType(), config.getNetworkOfferingId(), - State.Allocated, config.getDataCenterId(), config.getPhysicalNetworkId()); + NetworkVO implemented = new NetworkVO(config.getTrafficType(), config.getMode(), config.getBroadcastDomainType(), config.getNetworkOfferingId(), State.Allocated, + config.getDataCenterId(), config.getPhysicalNetworkId()); // Get a vlan tag int vlanTag; diff --git a/server/src/com/cloud/network/guru/GuestNetworkGuru.java b/server/src/com/cloud/network/guru/GuestNetworkGuru.java index ad5fc13cd1b..de424c36e9e 100644 --- a/server/src/com/cloud/network/guru/GuestNetworkGuru.java +++ b/server/src/com/cloud/network/guru/GuestNetworkGuru.java @@ -34,7 +34,6 @@ import com.cloud.exception.InsufficientAddressCapacityException; import com.cloud.exception.InsufficientVirtualNetworkCapcityException; import com.cloud.exception.InvalidParameterValueException; import com.cloud.network.Network; -import com.cloud.network.Network.GuestIpType; import com.cloud.network.Network.State; import com.cloud.network.NetworkManager; import com.cloud.network.NetworkProfile; @@ -79,8 +78,8 @@ public class GuestNetworkGuru extends AdapterBase implements NetworkGuru { } protected boolean canHandle(NetworkOffering offering, DataCenter dc) { - // This guru handles only non-system Guest network - if (dc.getNetworkType() == NetworkType.Advanced && offering.getTrafficType() == TrafficType.Guest && offering.getGuestType() == GuestIpType.Virtual && !offering.isSystemOnly()) { + // This guru handles only non-system Guest Isolated network + if (dc.getNetworkType() == NetworkType.Advanced && offering.getTrafficType() == TrafficType.Guest && offering.getType() == Network.Type.Isolated && !offering.isSystemOnly()) { return true; } else { s_logger.trace("We only take care of Guest Virtual networks in zone of type " + NetworkType.Advanced); @@ -95,7 +94,7 @@ public class GuestNetworkGuru extends AdapterBase implements NetworkGuru { return null; } - NetworkVO network = new NetworkVO(offering.getTrafficType(), offering.getGuestType(), Mode.Dhcp, BroadcastDomainType.Vlan, offering.getId(), State.Allocated, plan.getDataCenterId(), plan.getPhysicalNetworkId()); + NetworkVO network = new NetworkVO(offering.getTrafficType(), Mode.Dhcp, BroadcastDomainType.Vlan, offering.getId(), State.Allocated, plan.getDataCenterId(), plan.getPhysicalNetworkId()); if (userSpecified != null) { if ((userSpecified.getCidr() == null && userSpecified.getGateway() != null) || (userSpecified.getCidr() != null && userSpecified.getGateway() == null)) { throw new InvalidParameterValueException("cidr and gateway must be specified together."); @@ -140,8 +139,8 @@ public class GuestNetworkGuru extends AdapterBase implements NetworkGuru { long dcId = dest.getDataCenter().getId(); - NetworkVO implemented = new NetworkVO(network.getTrafficType(), network.getGuestType(), network.getMode(), network.getBroadcastDomainType(), network.getNetworkOfferingId(), - State.Allocated, network.getDataCenterId(), network.getPhysicalNetworkId()); + NetworkVO implemented = new NetworkVO(network.getTrafficType(), network.getMode(), network.getBroadcastDomainType(), network.getNetworkOfferingId(), State.Allocated, + network.getDataCenterId(), network.getPhysicalNetworkId()); if (network.getBroadcastUri() == null) { String vnet = _dcDao.allocateVnet(dcId, network.getPhysicalNetworkId(), network.getAccountId(), context.getReservationId()); diff --git a/server/src/com/cloud/network/guru/PodBasedNetworkGuru.java b/server/src/com/cloud/network/guru/PodBasedNetworkGuru.java index c7505c1d969..837b76ad208 100644 --- a/server/src/com/cloud/network/guru/PodBasedNetworkGuru.java +++ b/server/src/com/cloud/network/guru/PodBasedNetworkGuru.java @@ -69,7 +69,7 @@ public class PodBasedNetworkGuru extends AdapterBase implements NetworkGuru { return null; } - NetworkVO config = new NetworkVO(type, null, Mode.Static, BroadcastDomainType.Native, offering.getId(), Network.State.Setup, plan.getDataCenterId(), plan.getPhysicalNetworkId()); + NetworkVO config = new NetworkVO(type, Mode.Static, BroadcastDomainType.Native, offering.getId(), Network.State.Setup, plan.getDataCenterId(), plan.getPhysicalNetworkId()); return config; } diff --git a/server/src/com/cloud/network/guru/PublicNetworkGuru.java b/server/src/com/cloud/network/guru/PublicNetworkGuru.java index 0c175dee09a..a4a1bb7a832 100644 --- a/server/src/com/cloud/network/guru/PublicNetworkGuru.java +++ b/server/src/com/cloud/network/guru/PublicNetworkGuru.java @@ -94,7 +94,7 @@ public class PublicNetworkGuru extends AdapterBase implements NetworkGuru { } if (offering.getTrafficType() == TrafficType.Public) { - NetworkVO ntwk = new NetworkVO(offering.getTrafficType(), null, Mode.Static, BroadcastDomainType.Vlan, offering.getId(), State.Setup, plan.getDataCenterId(), plan.getPhysicalNetworkId()); + NetworkVO ntwk = new NetworkVO(offering.getTrafficType(), Mode.Static, BroadcastDomainType.Vlan, offering.getId(), State.Setup, plan.getDataCenterId(), plan.getPhysicalNetworkId()); return ntwk; } else { return null; diff --git a/server/src/com/cloud/network/lb/ElasticLoadBalancerManagerImpl.java b/server/src/com/cloud/network/lb/ElasticLoadBalancerManagerImpl.java index 72092171a2d..caaf3d0ce16 100644 --- a/server/src/com/cloud/network/lb/ElasticLoadBalancerManagerImpl.java +++ b/server/src/com/cloud/network/lb/ElasticLoadBalancerManagerImpl.java @@ -75,7 +75,6 @@ import com.cloud.network.ElasticLbVmMapVO; import com.cloud.network.IPAddressVO; import com.cloud.network.LoadBalancerVO; import com.cloud.network.Network; -import com.cloud.network.Network.GuestIpType; import com.cloud.network.NetworkManager; import com.cloud.network.NetworkVO; import com.cloud.network.Networks.TrafficType; @@ -119,7 +118,6 @@ import com.cloud.vm.NicProfile; import com.cloud.vm.ReservationContext; import com.cloud.vm.VMInstanceVO; import com.cloud.vm.VirtualMachine; -import com.cloud.vm.VirtualMachineGuru; import com.cloud.vm.VirtualMachine.State; import com.cloud.vm.VirtualMachineGuru; import com.cloud.vm.VirtualMachineManager; @@ -574,7 +572,7 @@ public class ElasticLoadBalancerManagerImpl implements @DB public PublicIp allocIp(CreateLoadBalancerRuleCmd lb, Account account) throws InsufficientAddressCapacityException { //TODO: this only works in the guest network. Handle the public network case also. - List offerings = _networkOfferingDao.listByTrafficTypeAndGuestType(true, _frontendTrafficType, GuestIpType.Direct); + List offerings = _networkOfferingDao.listByTrafficTypeAndType(true, _frontendTrafficType, Network.Type.Shared); if (offerings == null || offerings.size() == 0) { s_logger.warn("ELB: Could not find system offering for direct networks of type " + _frontendTrafficType); return null; diff --git a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java index 311a1ced2b4..8d595b1197f 100755 --- a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java +++ b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java @@ -116,7 +116,6 @@ import com.cloud.network.IPAddressVO; import com.cloud.network.IpAddress; import com.cloud.network.LoadBalancerVO; import com.cloud.network.Network; -import com.cloud.network.Network.GuestIpType; import com.cloud.network.NetworkManager; import com.cloud.network.NetworkVO; import com.cloud.network.Networks.BroadcastDomainType; @@ -723,7 +722,7 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian @Override public void run() { - final List routers = _routerDao.listByStateAndNetworkType(State.Running, GuestIpType.Virtual, mgmtSrvrId); + final List routers = _routerDao.listByStateAndNetworkType(State.Running, Network.Type.Isolated, mgmtSrvrId); s_logger.debug("Found " + routers.size() + " running routers. "); for (DomainRouterVO router : routers) { diff --git a/server/src/com/cloud/offerings/NetworkOfferingVO.java b/server/src/com/cloud/offerings/NetworkOfferingVO.java index ae4ede64c55..c9458b7f4f9 100644 --- a/server/src/com/cloud/offerings/NetworkOfferingVO.java +++ b/server/src/com/cloud/offerings/NetworkOfferingVO.java @@ -29,7 +29,6 @@ import javax.persistence.Id; import javax.persistence.Table; import com.cloud.network.Network; -import com.cloud.network.Network.GuestIpType; import com.cloud.network.Network.Type; import com.cloud.network.Networks.TrafficType; import com.cloud.offering.NetworkOffering; @@ -82,10 +81,6 @@ public class NetworkOfferingVO implements NetworkOffering { @Enumerated(value=EnumType.STRING) Availability availability; - @Deprecated - @Column(name="guest_type") - GuestIpType guestType; - @Column(name="state") @Enumerated(value=EnumType.STRING) State state = State.Disabled; @@ -198,11 +193,6 @@ public class NetworkOfferingVO implements NetworkOffering { return sharedSourceNatService; } - @Override - public GuestIpType getGuestType() { - return guestType; - } - @Override public String getUniqueName() { return uniqueName; @@ -248,11 +238,6 @@ public class NetworkOfferingVO implements NetworkOffering { this.tags = tags; this.securityGroupEnabled = isSecurityGroupEnabled; this.type = type; - if (type == Type.Isolated) { - this.guestType = GuestIpType.Virtual; - } else if (type == Type.Shared){ - this.guestType = GuestIpType.Direct; - } } public NetworkOfferingVO() { diff --git a/server/src/com/cloud/offerings/dao/NetworkOfferingDao.java b/server/src/com/cloud/offerings/dao/NetworkOfferingDao.java index 40dae489f9b..48bac473689 100644 --- a/server/src/com/cloud/offerings/dao/NetworkOfferingDao.java +++ b/server/src/com/cloud/offerings/dao/NetworkOfferingDao.java @@ -23,7 +23,7 @@ package com.cloud.offerings.dao; import java.util.List; -import com.cloud.network.Network.GuestIpType; +import com.cloud.network.Network; import com.cloud.network.Networks.TrafficType; import com.cloud.offering.NetworkOffering; import com.cloud.offering.NetworkOffering.Availability; @@ -59,7 +59,7 @@ public interface NetworkOfferingDao extends GenericDao List listByAvailability(Availability availability, boolean isSystem); - List listByTrafficTypeAndGuestType(boolean isSystem, TrafficType trafficType, GuestIpType guestType); + List listByTrafficTypeAndType(boolean isSystem, TrafficType trafficType, Network.Type type); List getOfferingIdsToUpgradeFrom(NetworkOffering originalOffering); diff --git a/server/src/com/cloud/offerings/dao/NetworkOfferingDaoImpl.java b/server/src/com/cloud/offerings/dao/NetworkOfferingDaoImpl.java index 79ba402391c..c1eb059cd70 100644 --- a/server/src/com/cloud/offerings/dao/NetworkOfferingDaoImpl.java +++ b/server/src/com/cloud/offerings/dao/NetworkOfferingDaoImpl.java @@ -27,7 +27,7 @@ import java.util.List; import javax.ejb.Local; import javax.persistence.EntityExistsException; -import com.cloud.network.Network.GuestIpType; +import com.cloud.network.Network; import com.cloud.network.Networks.TrafficType; import com.cloud.offering.NetworkOffering; import com.cloud.offering.NetworkOffering.Availability; @@ -66,7 +66,7 @@ public class NetworkOfferingDaoImpl extends GenericDaoBase listByTrafficTypeAndGuestType(boolean isSystem, TrafficType trafficType, GuestIpType guestType) { + public List listByTrafficTypeAndType(boolean isSystem, TrafficType trafficType, Network.Type type) { SearchCriteria sc = TrafficTypeGuestTypeSearch.create(); sc.setParameters("trafficType", trafficType); - sc.setParameters("guestType", guestType); + sc.setParameters("type", type); sc.setParameters("isSystem", isSystem); return listBy(sc, null); } diff --git a/server/src/com/cloud/server/ConfigurationServerImpl.java b/server/src/com/cloud/server/ConfigurationServerImpl.java index 15e02578067..8f5289c2bf9 100644 --- a/server/src/com/cloud/server/ConfigurationServerImpl.java +++ b/server/src/com/cloud/server/ConfigurationServerImpl.java @@ -954,7 +954,7 @@ public class ConfigurationServerImpl implements ConfigurationServer { } if (broadcastDomainType != null) { - NetworkVO network = new NetworkVO(id, trafficType, null, mode, broadcastDomainType, networkOfferingId, domainId, accountId, related, null, null, isNetworkDefault, false, networkDomain, Network.Type.Shared, true, zoneId, null); + NetworkVO network = new NetworkVO(id, trafficType, mode, broadcastDomainType, networkOfferingId, domainId, accountId, related, null, null, isNetworkDefault, false, networkDomain, Network.Type.Shared, true, zoneId, null); network.setGuruName(guruNames.get(network.getTrafficType())); network.setDns1(zone.getDns1()); network.setDns2(zone.getDns2()); diff --git a/server/src/com/cloud/vm/UserVmManagerImpl.java b/server/src/com/cloud/vm/UserVmManagerImpl.java index 7eef0305235..8fd9ac2144d 100755 --- a/server/src/com/cloud/vm/UserVmManagerImpl.java +++ b/server/src/com/cloud/vm/UserVmManagerImpl.java @@ -117,7 +117,6 @@ import com.cloud.hypervisor.Hypervisor.HypervisorType; import com.cloud.hypervisor.dao.HypervisorCapabilitiesDao; import com.cloud.network.IPAddressVO; import com.cloud.network.Network; -import com.cloud.network.Network.GuestIpType; import com.cloud.network.Network.Provider; import com.cloud.network.NetworkManager; import com.cloud.network.NetworkVO; @@ -2170,10 +2169,10 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager // 2) If Availability=Optional, search for default networks for the account. If it's more than 1, throw an error. // If it's 0, and there are no default direct networks, create default Guest Virtual network - List defaultVirtualOffering = _networkOfferingDao.listByTrafficTypeAndGuestType(false, TrafficType.Guest, GuestIpType.Virtual); + List defaultVirtualOffering = _networkOfferingDao.listByTrafficTypeAndType(false, TrafficType.Guest, Network.Type.Isolated); if (defaultVirtualOffering.get(0).getAvailability() == Availability.Required) { // get Virtual netowrks - List virtualNetworks = _networkMgr.listNetworksForAccount(owner.getId(), zone.getId(), GuestIpType.Virtual, true); + List virtualNetworks = _networkMgr.listNetworksForAccount(owner.getId(), zone.getId(), Network.Type.Isolated, true); if (virtualNetworks.isEmpty()) { s_logger.debug("Creating default Virtual network for account " + owner + " as a part of deployVM process"); @@ -3333,7 +3332,7 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager } for (NetworkVO oldNet: oldNetworks){ long networkOffering = oldNet.getNetworkOfferingId(); - List virtualNetworks = _networkMgr.listNetworksForAccount(newAccount.getId(), zone.getId(), GuestIpType.Virtual, true); + List virtualNetworks = _networkMgr.listNetworksForAccount(newAccount.getId(), zone.getId(), Network.Type.Isolated, true); if (virtualNetworks.isEmpty()) { Network newNetwork = _networkMgr.createNetwork(networkOffering, newAccount.getAccountName() + "-network", newAccount.getAccountName() + "-network", null, null, null, null, null, newAccount, false, null, null, false, null); diff --git a/server/src/com/cloud/vm/dao/DomainRouterDao.java b/server/src/com/cloud/vm/dao/DomainRouterDao.java index 564d1e50cc3..f51a8347a61 100755 --- a/server/src/com/cloud/vm/dao/DomainRouterDao.java +++ b/server/src/com/cloud/vm/dao/DomainRouterDao.java @@ -19,7 +19,7 @@ package com.cloud.vm.dao; import java.util.List; -import com.cloud.network.Network.GuestIpType; +import com.cloud.network.Network; import com.cloud.network.router.VirtualRouter.Role; import com.cloud.utils.db.GenericDao; import com.cloud.vm.DomainRouterVO; @@ -97,7 +97,7 @@ public interface DomainRouterDao extends GenericDao { * List domain routers by state and network type which reside on Host managed by the specified management server * @return */ - List listByStateAndNetworkType(State state, GuestIpType ipType, long mgmtSrvrId); + List listByStateAndNetworkType(State state, Network.Type type, long mgmtSrvrId); List findByNetworkOutsideThePod(long networkId, long podId, State state, Role role); diff --git a/server/src/com/cloud/vm/dao/DomainRouterDaoImpl.java b/server/src/com/cloud/vm/dao/DomainRouterDaoImpl.java index 31405a04eeb..bb627744522 100755 --- a/server/src/com/cloud/vm/dao/DomainRouterDaoImpl.java +++ b/server/src/com/cloud/vm/dao/DomainRouterDaoImpl.java @@ -25,7 +25,7 @@ import org.apache.log4j.Logger; import com.cloud.host.HostVO; import com.cloud.host.dao.HostDaoImpl; -import com.cloud.network.Network.GuestIpType; +import com.cloud.network.Network; import com.cloud.network.NetworkVO; import com.cloud.network.dao.NetworkDaoImpl; import com.cloud.network.router.VirtualRouter.Role; @@ -75,14 +75,14 @@ public class DomainRouterDaoImpl extends GenericDaoBase im HostUpSearch.and("host", HostUpSearch.entity().getHostId(), Op.EQ); HostUpSearch.and("states", HostUpSearch.entity().getState(), Op.NIN); SearchBuilder joinNetwork = _networksDao.createSearchBuilder(); - joinNetwork.and("guestType", joinNetwork.entity().getGuestType(), Op.EQ); + joinNetwork.and("type", joinNetwork.entity().getType(), Op.EQ); HostUpSearch.join("network", joinNetwork, joinNetwork.entity().getId(), HostUpSearch.entity().getNetworkId(), JoinType.INNER); HostUpSearch.done(); StateNetworkTypeSearch = createSearchBuilder(); StateNetworkTypeSearch.and("state", StateNetworkTypeSearch.entity().getState(), Op.EQ); SearchBuilder joinStateNetwork = _networksDao.createSearchBuilder(); - joinStateNetwork.and("guestType", joinStateNetwork.entity().getGuestType(), Op.EQ); + joinStateNetwork.and("type", joinStateNetwork.entity().getType(), Op.EQ); StateNetworkTypeSearch.join("network", joinStateNetwork, joinStateNetwork.entity().getId(), StateNetworkTypeSearch.entity().getNetworkId(), JoinType.INNER); SearchBuilder joinHost = _hostsDao.createSearchBuilder(); joinHost.and("mgmtServerId", joinHost.entity().getManagementServerId(), Op.EQ); @@ -158,7 +158,7 @@ public class DomainRouterDaoImpl extends GenericDaoBase im if (hostId != null) { sc.setParameters("host", hostId); } - sc.setJoinParameters("network", "guestType", GuestIpType.Virtual); + sc.setJoinParameters("network", "type", Network.Type.Isolated); return listBy(sc); } @@ -169,7 +169,7 @@ public class DomainRouterDaoImpl extends GenericDaoBase im sc.setParameters("host", hostId); } sc.setParameters("states", State.Destroyed, State.Stopped, State.Expunging); - sc.setJoinParameters("network", "guestType", GuestIpType.Virtual); + sc.setJoinParameters("network", "type", Network.Type.Isolated); return listBy(sc); } @@ -204,10 +204,10 @@ public class DomainRouterDaoImpl extends GenericDaoBase im } @Override - public List listByStateAndNetworkType(State state, GuestIpType ipType, long mgmtSrvrId) { + public List listByStateAndNetworkType(State state, Network.Type type, long mgmtSrvrId) { SearchCriteria sc = StateNetworkTypeSearch.create(); sc.setParameters("state", state); - sc.setJoinParameters("network", "guestType", ipType); + sc.setJoinParameters("network", "type", type); sc.setJoinParameters("host", "mgmtServerId", mgmtSrvrId); return listBy(sc); } diff --git a/server/src/com/cloud/vm/dao/UserVmDaoImpl.java b/server/src/com/cloud/vm/dao/UserVmDaoImpl.java index 5323aa5e181..a0a2be6f4c3 100755 --- a/server/src/com/cloud/vm/dao/UserVmDaoImpl.java +++ b/server/src/com/cloud/vm/dao/UserVmDaoImpl.java @@ -82,7 +82,7 @@ public class UserVmDaoImpl extends GenericDaoBase implements Use "vm_template.enable_password, service_offering.id, disk_offering.name, storage_pool.id, storage_pool.pool_type, " + "service_offering.cpu, service_offering.speed, service_offering.ram_size, volumes.id, volumes.device_id, volumes.volume_type, security_group.id, security_group.name, " + "security_group.description, nics.id, nics.ip4_address, nics.gateway, nics.network_id, nics.netmask, nics.mac_address, nics.broadcast_uri, nics.isolation_uri, " + - "networks.traffic_type, networks.guest_type, networks.is_default from vm_instance " + + "networks.traffic_type, networks.type, networks.is_default from vm_instance " + "left join account on vm_instance.account_id=account.id " + "left join domain on vm_instance.domain_id=domain.id " + "left join instance_group_vm_map on vm_instance.id=instance_group_vm_map.instance_id " + @@ -492,9 +492,6 @@ public class UserVmDaoImpl extends GenericDaoBase implements Use userVmData.addSecurityGroup(resp); } - - //nics.id, nics.ip4_address, nics.gateway, nics.network_id, nics.netmask, nics. mac_address, nics.broadcast_uri, nics.isolation_uri, " + - //"networks.traffic_type, networks.guest_type, networks.is_default from vm_instance, " long nic_id = rs.getLong("nics.id"); if (nic_id > 0){ NicData nicResponse = userVmData.newNicData(); @@ -513,7 +510,7 @@ public class UserVmDaoImpl extends GenericDaoBase implements Use nicResponse.setTrafficType(rs.getString("networks.traffic_type")); - nicResponse.setType(rs.getString("networks.guest_type")); + nicResponse.setType(rs.getString("networks.type")); nicResponse.setIsDefault(rs.getBoolean("networks.is_default")); nicResponse.setObjectName("nic"); userVmData.addNic(nicResponse); diff --git a/setup/db/create-schema.sql b/setup/db/create-schema.sql index 077819b9da2..eaa3f727fd3 100755 --- a/setup/db/create-schema.sql +++ b/setup/db/create-schema.sql @@ -181,7 +181,6 @@ CREATE TABLE `cloud`.`networks` ( `dns2` varchar(255) COMMENT 'comma separated DNS list', `guru_data` varchar(1024) COMMENT 'data stored by the network guru that setup this network', `set_fields` bigint unsigned NOT NULL DEFAULT 0 COMMENT 'which fields are set already', - `guest_type` char(32) COMMENT 'type of guest network', `shared` int(1) unsigned NOT NULL DEFAULT 0 COMMENT '0 if network is shared, 1 if network dedicated', `is_domain_specific` int(1) unsigned NOT NULL DEFAULT 0 COMMENT '1 if network is domain specific, 0 false otherwise', `network_domain` varchar(255) COMMENT 'domain', @@ -265,7 +264,6 @@ CREATE TABLE `cloud`.`network_offerings` ( `default` int(1) unsigned NOT NULL DEFAULT 0 COMMENT '1 if network offering is default', `availability` varchar(255) NOT NULL COMMENT 'availability of the network', `shared_source_nat_service` int(1) unsigned NOT NULL DEFAULT 0 COMMENT 'true if the network offering provides the shared source nat service', - `guest_type` char(32) COMMENT 'guest ip type of network offering', `is_security_group_enabled` tinyint NOT NULL DEFAULT 0 COMMENT '1: enabled, 0: not', `state` char(32) COMMENT 'state of the network offering; has Disabled value by default', `type` char(32) COMMENT 'type of the network offering, can be Shared or Isolated',