mirror of https://github.com/apache/cloudstack.git
1) Method name change
2) Rely on SourceNatService when decide if DirectNetworkGuru and GuestNetworkGuru should handle the network
This commit is contained in:
parent
75c8e33226
commit
f6717e0a23
|
|
@ -194,7 +194,7 @@ public interface NetworkManager extends NetworkService {
|
|||
|
||||
boolean applyIpAssociations(Network network, boolean continueOnError) throws ResourceUnavailableException;
|
||||
|
||||
boolean isServiceSupported(long networkId, Network.Service service);
|
||||
boolean isServiceSupportedByNetworkOffering(long networkOfferingId, Network.Service service);
|
||||
|
||||
NetworkVO getNetworkWithSecurityGroupEnabled(Long zoneId);
|
||||
|
||||
|
|
|
|||
|
|
@ -1784,7 +1784,7 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
|||
}
|
||||
|
||||
// If networkDomain is not specified, take it from the global configuration
|
||||
if (isServiceSupported(networkOfferingId, Service.Dns)) {
|
||||
if (isServiceSupportedByNetworkOffering(networkOfferingId, Service.Dns)) {
|
||||
Map<Network.Capability, String> dnsCapabilities = getServiceCapabilities(zoneId, networkOfferingId, Service.Dns);
|
||||
String isUpdateDnsSupported = dnsCapabilities.get(Capability.AllowDnsSuffixModification);
|
||||
if (isUpdateDnsSupported == null || !Boolean.valueOf(isUpdateDnsSupported)) {
|
||||
|
|
@ -2648,7 +2648,7 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
|||
Map<Service, Map<Capability, String>> networkCapabilities = new HashMap<Service, Map<Capability, String>>();
|
||||
|
||||
for (Service service : zoneCapabilities.keySet()) {
|
||||
if (isServiceSupported(networkOfferingId, service)) {
|
||||
if (isServiceSupportedByNetworkOffering(networkOfferingId, service)) {
|
||||
networkCapabilities.put(service, zoneCapabilities.get(service));
|
||||
}
|
||||
}
|
||||
|
|
@ -2659,7 +2659,7 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
|||
@Override
|
||||
public Map<Capability, String> getServiceCapabilities(long zoneId, Long networkOfferingId, Service service) {
|
||||
|
||||
if (!isServiceSupported(networkOfferingId, service)) {
|
||||
if (!isServiceSupportedByNetworkOffering(networkOfferingId, service)) {
|
||||
throw new UnsupportedServiceException("Service " + service.getName() + " is not supported by the network offering id=" + networkOfferingId);
|
||||
}
|
||||
|
||||
|
|
@ -2918,7 +2918,7 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isServiceSupported(long networkOfferingId, Network.Service service) {
|
||||
public boolean isServiceSupportedByNetworkOffering(long networkOfferingId, Network.Service service) {
|
||||
return (_ntwkOfferingSrvcDao.isServiceSupported(networkOfferingId, service));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ import com.cloud.exception.InsufficientVirtualNetworkCapcityException;
|
|||
import com.cloud.exception.InvalidParameterValueException;
|
||||
import com.cloud.network.IPAddressVO;
|
||||
import com.cloud.network.Network;
|
||||
import com.cloud.network.Network.Service;
|
||||
import com.cloud.network.Network.State;
|
||||
import com.cloud.network.NetworkManager;
|
||||
import com.cloud.network.NetworkProfile;
|
||||
|
|
@ -74,9 +75,9 @@ public class DirectNetworkGuru extends AdapterBase implements NetworkGuru {
|
|||
NetworkOfferingDao _networkOfferingDao;
|
||||
|
||||
protected boolean canHandle(NetworkOffering offering, DataCenter dc) {
|
||||
// this guru handles only non-system network with guestIpType = Direct
|
||||
// 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 && offering.getTrafficType() == TrafficType.Guest) {
|
||||
if (dc.getNetworkType() == NetworkType.Advanced && offering.getType() == Network.Type.Shared && !_networkMgr.isServiceSupportedByNetworkOffering(offering.getId(), Service.SourceNat)&& offering.getTrafficType() == TrafficType.Guest) {
|
||||
if (offering.isSecurityGroupEnabled()) {
|
||||
return true;
|
||||
} else if (!offering.isSystemOnly()) {
|
||||
|
|
|
|||
|
|
@ -79,6 +79,7 @@ public class DirectPodBasedNetworkGuru extends DirectNetworkGuru {
|
|||
@Override
|
||||
protected boolean canHandle(NetworkOffering offering, DataCenter dc) {
|
||||
// this guru handles system Direct pod based network
|
||||
//FIXME - verify broadcast domain type here
|
||||
if (dc.getNetworkType() == NetworkType.Basic && offering.getTrafficType() == TrafficType.Guest) {
|
||||
return true;
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ 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.Service;
|
||||
import com.cloud.network.Network.State;
|
||||
import com.cloud.network.NetworkManager;
|
||||
import com.cloud.network.NetworkProfile;
|
||||
|
|
@ -78,8 +79,8 @@ public class GuestNetworkGuru extends AdapterBase implements NetworkGuru {
|
|||
}
|
||||
|
||||
protected boolean canHandle(NetworkOffering offering, DataCenter dc) {
|
||||
// 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()) {
|
||||
// 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()) {
|
||||
return true;
|
||||
} else {
|
||||
s_logger.trace("We only take care of Guest Virtual networks in zone of type " + NetworkType.Advanced);
|
||||
|
|
|
|||
|
|
@ -77,10 +77,10 @@ public class PublicNetworkGuru extends AdapterBase implements NetworkGuru {
|
|||
NetworkOfferingDao _networkOfferingDao;
|
||||
|
||||
protected boolean canHandle(NetworkOffering offering, DataCenter dc) {
|
||||
if (!offering.isSecurityGroupEnabled() && offering.getTrafficType() == TrafficType.Public && offering.isSystemOnly()) {
|
||||
if (offering.getTrafficType() == TrafficType.Public && offering.isSystemOnly()) {
|
||||
return true;
|
||||
} else {
|
||||
s_logger.trace("We only take care of System only Public Virtual Network");
|
||||
s_logger.trace("We take care only of System Public Virtual Network");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -421,7 +421,7 @@ public class LoadBalancingRulesManagerImpl implements LoadBalancingRulesManager,
|
|||
_accountMgr.checkAccess(caller.getCaller(), null, ipAddr);
|
||||
|
||||
// verify that lb service is supported by the network
|
||||
if (!_networkMgr.isServiceSupported(network.getNetworkOfferingId(), Service.Lb)) {
|
||||
if (!_networkMgr.isServiceSupportedByNetworkOffering(network.getNetworkOfferingId(), Service.Lb)) {
|
||||
throw new InvalidParameterValueException("LB service is not supported in network id= " + networkId);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -343,7 +343,7 @@ public class RulesManagerImpl implements RulesManager, RulesService, Manager {
|
|||
}
|
||||
|
||||
Network network = _networkMgr.getNetwork(networkId);
|
||||
if (!_networkMgr.isServiceSupported(network.getNetworkOfferingId(), Service.Firewall)) {
|
||||
if (!_networkMgr.isServiceSupportedByNetworkOffering(network.getNetworkOfferingId(), Service.Firewall)) {
|
||||
throw new InvalidParameterValueException("Unable to create static nat rule; Firewall service is not supported in network id=" + networkId);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@ public class RemoteAccessVpnManagerImpl implements RemoteAccessVpnService, Manag
|
|||
|
||||
//Verify that vpn service is enabled for the network
|
||||
Network network = _networkMgr.getNetwork(ipAddr.getAssociatedWithNetworkId());
|
||||
if (!_networkMgr.isServiceSupported(network.getNetworkOfferingId(), Service.Vpn)) {
|
||||
if (!_networkMgr.isServiceSupportedByNetworkOffering(network.getNetworkOfferingId(), Service.Vpn)) {
|
||||
throw new InvalidParameterValueException("Vpn service is not supported in network id=" + ipAddr.getAssociatedWithNetworkId());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -402,7 +402,7 @@ public class MockNetworkManagerImpl implements NetworkManager, Manager, NetworkS
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isServiceSupported(long networkId, Service service) {
|
||||
public boolean isServiceSupportedByNetworkOffering(long networkOfferingId, Service service) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue