Renamed "type" to "guestType"

This commit is contained in:
alena 2011-10-27 16:33:24 -07:00
parent fe0b685e95
commit d315e57b0e
43 changed files with 185 additions and 185 deletions

View File

@ -283,4 +283,5 @@ public class ApiConstants {
public static final String DHCP_RANGE = "dhcprange";
public static final String UUID = "uuid";
public static final String SECURITY_GROUP_EANBLED = "securitygroupenabled";
public static final String GUEST_IP_TYPE = "guestiptype";
}

View File

@ -97,8 +97,8 @@ public class CreateNetworkOfferingCmd extends BaseCmd {
@Parameter(name = ApiConstants.SERVICE_PROVIDER_LIST, type = CommandType.MAP, description = "provider to service mapping. If not specified, the provider for the service will be mapped to the default provider on the physical network")
private Map serviceProviderList;
@Parameter(name=ApiConstants.TYPE, type=CommandType.STRING, required=true, description="type of the network offering: Shared or Isolated")
private String type;
@Parameter(name=ApiConstants.GUEST_IP_TYPE, type=CommandType.STRING, required=true, description="guest type of the network offering: Shared or Isolated")
private String guestIptype;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
@ -176,8 +176,8 @@ public class CreateNetworkOfferingCmd extends BaseCmd {
return vpnService == null ? false : vpnService;
}
public String getType() {
return type;
public String getGuestIpType() {
return guestIptype;
}
public Map<String, List<String>> getServiceProviders() {

View File

@ -74,8 +74,8 @@ 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;
@Parameter(name=ApiConstants.GUEST_IP_TYPE, type=CommandType.STRING, description="list network offerings by guest type: Shared or Isolated")
private String guestIpType;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
@ -125,8 +125,8 @@ public class ListNetworkOfferingsCmd extends BaseListCmd {
return networkId;
}
public String getType() {
return type;
public String getGuestIpType() {
return guestIpType;
}
/////////////////////////////////////////////////////

View File

@ -52,8 +52,8 @@ public class ListNetworksCmd extends BaseListCmd {
@Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, description="the Zone ID of the network")
private Long zoneId;
@Parameter(name=ApiConstants.TYPE, type=CommandType.STRING, description="the type of the network")
private String type;
@Parameter(name=ApiConstants.GUEST_IP_TYPE, type=CommandType.STRING, description="the guest type of the network")
private String guestIpType;
@Parameter(name=ApiConstants.IS_SYSTEM, type=CommandType.BOOLEAN, description="true if network is system, false otherwise")
private Boolean isSystem;
@ -93,8 +93,8 @@ public class ListNetworksCmd extends BaseListCmd {
return zoneId;
}
public String getType() {
return type;
public String getGuestIpType() {
return guestIpType;
}
public Boolean getIsSystem() {

View File

@ -65,8 +65,8 @@ public class NetworkOfferingResponse extends BaseResponse{
@SerializedName(ApiConstants.STATE) @Param(description="state of the network offering. Can be Disabled/Enabled/Inactive")
private String state;
@SerializedName(ApiConstants.TYPE) @Param(description="type of the network offering, can be Shared or Isolated")
private String type;
@SerializedName(ApiConstants.GUEST_IP_TYPE) @Param(description="guest type of the network offering, can be Shared or Isolated")
private String guestIpType;
@SerializedName("service") @Param(description="the list of supported services", responseObject = ServiceResponse.class)
private List<ServiceResponse> services;
@ -127,7 +127,7 @@ public class NetworkOfferingResponse extends BaseResponse{
this.state = state;
}
public void setType(String type) {
this.type = type;
public void setGuestIpType(String type) {
this.guestIpType = type;
}
}

View File

@ -90,8 +90,8 @@ public class NetworkResponse extends BaseResponse implements ControlledEntityRes
@SerializedName(ApiConstants.DNS2) @Param(description="the second DNS for the network")
private String dns2;
@SerializedName(ApiConstants.TYPE) @Param(description="the type of the network")
private String type;
@SerializedName(ApiConstants.GUEST_IP_TYPE) @Param(description="the guest type of the network")
private String guestIpType;
@SerializedName(ApiConstants.VLAN) @Param(description="the vlan of the network")
private String vlan;
@ -179,8 +179,8 @@ public class NetworkResponse extends BaseResponse implements ControlledEntityRes
this.dns2 = dns2;
}
public void setType(String type) {
this.type = type;
public void setGuestIpType(String type) {
this.guestIpType = type;
}
public void setAccountName(String accountName) {

View File

@ -39,7 +39,7 @@ import com.cloud.utils.fsm.StateMachine;
*/
public interface Network extends ControlledEntity {
public enum Type {
public enum GuestType {
Shared,
Isolated
}
@ -271,7 +271,7 @@ public interface Network extends ControlledEntity {
List<String> getTags();
Type getType();
GuestType getGuestType();
boolean getIsShared();

View File

@ -48,7 +48,7 @@ public class NetworkProfile implements Network {
private boolean isDefault;
private String networkDomain;
private List<String> tags;
private Network.Type type;
private Network.GuestType guestType;
private boolean isShared;
private Long physicalNetworkId;
@ -71,7 +71,7 @@ public class NetworkProfile implements Network {
this.isDefault = network.isDefault();
this.networkDomain = network.getNetworkDomain();
this.domainId = network.getDomainId();
this.type = network.getType();
this.guestType = network.getGuestType();
this.isShared = network.getIsShared();
this.physicalNetworkId = network.getPhysicalNetworkId();
}
@ -192,8 +192,8 @@ public class NetworkProfile implements Network {
}
@Override
public Network.Type getType(){
return type;
public Network.GuestType getGuestType(){
return guestType;
}
@Override

View File

@ -17,7 +17,7 @@
*/
package com.cloud.offering;
import com.cloud.network.Network.Type;
import com.cloud.network.Network.GuestType;
import com.cloud.network.Networks.TrafficType;
/**
@ -92,5 +92,5 @@ public interface NetworkOffering {
State getState();
Type getType();
GuestType getGuestType();
}

View File

@ -45,7 +45,7 @@ public interface HostAllocator extends Adapter {
*
* @param VirtualMachineProfile vmProfile
* @param DeploymentPlan plan
* @param Type type
* @param GuestType type
* @param ExcludeList avoid
* @param int returnUpTo (use -1 to return all possible hosts)
* @return List<Host> List of hosts that are suitable for VM allocation
@ -59,7 +59,7 @@ public interface HostAllocator extends Adapter {
*
* @param VirtualMachineProfile vmProfile
* @param DeploymentPlan plan
* @param Type type
* @param GuestType type
* @param ExcludeList avoid
* @param int returnUpTo (use -1 to return all possible hosts)
* @param boolean considerReservedCapacity (default should be true, set to false if host capacity calculation should not look at reserved capacity)

View File

@ -2109,8 +2109,8 @@ public class ApiResponseHelper implements ResponseGenerator {
response.setSpecifyVlan(offering.getSpecifyVlan());
response.setAvailability(offering.getAvailability().toString());
response.setNetworkRate(ApiDBUtils.getNetworkRate(offering.getId()));
if (offering.getType() != null) {
response.setType(offering.getType().toString());
if (offering.getGuestType() != null) {
response.setGuestIpType(offering.getGuestType().toString());
}
response.setState(offering.getState().name());

View File

@ -321,7 +321,7 @@ public class BareMetalVmManagerImpl extends UserVmManagerImpl implements BareMet
if (network == null) {
throw new InvalidParameterValueException("Unable to find network by id " + networkId);
} else {
if (network.getType() != Network.Type.Shared) {
if (network.getGuestType() != Network.GuestType.Shared) {
//Check account permissions
List<NetworkVO> networkMap = _networkDao.listBy(accountId, networkId);
if (networkMap == null || networkMap.isEmpty()) {

View File

@ -185,7 +185,7 @@ public interface ConfigurationManager extends ConfigurationService, Manager {
* @return network offering object
*/
NetworkOfferingVO createNetworkOffering(long userId, String name, String displayText, TrafficType trafficType, String tags, Integer maxConnections, boolean specifyVlan, Availability availability, Integer networkRate, Map<Service, Set<Provider>> serviceProviderMap, boolean isDefault, Network.Type type, boolean systemOnly);
NetworkOfferingVO createNetworkOffering(long userId, String name, String displayText, TrafficType trafficType, String tags, Integer maxConnections, boolean specifyVlan, Availability availability, Integer networkRate, Map<Service, Set<Provider>> serviceProviderMap, boolean isDefault, Network.GuestType type, boolean systemOnly);
Vlan createVlanAndPublicIpRange(Long userId, Long zoneId, Long podId, String startIP, String endIP, String vlanGateway, String vlanNetmask, boolean forVirtualNetwork, String vlanId, Account account, Long networkId) throws InsufficientCapacityException, ConcurrentOperationException, InvalidParameterValueException;

View File

@ -1862,7 +1862,7 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
if (network == null) {
// find default public network in the zone
networkId = _networkMgr.getSystemNetworkByZoneAndTrafficType(zoneId, TrafficType.Public).getId();
} else if (network.getType() != null || network.getTrafficType() != TrafficType.Public) {
} else if (network.getGuestType() != null || network.getTrafficType() != TrafficType.Public) {
throw new InvalidParameterValueException("Can't find Public network by id=" + networkId);
}
} else {
@ -1876,8 +1876,8 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
}
networkId = network.getId();
}
} else if (network.getType() == null || network.getType()== Network.Type.Isolated) {
throw new InvalidParameterValueException("Can't create direct vlan for network id=" + networkId + " with type: " + network.getType());
} else if (network.getGuestType() == null || network.getGuestType()== Network.GuestType.Isolated) {
throw new InvalidParameterValueException("Can't create direct vlan for network id=" + networkId + " with type: " + network.getGuestType());
}
}
@ -2715,7 +2715,7 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
TrafficType trafficType = null;
Availability availability = null;
Network.Type type = null;
Network.GuestType type = null;
// Verify traffic type
for (TrafficType tType : TrafficType.values()) {
@ -2730,8 +2730,8 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
//Verify offering type
for (Network.Type offType : Network.Type.values()) {
if (offType.name().equalsIgnoreCase(cmd.getType())){
for (Network.GuestType offType : Network.GuestType.values()) {
if (offType.name().equalsIgnoreCase(cmd.getGuestIpType())){
type = offType;
break;
}
@ -2820,7 +2820,7 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
@Override @DB
public NetworkOfferingVO createNetworkOffering(long userId, String name, String displayText, TrafficType trafficType, String tags, Integer maxConnections, boolean specifyVlan,
Availability availability, Integer networkRate, Map<Service, Set<Provider>> serviceProviderMap, boolean isDefault, Network.Type type, boolean systemOnly) {
Availability availability, Integer networkRate, Map<Service, Set<Provider>> serviceProviderMap, boolean isDefault, Network.GuestType type, boolean systemOnly) {
String multicastRateStr = _configDao.getValue("multicast.throttling.rate");
int multicastRate = ((multicastRateStr == null) ? 10 : Integer.parseInt(multicastRateStr));
@ -2869,7 +2869,7 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
Long zoneId = cmd.getZoneId();
DataCenter zone = null;
Long networkId = cmd.getNetworkId();
String type = cmd.getType();
String guestIpType = cmd.getGuestIpType();
if (zoneId != null) {
zone = getZone(zoneId);
@ -2889,8 +2889,8 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
sc.addAnd("name", SearchCriteria.Op.LIKE, "%" + name + "%");
}
if (type != null) {
sc.addAnd("type", SearchCriteria.Op.EQ, type);
if (guestIpType != null) {
sc.addAnd("guestType", SearchCriteria.Op.EQ, guestIpType);
}
if (displayText != null) {

View File

@ -1458,7 +1458,7 @@ public class ExternalNetworkDeviceManagerImpl implements ExternalNetworkDeviceMa
try {
txn.start();
List<NetworkVO> networksForAccount = _networkDao.listBy(accountId, zoneId, Network.Type.Isolated);
List<NetworkVO> networksForAccount = _networkDao.listBy(accountId, zoneId, Network.GuestType.Isolated);
for (NetworkVO network : networksForAccount) {
String networkErrorMsg = accountErrorMsg + ", network ID = " + network.getId();

View File

@ -201,7 +201,7 @@ public interface NetworkManager extends NetworkService {
String getIpOfNetworkElementInVirtualNetwork(long accountId, long dataCenterId);
List<NetworkVO> listNetworksForAccount(long accountId, long zoneId, Network.Type type, Boolean isDefault);
List<NetworkVO> listNetworksForAccount(long accountId, long zoneId, Network.GuestType type, Boolean isDefault);
IPAddressVO markIpAsUnavailable(long addrId);

View File

@ -574,7 +574,7 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
@Override
public List<? extends Network> getIsolatedNetworksOwnedByAccountInZone(long zoneId, Account owner) {
return _networksDao.listBy(owner.getId(), zoneId, Network.Type.Isolated);
return _networksDao.listBy(owner.getId(), zoneId, Network.GuestType.Isolated);
}
@Override
@ -674,7 +674,7 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
// First IP address should be source nat when it's being associated with Guest Virtual network
List<IPAddressVO> addrs = listPublicIpAddressesInVirtualNetwork(ownerId, zoneId, true, networkId);
if (addrs.isEmpty() && network.getType() == Network.Type.Isolated) {
if (addrs.isEmpty() && network.getGuestType() == Network.GuestType.Isolated) {
isSourceNat = true;
}
}
@ -854,19 +854,19 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
//check that offering already exists
NetworkOfferingVO offering = null;
if (_networkOfferingDao.findByUniqueName(NetworkOffering.SystemGuestNetwork) == null) {
offering = _configMgr.createNetworkOffering(Account.ACCOUNT_ID_SYSTEM, NetworkOffering.SystemGuestNetwork, "System Offering for System-Guest-Network", TrafficType.Guest, null, null, false, Availability.Optional, null, defaultDirectNetworkOfferingProviders, true, Network.Type.Shared, true);
offering = _configMgr.createNetworkOffering(Account.ACCOUNT_ID_SYSTEM, NetworkOffering.SystemGuestNetwork, "System Offering for System-Guest-Network", TrafficType.Guest, null, null, false, Availability.Optional, null, defaultDirectNetworkOfferingProviders, true, Network.GuestType.Shared, true);
offering.setState(NetworkOffering.State.Enabled);
_networkOfferingDao.update(offering.getId(), offering);
}
if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultVirtualizedNetworkOffering) == null) {
offering = _configMgr.createNetworkOffering(Account.ACCOUNT_ID_SYSTEM,NetworkOffering.DefaultVirtualizedNetworkOffering, "Virtual Vlan", TrafficType.Guest, null, null, false, Availability.Required, null, defaultVirtualNetworkOfferingProviders, true, Network.Type.Isolated, false);
offering = _configMgr.createNetworkOffering(Account.ACCOUNT_ID_SYSTEM,NetworkOffering.DefaultVirtualizedNetworkOffering, "Virtual Vlan", TrafficType.Guest, null, null, false, Availability.Required, null, defaultVirtualNetworkOfferingProviders, true, Network.GuestType.Isolated, false);
offering.setState(NetworkOffering.State.Enabled);
_networkOfferingDao.update(offering.getId(), offering);
}
if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultDirectNetworkOffering) == null) {
offering = _configMgr.createNetworkOffering(Account.ACCOUNT_ID_SYSTEM, NetworkOffering.DefaultDirectNetworkOffering, "Direct", TrafficType.Guest, null, null, true, Availability.Optional, null, defaultDirectNetworkOfferingProviders, true, Network.Type.Shared, false);
offering = _configMgr.createNetworkOffering(Account.ACCOUNT_ID_SYSTEM, NetworkOffering.DefaultDirectNetworkOffering, "Direct", TrafficType.Guest, null, null, true, Availability.Optional, null, defaultDirectNetworkOfferingProviders, true, Network.GuestType.Shared, false);
offering.setState(NetworkOffering.State.Enabled);
_networkOfferingDao.update(offering.getId(), offering);
}
@ -1059,9 +1059,9 @@ 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,
(domainId != null), predefined.getNetworkDomain(), offering.getType(), isShared, plan.getDataCenterId(), plan.getPhysicalNetworkId());
(domainId != null), predefined.getNetworkDomain(), offering.getGuestType(), isShared, plan.getDataCenterId(), plan.getPhysicalNetworkId());
vo.setTags(tags);
networks.add(_networksDao.persist(vo, vo.getType() == Network.Type.Isolated));
networks.add(_networksDao.persist(vo, vo.getGuestType() == Network.GuestType.Isolated));
if (domainId != null) {
_networksDao.addDomainToNetwork(id, domainId);
@ -1332,7 +1332,7 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
}
}
if (network.getType() == Network.Type.Isolated && isServiceSupportedByNetworkOffering(network.getNetworkOfferingId(), Service.SourceNat) && !sharedSourceNat) {
if (network.getGuestType() == Network.GuestType.Isolated && isServiceSupportedByNetworkOffering(network.getNetworkOfferingId(), Service.SourceNat) && !sharedSourceNat) {
List<IPAddressVO> ips = _ipAddressDao.listByAssociatedNetwork(network.getId(), true);
if (ips.isEmpty()) {
@ -1659,8 +1659,8 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
// Check if the network is domain specific
if (cmd.getDomainId() != null && cmd.getAccountName() == null) {
if (networkOffering.getTrafficType() != TrafficType.Guest || networkOffering.getType() != Network.Type.Shared) {
throw new InvalidParameterValueException("Domain level networks are supported just for traffic type " + TrafficType.Guest + " and type " + Network.Type.Shared);
if (networkOffering.getTrafficType() != TrafficType.Guest || networkOffering.getGuestType() != Network.GuestType.Shared) {
throw new InvalidParameterValueException("Domain level networks are supported just for traffic type " + TrafficType.Guest + " and type " + Network.GuestType.Shared);
} else if (isShared == null || !isShared) {
throw new InvalidParameterValueException("Network dedicated to domain should be shared");
} else {
@ -1736,9 +1736,9 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
}
// Regular user can create Guest Isolated network only
if (caller.getType() == Account.ACCOUNT_TYPE_NORMAL && (networkOffering.getTrafficType() != TrafficType.Guest || networkOffering.getType() != Network.Type.Isolated)) {
if (caller.getType() == Account.ACCOUNT_TYPE_NORMAL && (networkOffering.getTrafficType() != TrafficType.Guest || networkOffering.getGuestType() != Network.GuestType.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);
+ Network.GuestType.Isolated);
}
// Don't allow to specify cidr if the caller is a regular user
@ -1768,11 +1768,11 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
// Don't pass owner to create vlan when network offering is of type Shared - done to prevent accountVlanMap entry
// creation when vlan is mapped to network
if (network.getType() == Network.Type.Shared) {
if (network.getGuestType() == Network.GuestType.Shared) {
owner = null;
}
if (caller.getType() == Account.ACCOUNT_TYPE_ADMIN && network.getType() == Network.Type.Shared && defineNetworkConfig) {
if (caller.getType() == Account.ACCOUNT_TYPE_ADMIN && network.getGuestType() == Network.GuestType.Shared && defineNetworkConfig) {
// Create vlan ip range
_configMgr.createVlanAndPublicIpRange(userId, pNtwk.getDataCenterId(), null, startIP, endIP, gateway, netmask, false, vlanId, owner, network.getId());
}
@ -1792,14 +1792,14 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
long zoneId = zone.getId();
// allow isDefault to be set only for Shared network
if (networkOffering.getType() == Network.Type.Isolated) {
if (networkOffering.getGuestType() == Network.GuestType.Isolated) {
if (isDefault != null && !isDefault) {
throw new InvalidParameterValueException("Can specify isDefault parameter only for network of type " + Network.Type.Shared);
throw new InvalidParameterValueException("Can specify isDefault parameter only for network of type " + Network.GuestType.Shared);
} else {
isDefault = true;
}
if (isShared != null && isShared) {
throw new InvalidParameterValueException("Can specify isShared parameter for " + Network.Type.Shared + " networks only");
throw new InvalidParameterValueException("Can specify isShared parameter for " + Network.GuestType.Shared + " networks only");
}
} else {
if (isDefault == null) {
@ -1826,8 +1826,8 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
}
// 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 (networkOffering.getGuestType() == Network.GuestType.Isolated && vlanId != null) {
throw new InvalidParameterValueException("Can't specify vlan when create " + Network.GuestType.Isolated + " network");
}
// If networkDomain is not specified, take it from the global configuration
@ -1869,12 +1869,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.getType() == Network.Type.Shared) {
if (cidr == null && networkOffering.getTrafficType() == TrafficType.Guest && networkOffering.getGuestType() == Network.GuestType.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 Isolated
if (cidr != null && networkOffering.getType() == Network.Type.Isolated && networkOffering.getTrafficType() == TrafficType.Guest) {
if (cidr != null && networkOffering.getGuestType() == Network.GuestType.Isolated && networkOffering.getTrafficType() == TrafficType.Guest) {
if (!NetUtils.validateGuestCidr(cidr)) {
throw new InvalidParameterValueException("Virtual Guest Cidr " + cidr + " is not RFC1918 compliant");
}
@ -1907,7 +1907,7 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
if (networks == null || networks.isEmpty()) {
throw new CloudRuntimeException("Fail to create a network");
} else {
if (networks.size() > 0 && networks.get(0).getType()== Network.Type.Isolated && networks.get(0).getTrafficType() == TrafficType.Guest) {
if (networks.size() > 0 && networks.get(0).getGuestType()== Network.GuestType.Isolated && networks.get(0).getTrafficType() == TrafficType.Guest) {
Network defaultGuestNetwork = networks.get(0);
for (Network nw : networks) {
if (nw.getCidr() != null && nw.getCidr().equals(zone.getGuestNetworkCidr())) {
@ -1933,7 +1933,7 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
Account caller = UserContext.current().getCaller();
Long domainId = cmd.getDomainId();
String accountName = cmd.getAccountName();
String type = cmd.getType();
String guestIpType = cmd.getGuestIpType();
String trafficType = cmd.getTrafficType();
Boolean isSystem = cmd.getIsSystem();
Boolean isShared = cmd.getIsShared();
@ -2032,27 +2032,27 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
List<NetworkVO> networksToReturn = new ArrayList<NetworkVO>();
if (sharedNetworkDomainId != null) {
networksToReturn.addAll(listDomainLevelNetworks(buildNetworkSearchCriteria(sb, keyword, id, isSystem, zoneId, type, isDefault, trafficType, isShared, physicalNetworkId), searchFilter, sharedNetworkDomainId));
networksToReturn.addAll(listDomainLevelNetworks(buildNetworkSearchCriteria(sb, keyword, id, isSystem, zoneId, guestIpType, isDefault, trafficType, isShared, physicalNetworkId), searchFilter, sharedNetworkDomainId));
} else {
SearchBuilder<DomainVO> domainSearch = _domainDao.createSearchBuilder();
domainSearch.and("path", domainSearch.entity().getPath(), SearchCriteria.Op.LIKE);
sb.join("domainSearch", domainSearch, sb.entity().getDomainId(), domainSearch.entity().getId(), JoinBuilder.JoinType.INNER);
networksToReturn.addAll(listDomainSpecificNetworks(buildNetworkSearchCriteria(sb, keyword, id, isSystem, zoneId, type, isDefault, trafficType, isShared, physicalNetworkId), searchFilter, path));
networksToReturn.addAll(listDomainSpecificNetworks(buildNetworkSearchCriteria(sb, keyword, id, isSystem, zoneId, guestIpType, isDefault, trafficType, isShared, physicalNetworkId), searchFilter, path));
}
//if user requested only domain specific networks, don't return account/zone wide networks
if (!permittedAccounts.isEmpty() || (domainId == null && accountName == null && projectId == null)) {
networksToReturn.addAll(listAccountSpecificAndZoneLevelNetworks(buildNetworkSearchCriteria(sb, keyword, id, isSystem, zoneId, type, isDefault, trafficType, isShared, physicalNetworkId), searchFilter, path, permittedAccounts));
networksToReturn.addAll(listAccountSpecificAndZoneLevelNetworks(buildNetworkSearchCriteria(sb, keyword, id, isSystem, zoneId, guestIpType, isDefault, trafficType, isShared, physicalNetworkId), searchFilter, path, permittedAccounts));
}
return networksToReturn;
} else {
return _networksDao.search(buildNetworkSearchCriteria(sb, keyword, id, isSystem, zoneId, type, isDefault, trafficType, isShared, physicalNetworkId), searchFilter);
return _networksDao.search(buildNetworkSearchCriteria(sb, keyword, id, isSystem, zoneId, guestIpType, isDefault, trafficType, isShared, physicalNetworkId), searchFilter);
}
}
private SearchCriteria<NetworkVO> buildNetworkSearchCriteria(SearchBuilder<NetworkVO> sb, String keyword, Long id, Boolean isSystem, Long zoneId, String type, Boolean isDefault, String trafficType, Boolean isShared, Long physicalNetworkId) {
private SearchCriteria<NetworkVO> buildNetworkSearchCriteria(SearchBuilder<NetworkVO> sb, String keyword, Long id, Boolean isSystem, Long zoneId, String guestIpType, Boolean isDefault, String trafficType, Boolean isShared, Long physicalNetworkId) {
SearchCriteria<NetworkVO> sc = sb.create();
if (isSystem != null) {
@ -2073,8 +2073,8 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
sc.addAnd("dataCenterId", SearchCriteria.Op.EQ, zoneId);
}
if (type != null) {
sc.addAnd("guestType", SearchCriteria.Op.EQ, type);
if (guestIpType != null) {
sc.addAnd("guestType", SearchCriteria.Op.EQ, guestIpType);
}
if (isDefault != null) {
@ -3011,7 +3011,7 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
@Override
public String getIpOfNetworkElementInVirtualNetwork(long accountId, long dataCenterId) {
List<NetworkVO> virtualNetworks = _networksDao.listBy(accountId, dataCenterId, Network.Type.Isolated);
List<NetworkVO> virtualNetworks = _networksDao.listBy(accountId, dataCenterId, Network.GuestType.Isolated);
if (virtualNetworks.isEmpty()) {
s_logger.trace("Unable to find default Virtual network account id=" + accountId);
@ -3031,15 +3031,15 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
}
@Override
public List<NetworkVO> listNetworksForAccount(long accountId, long zoneId, Network.Type type, Boolean isDefault) {
public List<NetworkVO> listNetworksForAccount(long accountId, long zoneId, Network.GuestType type, Boolean isDefault) {
List<NetworkVO> accountNetworks = new ArrayList<NetworkVO>();
List<NetworkVO> zoneNetworks = _networksDao.listByZone(zoneId);
for (NetworkVO network : zoneNetworks) {
NetworkOfferingVO no = _networkOfferingDao.findById(network.getNetworkOfferingId());
if (!no.isSystemOnly()) {
if (network.getType() == Network.Type.Shared || !_networksDao.listBy(accountId, network.getId()).isEmpty()) {
if ((type == null || type == network.getType()) && (isDefault == null || isDefault.booleanValue() == network.isDefault)) {
if (network.getGuestType() == Network.GuestType.Shared || !_networksDao.listBy(accountId, network.getId()).isEmpty()) {
if ((type == null || type == network.getGuestType()) && (isDefault == null || isDefault.booleanValue() == network.isDefault)) {
accountNetworks.add(network);
}
}
@ -3093,7 +3093,7 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
public boolean isNetworkAvailableInDomain(long networkId, long domainId) {
Long networkDomainId = null;
Network network = getNetwork(networkId);
if (network.getType() != Network.Type.Shared) {
if (network.getGuestType() != Network.GuestType.Shared) {
s_logger.trace("Network id=" + networkId + " is not shared");
return false;
}
@ -3436,7 +3436,7 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
}
//Type of the network should be the same
if (oldNetworkOffering.getType() != newNetworkOffering.getType()){
if (oldNetworkOffering.getGuestType() != newNetworkOffering.getGuestType()){
s_logger.debug("Network offerings " + newNetworkOfferingId + " and " + oldNetworkOfferingId + " are of different types, can't upgrade");
return false;
}

View File

@ -214,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<NetworkVO> networkJoin = _networksDao.createSearchBuilder();
networkJoin.and("type", networkJoin.entity().getType(), Op.EQ);
networkJoin.and("guestType", networkJoin.entity().getGuestType(), Op.EQ);
AllocatedIpSearch.join("network", networkJoin, AllocatedIpSearch.entity().getSourceNetworkId(), networkJoin.entity().getId(), JoinBuilder.JoinType.INNER);
AllocatedIpSearch.done();
@ -242,7 +242,7 @@ public class NetworkUsageManagerImpl implements NetworkUsageManager {
public List<IPAddressVO> listAllocatedDirectIps(long zoneId) {
SearchCriteria<IPAddressVO> sc = AllocatedIpSearch.create();
sc.setParameters("dc", zoneId);
sc.setJoinParameters("network", "type", Network.Type.Shared);
sc.setJoinParameters("network", "guestType", Network.GuestType.Shared);
return _ipAddressDao.search(sc, null);
}

View File

@ -148,9 +148,9 @@ public class NetworkVO implements Network {
@CollectionTable(name="network_tags", joinColumns=@JoinColumn(name="network_id"))
List<String> tags;
@Column(name="type")
@Column(name="guest_type")
@Enumerated(value=EnumType.STRING)
Network.Type type;
Network.GuestType guestType;
public NetworkVO() {
}
@ -180,8 +180,8 @@ public class NetworkVO implements Network {
this.id = -1;
}
public NetworkVO(long id, Network that, long offeringId, String guruName, 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(id, that.getTrafficType(), that.getMode(), that.getBroadcastDomainType(), offeringId, domainId, accountId, related, name, displayText, isDefault,isDomainSpecific, networkDomain, type, isShared, dcId, physicalNetworkId);
public NetworkVO(long id, Network that, long offeringId, String guruName, long domainId, long accountId, long related, String name, String displayText, boolean isDefault, boolean isDomainSpecific, String networkDomain, GuestType guestType, boolean isShared, long dcId, Long physicalNetworkId) {
this(id, that.getTrafficType(), that.getMode(), that.getBroadcastDomainType(), offeringId, domainId, accountId, related, name, displayText, isDefault,isDomainSpecific, networkDomain, guestType, isShared, dcId, physicalNetworkId);
this.gateway = that.getGateway();
this.cidr = that.getCidr();
this.broadcastUri = that.getBroadcastUri();
@ -206,12 +206,12 @@ public class NetworkVO implements Network {
* @param isDefault
* @param isDomainSpecific
* @param networkDomain
* @param type TODO
* @param guestType TODO
* @param isShared TODO
* @param isShared
* @param dataCenterId
*/
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) {
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, GuestType guestType, boolean isShared, long dcId, Long physicalNetworkId) {
this(trafficType, mode, broadcastDomainType, networkOfferingId, State.Allocated, dcId, physicalNetworkId);
this.domainId = domainId;
this.accountId = accountId;
@ -222,7 +222,7 @@ public class NetworkVO implements Network {
this.isDefault = isDefault;
this.isDomainSpecific = isDomainSpecific;
this.networkDomain = networkDomain;
this.type = type;
this.guestType = guestType;
this.isShared = isShared;
}
@ -451,8 +451,8 @@ public class NetworkVO implements Network {
}
@Override
public Network.Type getType() {
return type;
public Network.GuestType getGuestType() {
return guestType;
}
@Override

View File

@ -30,7 +30,7 @@ public interface NetworkDao extends GenericDao<NetworkVO, Long> {
List<NetworkVO> listByOwner(long ownerId);
List<NetworkVO> listBy(long accountId, long offeringId, long dataCenterId);
List<NetworkVO> listBy(long accountId, long offeringId, long dataCenterId, String cidr);
List<NetworkVO> listBy(long accountId, long dataCenterId, Network.Type type);
List<NetworkVO> listBy(long accountId, long dataCenterId, Network.GuestType type);
NetworkVO persist(NetworkVO network, boolean gc);
void addAccountToNetwork(long networkId, long accountId);
SearchBuilder<NetworkAccountVO> createSearchBuilderForAccount();

View File

@ -80,7 +80,7 @@ public class NetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implements N
AllFieldsSearch.and("datacenter", AllFieldsSearch.entity().getDataCenterId(), Op.EQ);
AllFieldsSearch.and("account", AllFieldsSearch.entity().getAccountId(), Op.EQ);
AllFieldsSearch.and("related", AllFieldsSearch.entity().getRelated(), Op.EQ);
AllFieldsSearch.and("type", AllFieldsSearch.entity().getType(), Op.EQ);
AllFieldsSearch.and("guestType", AllFieldsSearch.entity().getGuestType(), Op.EQ);
AllFieldsSearch.and("physicalNetwork", AllFieldsSearch.entity().getPhysicalNetworkId(), Op.EQ);
AllFieldsSearch.done();
@ -143,12 +143,12 @@ public class NetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implements N
}
@Override
public List<NetworkVO> listBy(long accountId, long dataCenterId, Network.Type type) {
public List<NetworkVO> listBy(long accountId, long dataCenterId, Network.GuestType type) {
SearchCriteria<NetworkVO> sc = AllFieldsSearch.create();
sc.setParameters("datacenter", dataCenterId);
sc.setParameters("account", accountId);
if (type != null) {
sc.setParameters("type", type);
sc.setParameters("guestType", type);
}
return listBy(sc, null);
}
@ -320,9 +320,9 @@ public class NetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implements N
public List<NetworkVO> listNetworksBy(boolean isShared) {
SearchCriteria<NetworkVO> sc = AllFieldsSearch.create();
if (isShared) {
sc.setParameters("type", Network.Type.Shared);
sc.setParameters("guestType", Network.GuestType.Shared);
} else {
sc.setParameters("type", Network.Type.Isolated);
sc.setParameters("guestType", Network.GuestType.Isolated);
}
return listBy(sc);

View File

@ -39,7 +39,7 @@ import com.cloud.network.Network;
import com.cloud.network.Network.Capability;
import com.cloud.network.Network.Provider;
import com.cloud.network.Network.Service;
import com.cloud.network.Network.Type;
import com.cloud.network.Network.GuestType;
import com.cloud.network.NetworkManager;
import com.cloud.network.Networks.TrafficType;
import com.cloud.network.dao.NetworkDao;
@ -82,20 +82,20 @@ public class DhcpElement extends AdapterBase implements DhcpElementService, User
@Inject HostDao _hostDao;
@Inject VirtualRouterElementsDao _vrElementsDao;
private boolean canHandle(DeployDestination dest, TrafficType trafficType, Type networkType, long offeringId) {
if (_networkMgr.isProviderSupported(offeringId, Service.Gateway, Provider.JuniperSRX) && networkType == Network.Type.Isolated) {
private boolean canHandle(DeployDestination dest, TrafficType trafficType, GuestType networkType, long offeringId) {
if (_networkMgr.isProviderSupported(offeringId, Service.Gateway, Provider.JuniperSRX) && networkType == Network.GuestType.Isolated) {
return true;
} else if (dest.getPod() != null && dest.getPod().getExternalDhcp()){
//This pod is using external DHCP server
return false;
} else {
return (networkType == Network.Type.Shared);
return (networkType == Network.GuestType.Shared);
}
}
@Override
public boolean implement(Network network, NetworkOffering offering, DeployDestination dest, ReservationContext context) throws ResourceUnavailableException, ConcurrentOperationException, InsufficientCapacityException {
if (!canHandle(dest, offering.getTrafficType(), network.getType(), network.getNetworkOfferingId())) {
if (!canHandle(dest, offering.getTrafficType(), network.getGuestType(), network.getNetworkOfferingId())) {
return false;
}
@ -107,7 +107,7 @@ public class DhcpElement extends AdapterBase implements DhcpElementService, User
@Override
public boolean prepare(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException, InsufficientCapacityException, ResourceUnavailableException {
if (canHandle(dest, network.getTrafficType(), network.getType(), network.getNetworkOfferingId())) {
if (canHandle(dest, network.getTrafficType(), network.getGuestType(), network.getNetworkOfferingId())) {
if (vm.getType() != VirtualMachine.Type.User) {
return false;

View File

@ -66,8 +66,8 @@ public class ElasticLoadBalancerElement extends AdapterBase implements LoadBalan
TrafficType _frontEndTrafficType = TrafficType.Guest;
private boolean canHandle(Network network) {
if (network.getType() != Network.Type.Shared|| network.getTrafficType() != TrafficType.Guest) {
s_logger.debug("Not handling network with type " + network.getType() + " and traffic type " + network.getTrafficType());
if (network.getGuestType() != Network.GuestType.Shared|| network.getTrafficType() != TrafficType.Guest) {
s_logger.debug("Not handling network with type " + network.getGuestType() + " and traffic type " + network.getTrafficType());
return false;
}

View File

@ -40,7 +40,7 @@ import com.cloud.network.Network;
import com.cloud.network.Network.Capability;
import com.cloud.network.Network.Provider;
import com.cloud.network.Network.Service;
import com.cloud.network.Network.Type;
import com.cloud.network.Network.GuestType;
import com.cloud.network.Networks.TrafficType;
import com.cloud.offering.NetworkOffering;
import com.cloud.utils.component.AdapterBase;
@ -56,12 +56,12 @@ public class ExternalDhcpElement extends AdapterBase implements NetworkElement {
@Inject ExternalDhcpManager _dhcpMgr;
private static final Map<Service, Map<Capability, String>> capabilities = setCapabilities();
private boolean canHandle(DeployDestination dest, TrafficType trafficType, Type networkType) {
private boolean canHandle(DeployDestination dest, TrafficType trafficType, GuestType networkType) {
DataCenter dc = dest.getDataCenter();
Pod pod = dest.getPod();
if ((pod != null && pod.getExternalDhcp()) && dc.getNetworkType() == NetworkType.Basic && trafficType == TrafficType.Guest
&& networkType == Network.Type.Shared) {
&& networkType == Network.GuestType.Shared) {
s_logger.debug("External DHCP can handle");
return true;
}
@ -88,7 +88,7 @@ public class ExternalDhcpElement extends AdapterBase implements NetworkElement {
@Override
public boolean implement(Network network, NetworkOffering offering, DeployDestination dest, ReservationContext context)
throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException {
if (!canHandle(dest, offering.getTrafficType(), network.getType())) {
if (!canHandle(dest, offering.getTrafficType(), network.getGuestType())) {
return false;
}
return true;
@ -98,7 +98,7 @@ public class ExternalDhcpElement extends AdapterBase implements NetworkElement {
public boolean prepare(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, DeployDestination dest,
ReservationContext context) throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException {
Host host = dest.getHost();
if (host.getHypervisorType() == HypervisorType.BareMetal || !canHandle(dest, network.getTrafficType(), network.getType())) {
if (host.getHypervisorType() == HypervisorType.BareMetal || !canHandle(dest, network.getTrafficType(), network.getGuestType())) {
//BareMetalElement or DhcpElement handle this
return false;
}

View File

@ -64,8 +64,8 @@ public class F5ExternalLoadBalancerElement extends AdapterBase implements LoadBa
private boolean canHandle(Network config) {
DataCenter zone = _configMgr.getZone(config.getDataCenterId());
if (config.getType() != Network.Type.Isolated || config.getTrafficType() != TrafficType.Guest) {
s_logger.trace("Not handling network with Type " + config.getType() + " and traffic type " + config.getTrafficType());
if (config.getGuestType() != Network.GuestType.Isolated || config.getTrafficType() != TrafficType.Guest) {
s_logger.trace("Not handling network with Type " + config.getGuestType() + " and traffic type " + config.getTrafficType());
return false;
}

View File

@ -75,8 +75,8 @@ public class JuniperSRXExternalFirewallElement extends AdapterBase implements So
private boolean canHandle(Network config) {
DataCenter zone = _configMgr.getZone(config.getDataCenterId());
if ((zone.getNetworkType() == NetworkType.Advanced && config.getType() != Network.Type.Isolated) || (zone.getNetworkType() == NetworkType.Basic && config.getType() != Network.Type.Shared)) {
s_logger.trace("Not handling network type = " + config.getType());
if ((zone.getNetworkType() == NetworkType.Advanced && config.getGuestType() != Network.GuestType.Isolated) || (zone.getNetworkType() == NetworkType.Basic && config.getGuestType() != Network.GuestType.Shared)) {
s_logger.trace("Not handling network type = " + config.getGuestType());
return false;
}

View File

@ -63,8 +63,8 @@ public class NetscalerExternalLoadBalancerElement extends AdapterBase implements
private boolean canHandle(Network config) {
DataCenter zone = _configMgr.getZone(config.getDataCenterId());
if (config.getType() != Network.Type.Isolated || config.getTrafficType() != TrafficType.Guest) {
s_logger.trace("Not handling network with Type " + config.getType() + " and traffic type " + config.getTrafficType());
if (config.getGuestType() != Network.GuestType.Isolated || config.getTrafficType() != TrafficType.Guest) {
s_logger.trace("Not handling network with Type " + config.getGuestType() + " and traffic type " + config.getTrafficType());
return false;
}

View File

@ -16,7 +16,7 @@ import com.cloud.exception.ResourceUnavailableException;
import com.cloud.network.Network;
import com.cloud.network.Network.Provider;
import com.cloud.network.Network.Service;
import com.cloud.network.Network.Type;
import com.cloud.network.Network.GuestType;
import com.cloud.network.NetworkManager;
import com.cloud.network.dao.VirtualRouterElementsDao;
import com.cloud.network.element.VirtualRouterElements.VirtualRouterElementsType;
@ -42,10 +42,10 @@ public class RedundantVirtualRouterElement extends VirtualRouterElement implemen
return Provider.RedundantVirtualRouter;
}
private boolean canHandle(Type networkType, long offeringId) {
boolean result = (networkType == Network.Type.Isolated && _networkMgr.isProviderSupported(offeringId, Service.Gateway, getProvider()));
private boolean canHandle(GuestType networkType, long offeringId) {
boolean result = (networkType == Network.GuestType.Isolated && _networkMgr.isProviderSupported(offeringId, Service.Gateway, getProvider()));
if (!result) {
s_logger.trace("Virtual router element only takes care of networktype " + Network.Type.Isolated + " for provider " + getProvider().getName());
s_logger.trace("Virtual router element only takes care of networktype " + Network.GuestType.Isolated + " for provider " + getProvider().getName());
}
return result;
}
@ -53,7 +53,7 @@ public class RedundantVirtualRouterElement extends VirtualRouterElement implemen
@Override
public boolean implement(Network guestConfig, NetworkOffering offering, DeployDestination dest, ReservationContext context) throws ResourceUnavailableException, ConcurrentOperationException, InsufficientCapacityException {
if (!canHandle(guestConfig.getType(), offering.getId())) {
if (!canHandle(guestConfig.getGuestType(), offering.getId())) {
return false;
}
@ -67,7 +67,7 @@ public class RedundantVirtualRouterElement extends VirtualRouterElement implemen
@Override
public boolean prepare(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException, InsufficientCapacityException, ResourceUnavailableException {
if (canHandle(network.getType(), network.getNetworkOfferingId())) {
if (canHandle(network.getGuestType(), network.getNetworkOfferingId())) {
if (vm.getType() != VirtualMachine.Type.User) {
return false;
}

View File

@ -38,7 +38,7 @@ import com.cloud.network.Network;
import com.cloud.network.Network.Capability;
import com.cloud.network.Network.Provider;
import com.cloud.network.Network.Service;
import com.cloud.network.Network.Type;
import com.cloud.network.Network.GuestType;
import com.cloud.network.NetworkManager;
import com.cloud.network.PublicIpAddress;
import com.cloud.network.RemoteAccessVpn;
@ -92,17 +92,17 @@ public class VirtualRouterElement extends DhcpElement implements VirtualRouterEl
@Inject ConfigurationDao _configDao;
@Inject VirtualRouterElementsDao _vrElementsDao;
private boolean canHandle(Type networkType, long offeringId) {
boolean result = (networkType == Network.Type.Isolated && _networkMgr.isProviderSupported(offeringId, Service.Gateway, getProvider()));
private boolean canHandle(GuestType networkType, long offeringId) {
boolean result = (networkType == Network.GuestType.Isolated && _networkMgr.isProviderSupported(offeringId, Service.Gateway, getProvider()));
if (!result) {
s_logger.trace("Virtual router element only takes care of type " + Network.Type.Isolated + " for provider " + getProvider().getName());
s_logger.trace("Virtual router element only takes care of type " + Network.GuestType.Isolated + " for provider " + getProvider().getName());
}
return result;
}
@Override
public boolean implement(Network guestConfig, NetworkOffering offering, DeployDestination dest, ReservationContext context) throws ResourceUnavailableException, ConcurrentOperationException, InsufficientCapacityException {
if (!canHandle(guestConfig.getType(), offering.getId())) {
if (!canHandle(guestConfig.getGuestType(), offering.getId())) {
return false;
}
@ -116,7 +116,7 @@ public class VirtualRouterElement extends DhcpElement implements VirtualRouterEl
@Override
public boolean prepare(Network network, NicProfile nic, VirtualMachineProfile<? extends VirtualMachine> vm, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException, InsufficientCapacityException, ResourceUnavailableException {
if (canHandle(network.getType(), network.getNetworkOfferingId())) {
if (canHandle(network.getGuestType(), network.getNetworkOfferingId())) {
if (vm.getType() != VirtualMachine.Type.User) {
return false;
}
@ -178,7 +178,7 @@ public class VirtualRouterElement extends DhcpElement implements VirtualRouterEl
public boolean applyFWRules(Network config, List<? extends FirewallRule> rules) throws ResourceUnavailableException {
DataCenter dc = _configMgr.getZone(config.getDataCenterId());
if (canHandle(config.getType(), config.getNetworkOfferingId())) {
if (canHandle(config.getGuestType(), config.getNetworkOfferingId())) {
List<DomainRouterVO> routers = _routerDao.listByNetworkAndRole(config.getId(), Role.DHCP_FIREWALL_LB_PASSWD_USERDATA);
if (routers == null || routers.isEmpty()) {
s_logger.debug("Virtual router elemnt doesn't need to apply firewall rules on the backend; virtual router doesn't exist in the network " + config.getId());
@ -197,7 +197,7 @@ public class VirtualRouterElement extends DhcpElement implements VirtualRouterEl
@Override
public boolean applyLBRules(Network network, List<LoadBalancingRule> rules) throws ResourceUnavailableException {
if (canHandle(network.getType(), network.getNetworkOfferingId())) {
if (canHandle(network.getGuestType(), network.getNetworkOfferingId())) {
List<DomainRouterVO> routers = _routerDao.listByNetworkAndRole(network.getId(), Role.DHCP_FIREWALL_LB_PASSWD_USERDATA);
if (routers == null || routers.isEmpty()) {
s_logger.debug("Virtual router elemnt doesn't need to apply firewall rules on the backend; virtual router doesn't exist in the network " + network.getId());
@ -226,7 +226,7 @@ public class VirtualRouterElement extends DhcpElement implements VirtualRouterEl
return null;
}
if (canHandle(network.getType(), network.getNetworkOfferingId())) {
if (canHandle(network.getGuestType(), network.getNetworkOfferingId())) {
return _routerMgr.applyVpnUsers(network, users, routers);
} else {
s_logger.debug("Element " + this.getName() + " doesn't handle applyVpnUsers command");
@ -244,7 +244,7 @@ public class VirtualRouterElement extends DhcpElement implements VirtualRouterEl
return true;
}
if (canHandle(network.getType(), network.getNetworkOfferingId())) {
if (canHandle(network.getGuestType(), network.getNetworkOfferingId())) {
return _routerMgr.startRemoteAccessVpn(network, vpn, routers);
} else {
s_logger.debug("Element " + this.getName() + " doesn't handle createVpn command");
@ -262,7 +262,7 @@ public class VirtualRouterElement extends DhcpElement implements VirtualRouterEl
return true;
}
if (canHandle(network.getType(), network.getNetworkOfferingId())) {
if (canHandle(network.getGuestType(), network.getNetworkOfferingId())) {
return _routerMgr.deleteRemoteAccessVpn(network, vpn, routers);
} else {
s_logger.debug("Element " + this.getName() + " doesn't handle removeVpn command");
@ -272,7 +272,7 @@ public class VirtualRouterElement extends DhcpElement implements VirtualRouterEl
@Override
public boolean applyIps(Network network, List<? extends PublicIpAddress> ipAddress) throws ResourceUnavailableException {
if (canHandle(network.getType(), network.getNetworkOfferingId())) {
if (canHandle(network.getGuestType(), network.getNetworkOfferingId())) {
List<DomainRouterVO> routers = _routerDao.listByNetworkAndRole(network.getId(), Role.DHCP_FIREWALL_LB_PASSWD_USERDATA);
if (routers == null || routers.isEmpty()) {
@ -340,7 +340,7 @@ public class VirtualRouterElement extends DhcpElement implements VirtualRouterEl
@Override
public boolean applyStaticNats(Network config, List<? extends StaticNat> rules) throws ResourceUnavailableException {
DataCenter dc = _configMgr.getZone(config.getDataCenterId());
if (canHandle(config.getType(), config.getNetworkOfferingId())) {
if (canHandle(config.getGuestType(), config.getNetworkOfferingId())) {
List<DomainRouterVO> routers = _routerDao.listByNetworkAndRole(config.getId(), Role.DHCP_FIREWALL_LB_PASSWD_USERDATA);
if (routers == null || routers.isEmpty()) {
s_logger.debug("Virtual router elemnt doesn't need to apply static nat on the backend; virtual router doesn't exist in the network " + config.getId());
@ -439,7 +439,7 @@ public class VirtualRouterElement extends DhcpElement implements VirtualRouterEl
@Override
public boolean applyPFRules(Network network, List<PortForwardingRule> rules) throws ResourceUnavailableException {
if (canHandle(network.getType(), network.getNetworkOfferingId())) {
if (canHandle(network.getGuestType(), network.getNetworkOfferingId())) {
List<DomainRouterVO> routers = _routerDao.listByNetworkAndRole(network.getId(), Role.DHCP_FIREWALL_LB_PASSWD_USERDATA);
if (routers == null || routers.isEmpty()) {
s_logger.debug("Virtual router elemnt doesn't need to apply firewall rules on the backend; virtual router doesn't exist in the network " + network.getId());

View File

@ -77,7 +77,7 @@ public class DirectNetworkGuru extends AdapterBase implements NetworkGuru {
protected boolean canHandle(NetworkOffering offering, DataCenter dc) {
// this guru handles only non-system network with type=Shared and serviceNat service disabled
//TODO - after broadCastDomainType + physical network are introduced, don't rely on network type of the dc
if (dc.getNetworkType() == NetworkType.Advanced && offering.getType() == Network.Type.Shared && !_networkMgr.isServiceSupportedByNetworkOffering(offering.getId(), Service.SourceNat)&& offering.getTrafficType() == TrafficType.Guest) {
if (dc.getNetworkType() == NetworkType.Advanced && offering.getGuestType() == Network.GuestType.Shared && !_networkMgr.isServiceSupportedByNetworkOffering(offering.getId(), Service.SourceNat)&& offering.getTrafficType() == TrafficType.Guest) {
if (_networkMgr.isServiceSupportedByNetworkOffering(offering.getId(), Service.SecurityGroup)) {
return true;
} else if (!offering.isSystemOnly()) {

View File

@ -80,7 +80,7 @@ public class GuestNetworkGuru extends AdapterBase implements NetworkGuru {
protected boolean canHandle(NetworkOffering offering, DataCenter dc) {
// This guru handles only non-system Guest Isolated network that supports Source nat service
if (dc.getNetworkType() == NetworkType.Advanced && offering.getTrafficType() == TrafficType.Guest && offering.getType() == Network.Type.Isolated && _networkMgr.isServiceSupportedByNetworkOffering(offering.getId(), Service.SourceNat) && !offering.isSystemOnly()) {
if (dc.getNetworkType() == NetworkType.Advanced && offering.getTrafficType() == TrafficType.Guest && offering.getGuestType() == Network.GuestType.Isolated && _networkMgr.isServiceSupportedByNetworkOffering(offering.getId(), Service.SourceNat) && !offering.isSystemOnly()) {
return true;
} else {
s_logger.trace("We only take care of Guest Virtual networks in zone of type " + NetworkType.Advanced);

View File

@ -459,7 +459,7 @@ public class ElasticLoadBalancerManagerImpl implements
try {
NetworkOffering offering = _networkOfferingDao.findByIdIncludingRemoved(guestNetwork.getNetworkOfferingId());
if (offering.isSystemOnly() || guestNetwork.getType() == Network.Type.Shared) {
if (offering.isSystemOnly() || guestNetwork.getGuestType() == Network.GuestType.Shared) {
owner = _accountService.getSystemAccount();
}
@ -572,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<NetworkOfferingVO> offerings = _networkOfferingDao.listByTrafficTypeAndType(true, _frontendTrafficType, Network.Type.Shared);
List<NetworkOfferingVO> offerings = _networkOfferingDao.listByTrafficTypeAndType(true, _frontendTrafficType, Network.GuestType.Shared);
if (offerings == null || offerings.size() == 0) {
s_logger.warn("ELB: Could not find system offering for direct networks of type " + _frontendTrafficType);
return null;
@ -611,8 +611,8 @@ public class ElasticLoadBalancerManagerImpl implements
NetworkVO network=_networkDao.findById(networkId);
if (network.getType() != Network.Type.Shared) {
s_logger.info("ELB: not handling traffic for network of type " + network.getType());
if (network.getGuestType() != Network.GuestType.Shared) {
s_logger.info("ELB: not handling traffic for network of type " + network.getGuestType());
return null;
}
return network;

View File

@ -726,7 +726,7 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
@Override
public void run() {
final List<DomainRouterVO> routers = _routerDao.listByStateAndNetworkType(State.Running, Network.Type.Isolated, mgmtSrvrId);
final List<DomainRouterVO> routers = _routerDao.listByStateAndNetworkType(State.Running, Network.GuestType.Isolated, mgmtSrvrId);
s_logger.debug("Found " + routers.size() + " running routers. ");
for (DomainRouterVO router : routers) {
@ -1351,7 +1351,7 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
public List<DomainRouterVO> deployDhcp(Network guestNetwork, DeployDestination dest, Account owner, Map<Param, Object> params) throws InsufficientCapacityException, StorageUnavailableException,
ConcurrentOperationException, ResourceUnavailableException {
NetworkOffering offering = _networkOfferingDao.findByIdIncludingRemoved(guestNetwork.getNetworkOfferingId());
if (offering.isSystemOnly() || guestNetwork.getType() == Network.Type.Shared) {
if (offering.isSystemOnly() || guestNetwork.getGuestType() == Network.GuestType.Shared) {
owner = _accountMgr.getAccount(Account.ACCOUNT_ID_SYSTEM);
}
@ -1508,11 +1508,11 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
buf.append(" dnssearchorder=").append(domain_suffix);
}
if (!network.isDefault() && network.getType() == Network.Type.Shared) {
if (!network.isDefault() && network.getGuestType() == Network.GuestType.Shared) {
buf.append(" defaultroute=false");
String virtualNetworkElementNicIP = _networkMgr.getIpOfNetworkElementInVirtualNetwork(network.getAccountId(), network.getDataCenterId());
if (network.getType() != Network.Type.Shared && virtualNetworkElementNicIP != null) {
if (network.getGuestType() != Network.GuestType.Shared && virtualNetworkElementNicIP != null) {
defaultDns1 = virtualNetworkElementNicIP;
} else {
s_logger.debug("No Virtual network found for account id=" + network.getAccountId() + " so setting dns to the dns of the network id=" + network.getId());
@ -1955,7 +1955,7 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
if (cmds.size() > 0) {
boolean podLevelException = false;
//for user vm in Basic zone we should try to re-deploy vm in a diff pod if it fails to deploy in original pod; so throwing exception with Pod scope
if (isZoneBasic && podId != null && profile.getVirtualMachine().getType() == VirtualMachine.Type.User && network.getTrafficType() == TrafficType.Guest && network.getType() == Network.Type.Shared) {
if (isZoneBasic && podId != null && profile.getVirtualMachine().getType() == VirtualMachine.Type.User && network.getTrafficType() == TrafficType.Guest && network.getGuestType() == Network.GuestType.Shared) {
podLevelException = true;
}
try {

View File

@ -912,7 +912,7 @@ public class SecurityGroupManagerImpl implements SecurityGroupManager, SecurityG
@DB
public boolean addInstanceToGroups(final Long userVmId, final List<Long> groups) {
if (!isVmSecurityGroupEnabled(userVmId)) {
s_logger.warn("User vm " + userVmId + " is not security group enabled, can't add it to security group");
s_logger.trace("User vm " + userVmId + " is not security group enabled, not adding it to security group");
return false;
}
if (groups != null && !groups.isEmpty()) {

View File

@ -29,7 +29,7 @@ import javax.persistence.Id;
import javax.persistence.Table;
import com.cloud.network.Network;
import com.cloud.network.Network.Type;
import com.cloud.network.Network.GuestType;
import com.cloud.network.Networks.TrafficType;
import com.cloud.offering.NetworkOffering;
import com.cloud.utils.db.GenericDao;
@ -91,9 +91,9 @@ public class NetworkOfferingVO implements NetworkOffering {
@Column(name=GenericDao.CREATED_COLUMN)
Date created;
@Column(name="type")
@Column(name="guest_type")
@Enumerated(value=EnumType.STRING)
Network.Type type;
Network.GuestType guestType;
@Override
public String getDisplayText() {
@ -198,11 +198,11 @@ public class NetworkOfferingVO implements NetworkOffering {
}
@Override
public Network.Type getType() {
return type;
public Network.GuestType getGuestType() {
return guestType;
}
public NetworkOfferingVO(String name, String displayText, TrafficType trafficType, boolean systemOnly, boolean specifyVlan, Integer rateMbps, Integer multicastRateMbps, Integer concurrentConnections, boolean isDefault, Availability availability, String tags, Network.Type type) {
public NetworkOfferingVO(String name, String displayText, TrafficType trafficType, boolean systemOnly, boolean specifyVlan, Integer rateMbps, Integer multicastRateMbps, Integer concurrentConnections, boolean isDefault, Availability availability, String tags, Network.GuestType guestType) {
this.name = name;
this.displayText = displayText;
this.rateMbps = rateMbps;
@ -215,7 +215,7 @@ public class NetworkOfferingVO implements NetworkOffering {
this.availability = availability;
this.uniqueName = name;
this.tags = tags;
this.type = type;
this.guestType = guestType;
}
public NetworkOfferingVO() {
@ -229,7 +229,6 @@ public class NetworkOfferingVO implements NetworkOffering {
public NetworkOfferingVO(String name, TrafficType trafficType) {
this(name, "System Offering for " + name, trafficType, true, false, 0, 0, null, true, Availability.Required, null, null);
this.state = State.Enabled;
this.type = Type.Shared;
}
@Override

View File

@ -59,7 +59,7 @@ public interface NetworkOfferingDao extends GenericDao<NetworkOfferingVO, Long>
List<NetworkOfferingVO> listByAvailability(Availability availability, boolean isSystem);
List<NetworkOfferingVO> listByTrafficTypeAndType(boolean isSystem, TrafficType trafficType, Network.Type type);
List<NetworkOfferingVO> listByTrafficTypeAndType(boolean isSystem, TrafficType trafficType, Network.GuestType type);
List<Long> getOfferingIdsToUpgradeFrom(NetworkOffering originalOffering);

View File

@ -66,7 +66,7 @@ public class NetworkOfferingDaoImpl extends GenericDaoBase<NetworkOfferingVO, Lo
TrafficTypeGuestTypeSearch = createSearchBuilder();
TrafficTypeGuestTypeSearch.and("trafficType", TrafficTypeGuestTypeSearch.entity().getTrafficType(), SearchCriteria.Op.EQ);
TrafficTypeGuestTypeSearch.and("type", TrafficTypeGuestTypeSearch.entity().getType(), SearchCriteria.Op.EQ);
TrafficTypeGuestTypeSearch.and("guestType", TrafficTypeGuestTypeSearch.entity().getGuestType(), SearchCriteria.Op.EQ);
TrafficTypeGuestTypeSearch.and("isSystem", TrafficTypeGuestTypeSearch.entity().isSystemOnly(), SearchCriteria.Op.EQ);
TrafficTypeGuestTypeSearch.done();
@ -75,7 +75,7 @@ public class NetworkOfferingDaoImpl extends GenericDaoBase<NetworkOfferingVO, Lo
UpgradeSearch.and("physicalNetworkId", UpgradeSearch.entity().getId(), Op.NEQ);
UpgradeSearch.and("physicalNetworkId", UpgradeSearch.entity().isSystemOnly(), Op.EQ);
UpgradeSearch.and("trafficType", UpgradeSearch.entity().getTrafficType(), Op.EQ);
UpgradeSearch.and("type", UpgradeSearch.entity().getType(), Op.EQ);
UpgradeSearch.and("guestType", UpgradeSearch.entity().getGuestType(), Op.EQ);
UpgradeSearch.and("state", UpgradeSearch.entity().getState(), Op.EQ);
UpgradeSearch.done();
}
@ -129,10 +129,10 @@ public class NetworkOfferingDaoImpl extends GenericDaoBase<NetworkOfferingVO, Lo
}
@Override
public List<NetworkOfferingVO> listByTrafficTypeAndType(boolean isSystem, TrafficType trafficType, Network.Type type) {
public List<NetworkOfferingVO> listByTrafficTypeAndType(boolean isSystem, TrafficType trafficType, Network.GuestType type) {
SearchCriteria<NetworkOfferingVO> sc = TrafficTypeGuestTypeSearch.create();
sc.setParameters("trafficType", trafficType);
sc.setParameters("type", type);
sc.setParameters("guestType", type);
sc.setParameters("isSystem", isSystem);
return listBy(sc, null);
}
@ -155,7 +155,7 @@ public class NetworkOfferingDaoImpl extends GenericDaoBase<NetworkOfferingVO, Lo
sc.addAnd("systemOnly", SearchCriteria.Op.EQ, false);
//Type of the network should be the same
sc.addAnd("type", SearchCriteria.Op.EQ, originalOffering.getType());
sc.addAnd("guestType", SearchCriteria.Op.EQ, originalOffering.getGuestType());
//Traffic types should be the same
sc.addAnd("trafficType", SearchCriteria.Op.EQ, originalOffering.getTrafficType());

View File

@ -861,7 +861,7 @@ public class ConfigurationServerImpl implements ConfigurationServer {
"System-Guest-Network",
TrafficType.Guest,
true, false, null, null, null, true,
Availability.Optional, null, Network.Type.Shared);
Availability.Optional, null, Network.GuestType.Shared);
guestNetworkOffering.setState(NetworkOffering.State.Enabled);
@ -878,7 +878,7 @@ public class ConfigurationServerImpl implements ConfigurationServer {
"Virtual Vlan",
TrafficType.Guest,
false, false, null, null, null, true,
Availability.Required, null, Network.Type.Isolated);
Availability.Required, null, Network.GuestType.Isolated);
defaultGuestNetworkOffering.setState(NetworkOffering.State.Enabled);
defaultGuestNetworkOffering = _networkOfferingDao.persistDefaultNetworkOffering(defaultGuestNetworkOffering);
@ -895,7 +895,7 @@ public class ConfigurationServerImpl implements ConfigurationServer {
"Direct",
TrafficType.Guest,
false, true, null, null, null, true,
Availability.Optional, null, Network.Type.Shared);
Availability.Optional, null, Network.GuestType.Shared);
defaultGuestDirectNetworkOffering.setState(NetworkOffering.State.Enabled);
defaultGuestDirectNetworkOffering = _networkOfferingDao.persistDefaultNetworkOffering(defaultGuestDirectNetworkOffering);
@ -962,7 +962,7 @@ public class ConfigurationServerImpl implements ConfigurationServer {
}
if (broadcastDomainType != null) {
NetworkVO network = new NetworkVO(id, trafficType, 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.GuestType.Shared, true, zoneId, null);
network.setGuruName(guruNames.get(network.getTrafficType()));
network.setDns1(zone.getDns1());
network.setDns2(zone.getDns2());

View File

@ -2101,12 +2101,12 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
throw new InvalidParameterValueException("Can't create a vm with multiple networks one of which is Security Group enabled");
}
if (network.getTrafficType() != TrafficType.Guest || network.getType() != Network.Type.Shared || (network.getType() == Network.Type.Shared && !isSecurityGroupEnabled)) {
if (network.getTrafficType() != TrafficType.Guest || network.getGuestType() != Network.GuestType.Shared || (network.getGuestType() == Network.GuestType.Shared && !isSecurityGroupEnabled)) {
throw new InvalidParameterValueException("Can specify only Direct Guest Account specific networks when deploy vm in Security Group enabled zone");
}
// Perform account permission check
if (network.getType() != Network.Type.Shared) {
if (network.getGuestType() != Network.GuestType.Shared) {
// Check account permissions
List<NetworkVO> networkMap = _networkDao.listBy(owner.getId(), network.getId());
if (networkMap == null || networkMap.isEmpty()) {
@ -2175,11 +2175,11 @@ 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<NetworkOfferingVO> defaultVirtualOffering = _networkOfferingDao.listByTrafficTypeAndType(false, TrafficType.Guest, Network.Type.Isolated);
List<NetworkOfferingVO> defaultVirtualOffering = _networkOfferingDao.listByTrafficTypeAndType(false, TrafficType.Guest, Network.GuestType.Isolated);
PhysicalNetwork physicalNetwork = _networkMgr.translateZoneIdToPhysicalNetwork(zone.getId());
if (defaultVirtualOffering.get(0).getAvailability() == Availability.Required) {
// get Virtual netowrks
List<NetworkVO> virtualNetworks = _networkMgr.listNetworksForAccount(owner.getId(), zone.getId(), Network.Type.Isolated, true);
List<NetworkVO> virtualNetworks = _networkMgr.listNetworksForAccount(owner.getId(), zone.getId(), Network.GuestType.Isolated, true);
if (virtualNetworks.isEmpty()) {
@ -2238,7 +2238,7 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
}
// Perform account permission check
if (network.getType() != Network.Type.Shared) {
if (network.getGuestType() != Network.GuestType.Shared) {
List<NetworkVO> networkMap = _networkDao.listBy(owner.getId(), network.getId());
if (networkMap == null || networkMap.isEmpty()) {
throw new PermissionDeniedException("Unable to create a vm using network with id " + network.getId() + ", permission denied");
@ -3334,7 +3334,7 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
for (NetworkVO network : zoneNetworks) { // get the default networks for the account
NetworkOfferingVO no = _networkOfferingDao.findById(network.getNetworkOfferingId());
if (!no.isSystemOnly()) {
if (network.getType() == Network.Type.Shared || !_networkDao.listBy(oldAccount.getId(), network.getId()).isEmpty()) {
if (network.getGuestType() == Network.GuestType.Shared || !_networkDao.listBy(oldAccount.getId(), network.getId()).isEmpty()) {
if (network.isDefault()) {
oldNetworks.add(network);
}
@ -3344,7 +3344,7 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
for (NetworkVO oldNet: oldNetworks){
long networkOffering = oldNet.getNetworkOfferingId();
PhysicalNetwork physicalNetwork = _networkMgr.translateZoneIdToPhysicalNetwork(zone.getId());
List<NetworkVO> virtualNetworks = _networkMgr.listNetworksForAccount(newAccount.getId(), zone.getId(), Network.Type.Isolated, true);
List<NetworkVO> virtualNetworks = _networkMgr.listNetworksForAccount(newAccount.getId(), zone.getId(), Network.GuestType.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, physicalNetwork);

View File

@ -97,7 +97,7 @@ public interface DomainRouterDao extends GenericDao<DomainRouterVO, Long> {
* List domain routers by state and network type which reside on Host managed by the specified management server
* @return
*/
List<DomainRouterVO> listByStateAndNetworkType(State state, Network.Type type, long mgmtSrvrId);
List<DomainRouterVO> listByStateAndNetworkType(State state, Network.GuestType type, long mgmtSrvrId);
List<DomainRouterVO> findByNetworkOutsideThePod(long networkId, long podId, State state, Role role);

View File

@ -75,14 +75,14 @@ public class DomainRouterDaoImpl extends GenericDaoBase<DomainRouterVO, Long> im
HostUpSearch.and("host", HostUpSearch.entity().getHostId(), Op.EQ);
HostUpSearch.and("states", HostUpSearch.entity().getState(), Op.NIN);
SearchBuilder<NetworkVO> joinNetwork = _networksDao.createSearchBuilder();
joinNetwork.and("type", joinNetwork.entity().getType(), Op.EQ);
joinNetwork.and("type", joinNetwork.entity().getGuestType(), 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<NetworkVO> joinStateNetwork = _networksDao.createSearchBuilder();
joinStateNetwork.and("type", joinStateNetwork.entity().getType(), Op.EQ);
joinStateNetwork.and("type", joinStateNetwork.entity().getGuestType(), Op.EQ);
StateNetworkTypeSearch.join("network", joinStateNetwork, joinStateNetwork.entity().getId(), StateNetworkTypeSearch.entity().getNetworkId(), JoinType.INNER);
SearchBuilder<HostVO> joinHost = _hostsDao.createSearchBuilder();
joinHost.and("mgmtServerId", joinHost.entity().getManagementServerId(), Op.EQ);
@ -158,7 +158,7 @@ public class DomainRouterDaoImpl extends GenericDaoBase<DomainRouterVO, Long> im
if (hostId != null) {
sc.setParameters("host", hostId);
}
sc.setJoinParameters("network", "type", Network.Type.Isolated);
sc.setJoinParameters("network", "type", Network.GuestType.Isolated);
return listBy(sc);
}
@ -169,7 +169,7 @@ public class DomainRouterDaoImpl extends GenericDaoBase<DomainRouterVO, Long> im
sc.setParameters("host", hostId);
}
sc.setParameters("states", State.Destroyed, State.Stopped, State.Expunging);
sc.setJoinParameters("network", "type", Network.Type.Isolated);
sc.setJoinParameters("network", "type", Network.GuestType.Isolated);
return listBy(sc);
}
@ -204,7 +204,7 @@ public class DomainRouterDaoImpl extends GenericDaoBase<DomainRouterVO, Long> im
}
@Override
public List<DomainRouterVO> listByStateAndNetworkType(State state, Network.Type type, long mgmtSrvrId) {
public List<DomainRouterVO> listByStateAndNetworkType(State state, Network.GuestType type, long mgmtSrvrId) {
SearchCriteria<DomainRouterVO> sc = StateNetworkTypeSearch.create();
sc.setParameters("state", state);
sc.setJoinParameters("network", "type", type);

View File

@ -82,7 +82,7 @@ public class UserVmDaoImpl extends GenericDaoBase<UserVmVO, Long> 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.type, networks.is_default from vm_instance " +
"networks.traffic_type, networks.guest_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 " +
@ -510,7 +510,7 @@ public class UserVmDaoImpl extends GenericDaoBase<UserVmVO, Long> implements Use
nicResponse.setTrafficType(rs.getString("networks.traffic_type"));
nicResponse.setType(rs.getString("networks.type"));
nicResponse.setType(rs.getString("networks.guest_type"));
nicResponse.setIsDefault(rs.getBoolean("networks.is_default"));
nicResponse.setObjectName("nic");
userVmData.addNic(nicResponse);

View File

@ -186,9 +186,9 @@ CREATE TABLE `cloud`.`networks` (
`network_domain` varchar(255) COMMENT 'domain',
`reservation_id` char(40) COMMENT 'reservation id',
`is_default` int(1) unsigned NOT NULL DEFAULT 0 COMMENT '1 if network is default',
`guest_type` char(32) COMMENT 'type of guest network; can be shared or isolated',
`created` datetime NOT NULL COMMENT 'date created',
`removed` datetime COMMENT 'date removed if not null',
`type` char(32) COMMENT 'type of the network, can be Shared or Isolated',
PRIMARY KEY (`id`),
CONSTRAINT `fk_networks__network_offering_id` FOREIGN KEY (`network_offering_id`) REFERENCES `network_offerings`(`id`),
CONSTRAINT `fk_networks__data_center_id` FOREIGN KEY (`data_center_id`) REFERENCES `data_center`(`id`) ON DELETE CASCADE,
@ -264,7 +264,7 @@ CREATE TABLE `cloud`.`network_offerings` (
`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',
`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',
`guest_type` char(32) COMMENT 'type of guest network; can be shared or isolated',
PRIMARY KEY (`id`),
INDEX `i_network_offerings__system_only`(`system_only`),
INDEX `i_network_offerings__removed`(`removed`)