[pve-devel] [PATCH pve-manager] qemu: add mtu advanced option.
Alexandre Derumier
aderumier at odiso.com
Fri Aug 31 13:29:59 CEST 2018
Allow to setup mtu in guest.
Improve me: disable mtu option if model != virtio
---
www/manager6/Parser.js | 5 +++++
www/manager6/qemu/NetworkEdit.js | 21 +++++++++++++++++++--
2 files changed, 24 insertions(+), 2 deletions(-)
diff --git a/www/manager6/Parser.js b/www/manager6/Parser.js
index b5fb5a4e..ad4db003 100644
--- a/www/manager6/Parser.js
+++ b/www/manager6/Parser.js
@@ -119,6 +119,8 @@ Ext.define('PVE.Parser', { statics: {
res.disconnect = match_res[1];
} else if ((match_res = p.match(/^queues=(\d+)$/)) !== null) {
res.queues = match_res[1];
+ } else if ((match_res = p.match(/^mtu=(\d+)$/)) !== null) {
+ res.mtu = match_res[1];
} else if ((match_res = p.match(/^trunks=(\d+(?:-\d+)?(?:;\d+(?:-\d+)?)*)$/)) !== null) {
res.trunks = match_res[1];
} else {
@@ -155,6 +157,9 @@ Ext.define('PVE.Parser', { statics: {
if (net.queues) {
netstr += ",queues=" + net.queues;
}
+ if (net.mtu) {
+ netstr += ",mtu=" + net.mtu;
+ }
if (net.disconnect) {
netstr += ",link_down=" + net.disconnect;
}
diff --git a/www/manager6/qemu/NetworkEdit.js b/www/manager6/qemu/NetworkEdit.js
index dd950d2b..eded454d 100644
--- a/www/manager6/qemu/NetworkEdit.js
+++ b/www/manager6/qemu/NetworkEdit.js
@@ -26,6 +26,12 @@ Ext.define('PVE.qemu.NetworkInputPanel', {
delete me.network.rate;
}
+ if (values.mtu) {
+ me.network.mtu = values.mtu;
+ } else {
+ delete me.network.mtu;
+ }
+
var params = {};
params[me.confid] = PVE.Parser.printQemuNetwork(me.network);
@@ -91,7 +97,17 @@ Ext.define('PVE.qemu.NetworkInputPanel', {
xtype: 'proxmoxcheckbox',
fieldLabel: gettext('Disconnect'),
name: 'disconnect'
- }
+ },
+ {
+ xtype: 'numberfield',
+ fieldLabel: gettext('MTU'),
+ minValue: 576,
+ maxValue: 65535,
+ value: '',
+ emptyText: '1500',
+ name: 'mtu',
+ allowBlank: true
+ }
];
if (me.insideWizard) {
@@ -110,7 +126,8 @@ Ext.define('PVE.qemu.NetworkInputPanel', {
'model',
'macaddr',
'rate',
- 'queues'
+ 'queues',
+ 'mtu',
];
fields.forEach(function(fieldname) {
me.down('field[name='+fieldname+']').setDisabled(value);
--
2.11.0
More information about the pve-devel
mailing list