Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -69,19 +69,16 @@ protected boolean canHandle(NetworkOffering offering, final NetworkType networkT

@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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
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;
Expand Down Expand Up @@ -124,22 +123,7 @@ public Network design(NetworkOffering offering, DeploymentPlan plan, Network use
/* 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
Expand Down
18 changes: 18 additions & 0 deletions server/src/main/java/com/cloud/network/guru/GuestNetworkGuru.java
Original file line number Diff line number Diff line change
Expand Up @@ -545,4 +545,22 @@ public String getConfigComponentName() {
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;
}
}