Skip to content

Commit eb7d54c

Browse files
Pearl1594dhslove
authored andcommitted
CKS: Use Zone MTUs when network is created at the time of CKS cluster creation (apache#12228)
1 parent b80c41c commit eb7d54c

4 files changed

Lines changed: 28 additions & 2 deletions

File tree

api/src/main/java/com/cloud/network/NetworkService.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,10 @@ Network createGuestNetwork(long networkOfferingId, String name, String displayTe
108108
PhysicalNetwork physicalNetwork, long zoneId, ControlledEntity.ACLType aclType) throws
109109
InsufficientCapacityException, ConcurrentOperationException, ResourceAllocationException;
110110

111+
Network createGuestNetwork(long networkOfferingId, String name, String displayText, Account owner,
112+
PhysicalNetwork physicalNetwork, long zoneId, ControlledEntity.ACLType aclType, Pair<Integer, Integer> vrIfaceMTUs) throws
113+
InsufficientCapacityException, ConcurrentOperationException, ResourceAllocationException;
114+
111115
Pair<List<? extends Network>, Integer> searchForNetworks(ListNetworksCmd cmd);
112116

113117
boolean deleteNetwork(long networkId, boolean forced);

plugins/integrations/kubernetes-service/src/main/java/com/cloud/kubernetes/cluster/KubernetesClusterManagerImpl.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1172,9 +1172,12 @@ private Network getKubernetesClusterNetworkIfMissing(final String clusterName, f
11721172

11731173
CallContext networkContext = CallContext.register(CallContext.current(), ApiCommandResourceType.Network);
11741174
try {
1175+
Long zoneId = zone.getId();
1176+
Integer publicMTU = NetworkService.VRPublicInterfaceMtu.valueIn(zoneId);
1177+
Integer privateMTU = NetworkService.VRPrivateInterfaceMtu.valueIn(zoneId);
11751178
network = networkService.createGuestNetwork(networkOffering.getId(), clusterName + "-network",
1176-
owner.getAccountName() + "-network", owner, physicalNetwork, zone.getId(),
1177-
ControlledEntity.ACLType.Account);
1179+
owner.getAccountName() + "-network", owner, physicalNetwork, zoneId,
1180+
ControlledEntity.ACLType.Account, new Pair<>(publicMTU, privateMTU));
11781181
if (!networkOffering.isForVpc() && NetworkOffering.RoutingMode.Dynamic == networkOffering.getRoutingMode()) {
11791182
bgpService.allocateASNumber(zone.getId(), asNumber, network.getId(), null);
11801183
}

server/src/main/java/com/cloud/network/NetworkServiceImpl.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1886,6 +1886,18 @@ public Network createGuestNetwork(long networkOfferingId, String name, String di
18861886
null, null, null, null, null, null, null, null, null, null);
18871887
}
18881888

1889+
@Override
1890+
@DB
1891+
@ActionEvent(eventType = EventTypes.EVENT_NETWORK_CREATE, eventDescription = "creating network")
1892+
public Network createGuestNetwork(long networkOfferingId, String name, String displayText, Account owner,
1893+
PhysicalNetwork physicalNetwork, long zoneId, ACLType aclType, Pair<Integer, Integer> vrIfaceMTUs) throws
1894+
InsufficientCapacityException, ConcurrentOperationException, ResourceAllocationException {
1895+
return _networkMgr.createGuestNetwork(networkOfferingId, name, displayText,
1896+
null, null, null, false, null, owner, null, physicalNetwork, zoneId,
1897+
aclType, null, null, null, null, true, null,
1898+
null, null, null, null, null, null, null, null, vrIfaceMTUs, null);
1899+
}
1900+
18891901
void checkAndSetRouterSourceNatIp(Account owner, CreateNetworkCmd cmd, Network network) throws InsufficientAddressCapacityException, ResourceAllocationException {
18901902
String sourceNatIp = cmd.getSourceNatIP();
18911903
if (sourceNatIp == null) {

server/src/test/java/com/cloud/vpc/MockNetworkManagerImpl.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,13 @@ public Network createGuestNetwork(long networkOfferingId, String name, String di
231231
return null;
232232
}
233233

234+
@Override
235+
public Network createGuestNetwork(long networkOfferingId, String name, String displayText, Account owner,
236+
PhysicalNetwork physicalNetwork, long zoneId, ACLType aclType, Pair<Integer, Integer> vrIfaceMTUs)
237+
throws InsufficientCapacityException, ConcurrentOperationException, ResourceAllocationException {
238+
return null;
239+
}
240+
234241
/* (non-Javadoc)
235242
* @see com.cloud.network.NetworkService#searchForNetworks(com.cloud.api.commands.ListNetworksCmd)
236243
*/

0 commit comments

Comments
 (0)