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
|
@Override
|
||||||
public Network design(NetworkOffering offering, DeploymentPlan plan, Network userSpecified, Account owner) {
|
public Network design(NetworkOffering offering, DeploymentPlan plan, Network userSpecified, Account owner) {
|
||||||
|
|
||||||
NetworkVO network = (NetworkVO)super.design(offering, plan, userSpecified, owner);
|
NetworkVO network = (NetworkVO)super.design(offering, plan, userSpecified, owner);
|
||||||
if (network == null) {
|
if (network == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (offering.getGuestType() == GuestType.L2 && network.getBroadcastUri() != null) {
|
if (offering.getGuestType() == GuestType.L2 && network.getBroadcastUri() != null) {
|
||||||
String vxlan = BroadcastDomainType.getValue(network.getBroadcastUri());
|
String vxlan = BroadcastDomainType.getValue(network.getBroadcastUri());
|
||||||
network.setBroadcastUri(BroadcastDomainType.Vxlan.toUri(vxlan));
|
network.setBroadcastUri(BroadcastDomainType.Vxlan.toUri(vxlan));
|
||||||
}
|
}
|
||||||
network.setBroadcastDomainType(BroadcastDomainType.Vxlan);
|
network.setBroadcastDomainType(BroadcastDomainType.Vxlan);
|
||||||
|
return updateNetworkDesignForIPv6IfNeeded(network, userSpecified);
|
||||||
return network;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -36,7 +36,6 @@ import com.cloud.event.EventTypes;
|
|||||||
import com.cloud.event.EventVO;
|
import com.cloud.event.EventVO;
|
||||||
import com.cloud.exception.InsufficientAddressCapacityException;
|
import com.cloud.exception.InsufficientAddressCapacityException;
|
||||||
import com.cloud.exception.InsufficientVirtualNetworkCapacityException;
|
import com.cloud.exception.InsufficientVirtualNetworkCapacityException;
|
||||||
import com.cloud.exception.InvalidParameterValueException;
|
|
||||||
import com.cloud.network.IpAddressManager;
|
import com.cloud.network.IpAddressManager;
|
||||||
import com.cloud.network.Network;
|
import com.cloud.network.Network;
|
||||||
import com.cloud.network.Network.GuestType;
|
import com.cloud.network.Network.GuestType;
|
||||||
@ -124,22 +123,7 @@ public class ExternalGuestNetworkGuru extends GuestNetworkGuru {
|
|||||||
/* In order to revert userSpecified network setup */
|
/* In order to revert userSpecified network setup */
|
||||||
config.setState(State.Allocated);
|
config.setState(State.Allocated);
|
||||||
}
|
}
|
||||||
if (userSpecified == null) {
|
return updateNetworkDesignForIPv6IfNeeded(config, userSpecified);
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -545,4 +545,22 @@ public abstract class GuestNetworkGuru extends AdapterBase implements NetworkGur
|
|||||||
public ConfigKey<?>[] getConfigKeys() {
|
public ConfigKey<?>[] getConfigKeys() {
|
||||||
return new ConfigKey<?>[]{UseSystemGuestVlans};
|
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