mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
server: fix dualstack ipv6 networks for vxlan (#7933)
Fixes #7926 Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
This commit is contained in:
parent
126dd5fa4c
commit
f049f5409e
@ -69,19 +69,16 @@ public class VxlanGuestNetworkGuru extends GuestNetworkGuru {
|
||||
|
||||
@Override
|
||||
public Network design(NetworkOffering offering, DeploymentPlan plan, Network userSpecified, Account owner) {
|
||||
|
||||
NetworkVO network = (NetworkVO)super.design(offering, plan, userSpecified, owner);
|
||||
if (network == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (offering.getGuestType() == GuestType.L2 && network.getBroadcastUri() != null) {
|
||||
String vxlan = BroadcastDomainType.getValue(network.getBroadcastUri());
|
||||
network.setBroadcastUri(BroadcastDomainType.Vxlan.toUri(vxlan));
|
||||
}
|
||||
network.setBroadcastDomainType(BroadcastDomainType.Vxlan);
|
||||
|
||||
return network;
|
||||
return updateNetworkDesignForIPv6IfNeeded(network, userSpecified);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -36,7 +36,6 @@ import com.cloud.event.EventTypes;
|
||||
import com.cloud.event.EventVO;
|
||||
import com.cloud.exception.InsufficientAddressCapacityException;
|
||||
import com.cloud.exception.InsufficientVirtualNetworkCapacityException;
|
||||
import com.cloud.exception.InvalidParameterValueException;
|
||||
import com.cloud.network.IpAddressManager;
|
||||
import com.cloud.network.Network;
|
||||
import com.cloud.network.Network.GuestType;
|
||||
@ -124,22 +123,7 @@ public class ExternalGuestNetworkGuru extends GuestNetworkGuru {
|
||||
/* In order to revert userSpecified network setup */
|
||||
config.setState(State.Allocated);
|
||||
}
|
||||
if (userSpecified == null) {
|
||||
return config;
|
||||
}
|
||||
if ((userSpecified.getIp6Cidr() == null && userSpecified.getIp6Gateway() != null) ||
|
||||
(userSpecified.getIp6Cidr() != null && userSpecified.getIp6Gateway() == null)) {
|
||||
throw new InvalidParameterValueException("ip6gateway and ip6cidr must be specified together.");
|
||||
}
|
||||
if (userSpecified.getIp6Cidr() != null) {
|
||||
config.setIp6Cidr(userSpecified.getIp6Cidr());
|
||||
config.setIp6Gateway(userSpecified.getIp6Gateway());
|
||||
}
|
||||
if (userSpecified.getRouterIpv6() != null) {
|
||||
config.setRouterIpv6(userSpecified.getRouterIpv6());
|
||||
}
|
||||
|
||||
return config;
|
||||
return updateNetworkDesignForIPv6IfNeeded(config, userSpecified);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -545,4 +545,22 @@ public abstract class GuestNetworkGuru extends AdapterBase implements NetworkGur
|
||||
public ConfigKey<?>[] getConfigKeys() {
|
||||
return new ConfigKey<?>[]{UseSystemGuestVlans};
|
||||
}
|
||||
|
||||
public Network updateNetworkDesignForIPv6IfNeeded(NetworkVO network, Network userSpecified) {
|
||||
if (userSpecified == null) {
|
||||
return network;
|
||||
}
|
||||
if ((userSpecified.getIp6Cidr() == null && userSpecified.getIp6Gateway() != null) ||
|
||||
(userSpecified.getIp6Cidr() != null && userSpecified.getIp6Gateway() == null)) {
|
||||
throw new InvalidParameterValueException("ip6gateway and ip6cidr must be specified together.");
|
||||
}
|
||||
if (userSpecified.getIp6Cidr() != null) {
|
||||
network.setIp6Cidr(userSpecified.getIp6Cidr());
|
||||
network.setIp6Gateway(userSpecified.getIp6Gateway());
|
||||
}
|
||||
if (userSpecified.getRouterIpv6() != null) {
|
||||
network.setRouterIpv6(userSpecified.getRouterIpv6());
|
||||
}
|
||||
return network;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user