[pve-devel] [PATCH manager v2 1/2] fix #3719: gui: expose LXC MTU option in web UI

Stefan Hanreich s.hanreich at proxmox.com
Fri Nov 11 12:14:29 CET 2022


Tested on an Alpine Linux Container (3.16):

- setting MTU > 65535 or < 576 via UI (doesn't work)
- setting MTU to several values >= 576 and <= 65535 via UI (works)
- setting MTU to >= 64 and < 576 via config then starting (works, but 
this is apparently intended otherwise it would be a backwards breaking 
change)
- setting MTU >= 576 and <= 65535 via Config and then starting the 
container (works)
- setting MTU > 65535 or < 64 via Config and then starting the container 
(doesn't work)

Some Notes:
- Setting the MTU while the container is running, does not update the 
MTU of the running container. If this is intended behavior it might be 
smart to document it somewhere or throw a warning. This also doesn't 
work for the VM patch. Not sure if this is even possible at runtime tbh.
- Adding a network device when the Container is running with a specific, 
valid MTU (e.g. 1234) does add the network device to the container, BUT 
it has a MTU of 1500. Upon reboot the correct MTU is set. Reloading the 
Network config does not change anything. Maybe just an LXC limitation?

Code LGTM - small nit: there is still a gettext('MTU') left in the 
NetworkView, but it has been changed in the NetworkInputPanel.

Reviewed-by: Stefan Hanreich <s.hanreich at proxmox.com>
Tested-by: Stefan Hanreich <s.hanreich at proxmox.com>

On 11/3/22 16:38, Daniel Tschlatscher wrote:
> The option to set the mtu parameter for lxc containers already exists
> in the backend. It just has to be exposed in the web UI as well.
>
> Signed-off-by: Daniel Tschlatscher <d.tschlatscher at proxmox.com>
> ---
> Changes from v1:
> * fieldLabel for MTU textfield no longer uses gettext()
> * text field has an emptyText now
> * the minimum value for the MTU is 576 in the frontend now
>
>   www/manager6/lxc/Network.js | 18 ++++++++++++++++++
>   1 file changed, 18 insertions(+)
>
> diff --git a/www/manager6/lxc/Network.js b/www/manager6/lxc/Network.js
> index 7b6437c5..c6c40934 100644
> --- a/www/manager6/lxc/Network.js
> +++ b/www/manager6/lxc/Network.js
> @@ -282,6 +282,18 @@ Ext.define('PVE.lxc.NetworkInputPanel', {
>   	    },
>   	];
>   
> +	me.advancedColumn1 = [
> +	    {
> +		xtype: 'proxmoxintegerfield',
> +		fieldLabel: 'MTU',
> +		emptyText: gettext('Same as bridge'),
> +		name: 'mtu',
> +		value: cdata.mtu,
> +		minValue: 576,
> +		maxValue: 65535,
> +	    },
> +	];
> +
>   	me.callParent();
>       },
>   });
> @@ -519,6 +531,11 @@ Ext.define('PVE.lxc.NetworkView', {
>   			}
>   		    },
>   		},
> +		{
> +		    header: gettext('MTU'),
> +		    width: 80,
> +		    dataIndex: 'mtu',
> +		},
>   	    ],
>   	    listeners: {
>   		activate: me.load,
> @@ -543,6 +560,7 @@ Ext.define('PVE.lxc.NetworkView', {
>   	    'gw6',
>   	    'tag',
>   	    'firewall',
> +	    'mtu',
>   	],
>       });
>   });





More information about the pve-devel mailing list