Skip to content
Draft
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
4 changes: 4 additions & 0 deletions api/src/main/java/com/cloud/network/NetworkService.java
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,10 @@
PhysicalNetwork physicalNetwork, long zoneId, ControlledEntity.ACLType aclType) throws
InsufficientCapacityException, ConcurrentOperationException, ResourceAllocationException;

Network createGuestNetwork(long networkOfferingId, String name, String displayText, Account owner,

Check warning on line 110 in api/src/main/java/com/cloud/network/NetworkService.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Method has 8 parameters, which is greater than 7 authorized.

See more on https://sonarcloud.io/project/issues?id=apache_cloudstack&issues=AZsI8X-wo7Y6f19XXVJF&open=AZsI8X-wo7Y6f19XXVJF&pullRequest=12228
PhysicalNetwork physicalNetwork, long zoneId, ControlledEntity.ACLType aclType, Pair<Integer, Integer> vrIfaceMTUs) throws
InsufficientCapacityException, ConcurrentOperationException, ResourceAllocationException;

Pair<List<? extends Network>, Integer> searchForNetworks(ListNetworksCmd cmd);

boolean deleteNetwork(long networkId, boolean forced);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -973,9 +973,12 @@ private Network getKubernetesClusterNetworkIfMissing(final String clusterName, f

CallContext networkContext = CallContext.register(CallContext.current(), ApiCommandResourceType.Network);
try {
Long zoneId = zone.getId();
Integer publicMTU = NetworkService.VRPublicInterfaceMtu.valueIn(zoneId);
Integer privateMTU = NetworkService.VRPrivateInterfaceMtu.valueIn(zoneId);
network = networkService.createGuestNetwork(networkOffering.getId(), clusterName + "-network",
owner.getAccountName() + "-network", owner, physicalNetwork, zone.getId(),
ControlledEntity.ACLType.Account);
owner.getAccountName() + "-network", owner, physicalNetwork, zoneId,
ControlledEntity.ACLType.Account, new Pair<>(publicMTU, privateMTU));
} catch (ConcurrentOperationException | InsufficientCapacityException | ResourceAllocationException e) {
logAndThrow(Level.ERROR, String.format("Unable to create network for the Kubernetes cluster: %s", clusterName));
} finally {
Expand Down
12 changes: 12 additions & 0 deletions server/src/main/java/com/cloud/network/NetworkServiceImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -1869,6 +1869,18 @@ public Network createGuestNetwork(long networkOfferingId, String name, String di
null, null, null, null, null, null, null, null, null, null);
}

@Override
@DB
@ActionEvent(eventType = EventTypes.EVENT_NETWORK_CREATE, eventDescription = "creating network")
public Network createGuestNetwork(long networkOfferingId, String name, String displayText, Account owner,
PhysicalNetwork physicalNetwork, long zoneId, ACLType aclType, Pair<Integer, Integer> vrIfaceMTUs) throws
InsufficientCapacityException, ConcurrentOperationException, ResourceAllocationException {
return _networkMgr.createGuestNetwork(networkOfferingId, name, displayText,
null, null, null, false, null, owner, null, physicalNetwork, zoneId,
aclType, null, null, null, null, true, null,
null, null, null, null, null, null, null, null, vrIfaceMTUs, null);
}

void checkAndSetRouterSourceNatIp(Account owner, CreateNetworkCmd cmd, Network network) throws InsufficientAddressCapacityException, ResourceAllocationException {
String sourceNatIp = cmd.getSourceNatIP();
if (sourceNatIp == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,13 @@ public Network createGuestNetwork(long networkOfferingId, String name, String di
return null;
}

@Override
public Network createGuestNetwork(long networkOfferingId, String name, String displayText, Account owner,
PhysicalNetwork physicalNetwork, long zoneId, ACLType aclType, Pair<Integer, Integer> vrIfaceMTUs)
throws InsufficientCapacityException, ConcurrentOperationException, ResourceAllocationException {
return null;
}

/* (non-Javadoc)
* @see com.cloud.network.NetworkService#searchForNetworks(com.cloud.api.commands.ListNetworksCmd)
*/
Expand Down
Loading