[pve-devel] [PATCH manager] fix #2185: add option to change nfs version on gui

Oguz Bektas o.bektas at proxmox.com
Fri May 10 14:49:00 CEST 2019


this enables us to specify an nfs version while editing/creating an nfs
mount. it used to default to vers=3 without the ability to change it in
gui. now it supports: 3, 4, 4.1 and 4.2

it should also be possible to add further options in the future (rsize,
wsize, timeo, etc.) on this screen.

Signed-off-by: Oguz Bektas <o.bektas at proxmox.com>
---
 www/manager6/storage/NFSEdit.js | 43 +++++++++++++++++++++++++++++++++++++----
 1 file changed, 39 insertions(+), 4 deletions(-)

diff --git a/www/manager6/storage/NFSEdit.js b/www/manager6/storage/NFSEdit.js
index 9eaa8bc5..663c3881 100644
--- a/www/manager6/storage/NFSEdit.js
+++ b/www/manager6/storage/NFSEdit.js
@@ -65,15 +65,35 @@ Ext.define('PVE.storage.NFSInputPanel', {
     onGetValues: function(values) {
 	var me = this;
 
-	if (me.isCreate) {
-	    // hack: for now we always create nvf v3
-	    // fixme: make this configurable
-	    values.options = 'vers=3';
+	var i;
+	for(i = 0; i < me.options.length; i++) {
+	    var match;
+	    var item = me.options[i];
+	    if (match = item.match(/^vers=(.*)$/)) {
+		me.options[i] = 'vers=' + values.nfsversion;
+		delete values.nfsversion;
+	    }
 	}
+	values.options = me.options.join(',');
 
 	return me.callParent([values]);
     },
 
+    setValues: function(values) {
+	var me = this;
+	if (values.options) {
+	    var res = values.options;
+	    me.options = values.options.split(',');
+	    me.options.forEach(function(item) {
+		var match;
+		if (match = item.match(/^vers=(.*)$/)) {
+		    values.nfsversion = match[1];
+		}
+	    });
+	}
+	return me.callParent([values]);
+    },
+
     initComponent : function() {
 	var me = this;
 
@@ -126,6 +146,21 @@ Ext.define('PVE.storage.NFSInputPanel', {
 	    }
 	];
 
+	me.advancedColumn1 = [
+	    {
+		xtype: 'proxmoxKVComboBox',
+		fieldLabel: gettext('NFS Version'),
+		name: 'nfsversion',
+		value: '3',
+		comboItems: [
+			['3', '3'],
+			['4', '4'],
+			['4.1', '4.1'],
+			['4.2', '4.2']
+		],
+	    }
+	];
+
 	me.callParent();
     }
 });
-- 
2.11.0





More information about the pve-devel mailing list