mirror of https://github.com/apache/cloudstack.git
ipv6: disable IPv6-only shared network with VR (#5810)
* ipv6: disable IPv6-only shared network with VR * Update #5810: import org.apache.commons.lang3.StringUtils * Update #5810: do not import org.apache.commons.lang3.StringUtils * Update server/src/main/java/com/cloud/network/NetworkServiceImpl.java * Update engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java Co-authored-by: Daniel Augusto Veronezi Salvador <38945620+GutoVeronezi@users.noreply.github.com>
This commit is contained in:
parent
223bc11d2a
commit
216bea1978
|
|
@ -2642,7 +2642,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
|
|||
&& !_networkModel.areServicesSupportedByNetworkOffering(ntwkOff.getId(), Service.SourceNat)));
|
||||
if (cidr == null && ip6Cidr == null && cidrRequired) {
|
||||
if (ntwkOff.getGuestType() == GuestType.Shared) {
|
||||
throw new InvalidParameterValueException("StartIp/endIp/gateway/netmask are required when create network of" + " type " + Network.GuestType.Shared);
|
||||
throw new InvalidParameterValueException(String.format("Gateway/netmask are required when creating %s networks.", Network.GuestType.Shared));
|
||||
} else {
|
||||
throw new InvalidParameterValueException("gateway/netmask are required when create network of" + " type " + GuestType.Isolated + " with service " + Service.SourceNat.getName() + " disabled");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1252,8 +1252,8 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService, C
|
|||
}
|
||||
}
|
||||
|
||||
boolean ipv4 = true, ipv6 = false;
|
||||
if (startIP != null) {
|
||||
boolean ipv4 = false, ipv6 = false;
|
||||
if (org.apache.commons.lang3.StringUtils.isNoneBlank(gateway, netmask)) {
|
||||
ipv4 = true;
|
||||
}
|
||||
if (isNotBlank(ip6Cidr) && isNotBlank(ip6Gateway)) {
|
||||
|
|
@ -1297,14 +1297,10 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService, C
|
|||
} else if (!NetUtils.isValidIp4(endIP)) {
|
||||
throw new InvalidParameterValueException("Invalid format for the endIp parameter");
|
||||
}
|
||||
}
|
||||
|
||||
if (startIP != null && endIP != null) {
|
||||
if (!(gateway != null && netmask != null)) {
|
||||
throw new InvalidParameterValueException("gateway and netmask should be defined when startIP/endIP are passed in");
|
||||
}
|
||||
}
|
||||
|
||||
if (gateway != null && netmask != null) {
|
||||
if (NetUtils.isNetworkorBroadcastIP(gateway, netmask)) {
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
|
|
@ -1338,6 +1334,10 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService, C
|
|||
if(isBlank(zone.getIp6Dns1()) && isBlank(zone.getIp6Dns2())) {
|
||||
throw new InvalidParameterValueException("Can only create IPv6 network if the zone has IPv6 DNS! Please configure the zone IPv6 DNS1 and/or IPv6 DNS2.");
|
||||
}
|
||||
|
||||
if (!ipv4 && ntwkOff.getGuestType() == GuestType.Shared && _networkModel.isProviderForNetworkOffering(Provider.VirtualRouter, networkOfferingId)) {
|
||||
throw new InvalidParameterValueException("Currently IPv6-only Shared network with Virtual Router provider is not supported.");
|
||||
}
|
||||
}
|
||||
|
||||
validateRouterIps(routerIp, routerIpv6, startIP, endIP, gateway, netmask, startIPv6, endIPv6, ip6Cidr);
|
||||
|
|
|
|||
Loading…
Reference in New Issue