Skip to content

Commit

Permalink
server: fix network creation when ipv4 subnet is dedicated
Browse files Browse the repository at this point in the history
  • Loading branch information
weizhouapache committed Aug 29, 2024
1 parent bbc44d3 commit 83d1915
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public interface RoutedIpv4Manager extends PluggableService, Configurable {
// Methods for internal calls
void getOrCreateIpv4SubnetForGuestNetwork(Network network, String networkCidr);

Ipv4GuestSubnetNetworkMap getOrCreateIpv4SubnetForGuestNetwork(Network network, Integer networkCidrSize);
Ipv4GuestSubnetNetworkMap getOrCreateIpv4SubnetForGuestNetwork(Long domainId, Long accountId, Long zoneId, Integer networkCidrSize);

void getOrCreateIpv4SubnetForVpc(Vpc vpc, String networkCidr);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ public Network design(NetworkOffering offering, DeploymentPlan plan, Network use
if (userSpecified.getNetworkCidrSize() == null) {
throw new InvalidParameterValueException("The network CIDR or CIDR size must be specified.");
}
Ipv4GuestSubnetNetworkMap subnet = routedIpv4Manager.getOrCreateIpv4SubnetForGuestNetwork(config, userSpecified.getNetworkCidrSize());
Ipv4GuestSubnetNetworkMap subnet = routedIpv4Manager.getOrCreateIpv4SubnetForGuestNetwork(owner.getDomainId(), owner.getAccountId(), config.getDataCenterId(), userSpecified.getNetworkCidrSize());
if (subnet != null) {
final String[] cidrTuple = subnet.getSubnet().split("\\/");
config.setGateway(NetUtils.getIpRangeStartIpFromCidr(cidrTuple[0], Long.parseLong(cidrTuple[1])));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -576,12 +576,12 @@ public void getOrCreateIpv4SubnetForGuestNetwork(Network network, String network
}

@Override
public Ipv4GuestSubnetNetworkMap getOrCreateIpv4SubnetForGuestNetwork(Network network, Integer networkCidrSize) {
Ipv4GuestSubnetNetworkMap subnet = getIpv4SubnetForAccount(network.getDomainId(), network.getAccountId(), network.getDataCenterId(), networkCidrSize);
public Ipv4GuestSubnetNetworkMap getOrCreateIpv4SubnetForGuestNetwork(Long domainId, Long accountId, Long zoneId, Integer networkCidrSize) {
Ipv4GuestSubnetNetworkMap subnet = getIpv4SubnetForAccount(domainId, accountId, zoneId, networkCidrSize);
if (subnet != null) {
return subnet;
}
return createIpv4SubnetForAccount(network.getDomainId(), network.getAccountId(), network.getDataCenterId(), networkCidrSize);
return createIpv4SubnetForAccount(domainId, accountId, zoneId, networkCidrSize);
}

@Override
Expand Down

0 comments on commit 83d1915

Please sign in to comment.