Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
74e9599
VR: Support configurable MTU
Pearl1594 May 30, 2022
95fa5f5
add support for vpc networks
Pearl1594 May 31, 2022
a43c40a
pass mtu for vpc tier network
Pearl1594 Jun 1, 2022
633a84d
add support to update interface mtu
Pearl1594 Jun 9, 2022
d096549
update upgrade path
Pearl1594 Jun 9, 2022
50adfb8
code cleanup based on sonarcloud report
Pearl1594 Jun 9, 2022
d82962e
add ui support
Pearl1594 Jun 9, 2022
e445837
refactor and add ui changes
Pearl1594 Jun 10, 2022
900726e
move things around to update vpc public iface mtu via vpc commands
Pearl1594 Jun 13, 2022
bcb8fa0
update logic to updating mtu and finding interface name
Pearl1594 Jun 15, 2022
951a708
filter response on UI
Pearl1594 Jun 15, 2022
3e22cb6
add unit tests for APIs and svc
Pearl1594 Jun 15, 2022
e191727
added tests
Pearl1594 Jun 16, 2022
190a249
fix test
shwstppr Jun 16, 2022
673697c
fix test
Pearl1594 Jun 16, 2022
a6aae77
update tests and minor refactors
Pearl1594 Jun 17, 2022
48d852b
add integration tests + simplify logic + update response details
Pearl1594 Jun 17, 2022
6712eda
Merge branch 'main' of https://github.com/apache/cloudstack into conf…
Pearl1594 Jun 17, 2022
e3d4a56
prevent sending network update command if the mtu passed to vpc net i…
Pearl1594 Jun 20, 2022
c3eb79e
address reported code smells - sonarcloud
Pearl1594 Jun 20, 2022
08065a2
add ping test to integration tests
Pearl1594 Jun 21, 2022
953e32f
skip running added marvin tests for simulator hyp
Pearl1594 Jun 21, 2022
0de46d8
fix test failure on simulator
Pearl1594 Jun 22, 2022
7568467
change mtu config cmd, to fix marvin tests
Pearl1594 Jun 22, 2022
dcb8622
hit mtu fields for l2 update network
Pearl1594 Jun 23, 2022
21a51dd
Merge branch 'main' of https://github.com/apache/cloudstack into conf…
Pearl1594 Jun 24, 2022
3b4cbc5
address comments
Pearl1594 Jun 24, 2022
ee68dc9
move test to component test
Pearl1594 Jun 24, 2022
ced5b39
Merge branch 'main' of https://github.com/apache/cloudstack into conf…
Pearl1594 Jun 27, 2022
29c4506
Merge branch 'main' of https://github.com/apache/cloudstack into conf…
Pearl1594 Jun 28, 2022
e7f29b5
add getter to address code-smell?
Pearl1594 Jun 28, 2022
3e59daf
address comments
Pearl1594 Jul 5, 2022
04a1a95
update UI to alert value exceeding defined threshold before resetting
Pearl1594 Jul 6, 2022
a2666d3
set minimum of 68 for mtu and configure limits on UI too
Pearl1594 Jul 8, 2022
e4b30df
Merge branch 'main' of https://github.com/apache/cloudstack into conf…
Pearl1594 Aug 1, 2022
c966cbd
Merge branch 'main' of https://github.com/apache/cloudstack into conf…
Pearl1594 Aug 17, 2022
b692902
update api param description
Pearl1594 Aug 17, 2022
764baef
Add support to configure client mtu via dhcp and guard changing mtu v…
Pearl1594 Sep 1, 2022
8f9d4bf
Merge branch 'main' of https://github.com/apache/cloudstack into conf…
Pearl1594 Sep 20, 2022
8aef20e
register config key
Pearl1594 Sep 22, 2022
cdf76fa
Merge branch 'main' of https://github.com/apache/cloudstack into conf…
Pearl1594 Sep 26, 2022
0907f23
update ui to show mtu fields based on newly added global setting
Pearl1594 Sep 26, 2022
e39733a
test failure due to logging
Pearl1594 Sep 29, 2022
1a46427
Merge branch 'main' of https://github.com/apache/cloudstack into conf…
Pearl1594 Sep 29, 2022
25a6ba1
Merge branch 'main' into configurable-mtu
shwstppr Oct 26, 2022
6a67204
config name change
shwstppr Oct 26, 2022
dbac891
Merge branch 'main' into configurable-mtu
shwstppr Dec 6, 2022
99d4d6c
changes
shwstppr Dec 6, 2022
0b42151
fix test
shwstppr Dec 7, 2022
bd3ea4d
fix mtu options not showing
shwstppr Dec 15, 2022
96bfe39
rename allow mtu config
shwstppr Dec 15, 2022
74554b8
ui: show warning on zone setting change
shwstppr Dec 15, 2022
0cd12a2
Merge branch 'main' into configurable-mtu
shwstppr Dec 15, 2022
9eda8f7
ui: use translations
shwstppr Dec 15, 2022
ac42952
remove unnecessary changes
shwstppr Dec 15, 2022
0abd1a6
revert unnecessary change
shwstppr Dec 15, 2022
5ccea40
fix ui mtu config order
shwstppr Dec 16, 2022
d0cccab
fix condition
shwstppr Dec 16, 2022
feaae4d
ui: fix warning text
shwstppr Dec 20, 2022
d2379fd
change text
shwstppr Dec 20, 2022
f315bcd
Merge branch 'main' into configurable-mtu
shwstppr Dec 28, 2022
8884051
ui; fix label
shwstppr Dec 30, 2022
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
18 changes: 17 additions & 1 deletion api/src/main/java/com/cloud/agent/api/to/IpAddressTO.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,12 @@ public class IpAddressTO {
private boolean newNic;
private boolean isPrivateGateway;
private NicTO nicTO;

private Integer mtu;
Map<String, String> details;

public IpAddressTO(long accountId, String ipAddress, boolean add, boolean firstIP, boolean sourceNat, String broadcastUri, String vlanGateway, String vlanNetmask,
String vifMacAddress, Integer networkRate, boolean isOneToOneNat) {
String vifMacAddress, Integer networkRate, boolean isOneToOneNat) {
this.accountId = accountId;
this.publicIp = ipAddress;
this.add = add;
Expand All @@ -56,6 +58,12 @@ public IpAddressTO(long accountId, String ipAddress, boolean add, boolean firstI
this.oneToOneNat = isOneToOneNat;
}

public IpAddressTO(String ipAddress, Integer mtu, String vlanNetmask ) {
this.publicIp = ipAddress;
this.mtu = mtu;
this.vlanNetmask = vlanNetmask;
}

protected IpAddressTO() {
}

Expand Down Expand Up @@ -155,6 +163,14 @@ public void setNicTO(NicTO nicTO) {
this.nicTO = nicTO;
}

public Integer getMtu() {
return mtu;
}

public void setMtu(Integer mtu) {
this.mtu = mtu;
}


public Map<String, String> getDetails() {
return details;
Expand Down
9 changes: 9 additions & 0 deletions api/src/main/java/com/cloud/agent/api/to/NicTO.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public class NicTO extends NetworkTO {
List<String> nicSecIps;
Map<NetworkOffering.Detail, String> details;
boolean dpdkEnabled;
Integer mtu;

public NicTO() {
super();
Expand Down Expand Up @@ -118,4 +119,12 @@ public boolean isDpdkEnabled() {
public void setDpdkEnabled(boolean dpdkEnabled) {
this.dpdkEnabled = dpdkEnabled;
}

public Integer getMtu() {
return mtu;
}

public void setMtu(Integer mtu) {
this.mtu = mtu;
}
}
4 changes: 4 additions & 0 deletions api/src/main/java/com/cloud/network/Network.java
Original file line number Diff line number Diff line change
Expand Up @@ -493,4 +493,8 @@ public void setIp6Address(String ip6Address) {
String getIp6Dns2();

Date getCreated();

Integer getPublicMtu();

Integer getPrivateMtu();
}
12 changes: 12 additions & 0 deletions api/src/main/java/com/cloud/network/NetworkProfile.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@
import com.cloud.network.Networks.BroadcastDomainType;
import com.cloud.network.Networks.Mode;
import com.cloud.network.Networks.TrafficType;
import org.apache.log4j.Logger;

public class NetworkProfile implements Network {
static final Logger s_logger = Logger.getLogger(NetworkProfile.class);
private final long id;
private final String uuid;
private final long dataCenterId;
Expand Down Expand Up @@ -357,4 +359,14 @@ public Date getCreated() {
return null;
}

@Override
public Integer getPublicMtu() {
return null;
}

@Override
public Integer getPrivateMtu() {
return null;
}

}
16 changes: 16 additions & 0 deletions api/src/main/java/com/cloud/network/NetworkService.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import org.apache.cloudstack.api.command.user.network.UpdateNetworkCmd;
import org.apache.cloudstack.api.command.user.vm.ListNicsCmd;
import org.apache.cloudstack.api.response.AcquirePodIpCmdResponse;
import org.apache.cloudstack.framework.config.ConfigKey;

import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
Expand All @@ -59,6 +60,21 @@
*/
public interface NetworkService {

public static final Integer DEFAULT_MTU = 1500;
public static final Integer MINIMUM_MTU = 68;

public static final ConfigKey<Integer> VRPublicInterfaceMtu = new ConfigKey<>("VirtualRouter", Integer.class,
"vr.public.interface.max.mtu", "1500", "The maximum value the MTU can have on the VR's public interfaces",
true, ConfigKey.Scope.Zone);

public static final ConfigKey<Integer> VRPrivateInterfaceMtu = new ConfigKey<>("VirtualRouter", Integer.class,
"vr.private.interface.max.mtu", "1500", "The maximum value the MTU can have on the VR's private interfaces",
true, ConfigKey.Scope.Zone);

public static final ConfigKey<Boolean> AllowUsersToSpecifyVRMtu = new ConfigKey<>("Advanced", Boolean.class,
"allow.end.users.to.specify.vr.mtu", "false", "Allow end users to specify VR MTU",
true, ConfigKey.Scope.Zone);

List<? extends Network> getIsolatedNetworksOwnedByAccountInZone(long zoneId, Account owner);

IpAddress allocateIP(Account ipOwner, long zoneId, Long networkId, Boolean displayIp, String ipaddress) throws ResourceAllocationException, InsufficientAddressCapacityException,
Expand Down
2 changes: 2 additions & 0 deletions api/src/main/java/com/cloud/network/vpc/Vpc.java
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ public enum State {

Date getCreated();

Integer getPublicMtu();

String getIp4Dns1();

String getIp4Dns2();
Expand Down
9 changes: 5 additions & 4 deletions api/src/main/java/com/cloud/network/vpc/VpcService.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public interface VpcService {
* @throws ResourceAllocationException TODO
*/
public Vpc createVpc(long zoneId, long vpcOffId, long vpcOwnerId, String vpcName, String displayText, String cidr, String networkDomain,
String dns1, String dns2, String ip6Dns1, String ip6Dns2, Boolean displayVpc)
String dns1, String dns2, String ip6Dns1, String ip6Dns2, Boolean displayVpc, Integer publicMtu)
throws ResourceAllocationException;

/**
Expand All @@ -73,11 +73,12 @@ public Vpc createVpc(long zoneId, long vpcOffId, long vpcOwnerId, String vpcName
* @param vpcId
* @param vpcName
* @param displayText
* @param customId TODO
* @param displayVpc TODO
* @param customId TODO
* @param displayVpc TODO
* @param mtu
* @return
*/
public Vpc updateVpc(long vpcId, String vpcName, String displayText, String customId, Boolean displayVpc);
public Vpc updateVpc(long vpcId, String vpcName, String displayText, String customId, Boolean displayVpc, Integer mtu);

/**
* Lists VPC(s) based on the parameters passed to the method call
Expand Down
2 changes: 2 additions & 0 deletions api/src/main/java/com/cloud/vm/Nic.java
Original file line number Diff line number Diff line change
Expand Up @@ -160,4 +160,6 @@ public enum ReservationStrategy {
String getIPv6Cidr();

String getIPv6Address();

Integer getMtu();
}
11 changes: 11 additions & 0 deletions api/src/main/java/com/cloud/vm/NicProfile.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ public class NicProfile implements InternalIdentity, Serializable {
String iPv6Dns1;
String iPv6Dns2;
String requestedIPv6;
Integer mtu;

//
// CONSTRUCTORS
Expand Down Expand Up @@ -396,6 +397,15 @@ public void setOrderIndex(Integer orderIndex) {
this.orderIndex = orderIndex;
}

public Integer getMtu() {
return mtu;
}

public void setMtu(Integer mtu) {
this.mtu = mtu;
}


//
// OTHER METHODS
//
Expand Down Expand Up @@ -426,6 +436,7 @@ public void deallocate() {
isolationUri = null;

orderIndex = null;
mtu = null;

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ private AlertType(short type, String name, boolean isDefault) {
public static final AlertType ALERT_TYPE_HA_ACTION = new AlertType((short)30, "ALERT.HA.ACTION", true);
public static final AlertType ALERT_TYPE_CA_CERT = new AlertType((short)31, "ALERT.CA.CERT", true);
public static final AlertType ALERT_TYPE_VM_SNAPSHOT = new AlertType((short)32, "ALERT.VM.SNAPSHOT", true);
public static final AlertType ALERT_TYPE_VR_PUBLIC_IFACE_MTU = new AlertType((short)32, "ALERT.VR.PUBLIC.IFACE.MTU", true);
public static final AlertType ALERT_TYPE_VR_PRIVATE_IFACE_MTU = new AlertType((short)32, "ALERT.VR.PRIVATE.IFACE.MTU", true);

public short getType() {
return type;
Expand Down
7 changes: 7 additions & 0 deletions api/src/main/java/org/apache/cloudstack/api/ApiConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -618,6 +618,7 @@ public class ApiConstants {
public static final String RESTART_REQUIRED = "restartrequired";
public static final String ALLOW_USER_CREATE_PROJECTS = "allowusercreateprojects";
public static final String ALLOW_USER_DRIVEN_BACKUPS = "allowuserdrivenbackups";
public static final String ALLOW_USER_SPECIFY_VR_MTU = "allowuserspecifyvrmtu";
public static final String CONSERVE_MODE = "conservemode";
public static final String TRAFFIC_TYPE_IMPLEMENTOR = "traffictypeimplementor";
public static final String KEYWORD = "keyword";
Expand Down Expand Up @@ -882,6 +883,8 @@ public class ApiConstants {
public static final String ROUTER_CHECK_TYPE = "checktype";
public static final String ROUTER_IP = "routerip";
public static final String ROUTER_IPV6 = "routeripv6";
public static final String ROUTER_PRIVATE_INTERFACE_MAX_MTU = "routerprivateinterfacemaxmtu";
public static final String ROUTER_PUBLIC_INTERFACE_MAX_MTU = "routerpublicinterfacemaxmtu";
public static final String LAST_UPDATED = "lastupdated";
public static final String PERFORM_FRESH_CHECKS = "performfreshchecks";
public static final String CACHE_MODE = "cachemode";
Expand Down Expand Up @@ -920,13 +923,17 @@ public class ApiConstants {
public static final String DYNAMIC_SCALING_ENABLED = "dynamicscalingenabled";

public static final String POOL_TYPE = "pooltype";
public static final String REDUNDANT_STATE = "redundantstate";

public static final String ADMINS_ONLY = "adminsonly";
public static final String ANNOTATION_FILTER = "annotationfilter";
public static final String LOGIN = "login";
public static final String LOGOUT = "logout";
public static final String LIST_IDPS = "listIdps";

public static final String PUBLIC_MTU = "publicmtu";
public static final String PRIVATE_MTU = "privatemtu";
public static final String MTU = "mtu";
public enum BootType {
UEFI, BIOS;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
// under the License.
package org.apache.cloudstack.api.command.user.network;

import com.cloud.network.NetworkService;
import org.apache.log4j.Logger;

import org.apache.cloudstack.acl.RoleType;
Expand Down Expand Up @@ -157,6 +158,14 @@ public class CreateNetworkCmd extends BaseCmd implements UserCmd {
description = "The network this network is associated to. only available if create a Shared network")
private Long associatedNetworkId;

@Parameter(name = ApiConstants.PUBLIC_MTU, type = CommandType.INTEGER,
description = "MTU to be configured on the network VR's public facing interfaces", since = "4.18.0")
private Integer publicMtu;

@Parameter(name = ApiConstants.PRIVATE_MTU, type = CommandType.INTEGER,
description = "MTU to be configured on the network VR's private interface(s)", since = "4.18.0")
private Integer privateMtu;

@Parameter(name = ApiConstants.DNS1, type = CommandType.STRING, description = "the first IPv4 DNS for the network", since = "4.18.0")
private String ip4Dns1;

Expand Down Expand Up @@ -338,6 +347,13 @@ public Long getAclId() {
return aclId;
}

public Integer getPublicMtu() {
return publicMtu != null ? publicMtu : NetworkService.DEFAULT_MTU;
}

public Integer getPrivateMtu() {
return privateMtu != null ? privateMtu : NetworkService.DEFAULT_MTU;
}
public String getIp4Dns1() {
return ip4Dns1;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,20 @@ public class UpdateNetworkCmd extends BaseAsyncCustomIdCmd implements UserCmd {

@Parameter(name = ApiConstants.DISPLAY_NETWORK,
type = CommandType.BOOLEAN,
description = "an optional field, whether to the display the network to the end user or not.", authorized = {RoleType.Admin})
description = "an optional field, whether to the display the network to the end user or not.", authorized = {RoleType.Admin})
private Boolean displayNetwork;

@Parameter(name= ApiConstants.FORCED, type = CommandType.BOOLEAN, description = "Setting this to true will cause a forced network update,", authorized = {RoleType.Admin})
private Boolean forced;

@Parameter(name = ApiConstants.PUBLIC_MTU, type = CommandType.INTEGER,
description = "MTU to be configured on the network VR's public facing interfaces", since = "4.18.0")
private Integer publicMtu;

@Parameter(name = ApiConstants.PRIVATE_MTU, type = CommandType.INTEGER,
description = "MTU to be configured on the network VR's public facing interfaces", since = "4.18.0")
private Integer privateMtu;

@Parameter(name = ApiConstants.DNS1, type = CommandType.STRING, description = "the first IPv4 DNS for the network. Empty string will update the first IPv4 DNS with the value from the zone", since = "4.18.0")
private String ip4Dns1;

Expand Down Expand Up @@ -149,6 +157,14 @@ public boolean getForced(){
return forced;
}

public Integer getPublicMtu() {
return publicMtu;
}

public Integer getPrivateMtu() {
return privateMtu;
}

public String getIp4Dns1() {
return ip4Dns1;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
// under the License.
package org.apache.cloudstack.api.command.user.vpc;

import com.cloud.network.NetworkService;
import org.apache.log4j.Logger;

import org.apache.cloudstack.acl.RoleType;
Expand Down Expand Up @@ -95,6 +96,10 @@ public class CreateVPCCmd extends BaseAsyncCreateCmd implements UserCmd {
@Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the vpc to the end user or not", since = "4.4", authorized = {RoleType.Admin})
private Boolean display;

@Parameter(name = ApiConstants.PUBLIC_MTU, type = CommandType.INTEGER,
description = "MTU to be configured on the network VR's public facing interfaces", since = "4.18.0")
private Integer publicMtu;

@Parameter(name = ApiConstants.DNS1, type = CommandType.STRING, description = "the first IPv4 DNS for the VPC", since = "4.18.0")
private String ip4Dns1;

Expand Down Expand Up @@ -143,6 +148,10 @@ public String getNetworkDomain() {
return networkDomain;
}

public Integer getPublicMtu() {
return publicMtu != null ? publicMtu : NetworkService.DEFAULT_MTU;
}

public String getIp4Dns1() {
return ip4Dns1;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ public class UpdateVPCCmd extends BaseAsyncCustomIdCmd implements UserCmd {
@Parameter(name = ApiConstants.FOR_DISPLAY, type = CommandType.BOOLEAN, description = "an optional field, whether to the display the vpc to the end user or not", since = "4.4", authorized = {RoleType.Admin})
private Boolean display;

@Parameter(name = ApiConstants.PUBLIC_MTU, type = CommandType.INTEGER,
description = "MTU to be configured on the network VR's public facing interfaces", since = "4.18.0")
private Integer publicMtu;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we use this instead of network tier's value in case of VPCs? Are there checks not allow user to input publicmtu in case of network teirs?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we have check in place to not consider public MTU when passed as part of network tiers and consider the one that's been set on the VPC network.


/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
Expand All @@ -79,6 +83,10 @@ public Boolean isDisplayVpc() {
return display;
}

public Integer getPublicMtu() {
return publicMtu;
}

/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
Expand All @@ -99,7 +107,7 @@ public long getEntityOwnerId() {

@Override
public void execute() {
Vpc result = _vpcService.updateVpc(getId(), getVpcName(), getDisplayText(), getCustomId(), isDisplayVpc());
Vpc result = _vpcService.updateVpc(getId(), getVpcName(), getDisplayText(), getCustomId(), isDisplayVpc(), getPublicMtu());
if (result != null) {
VpcResponse response = _responseGenerator.createVpcResponse(getResponseView(), result);
response.setResponseName(getCommandName());
Expand Down
Loading