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

Oguz Bektas o.bektas at proxmox.com
Wed May 15 15:27:36 CEST 2019


hi,

should have been v3, forgot to add changelog as well..

v2 -> v3:
    * only send values["delete"] when editing an existing storage
i.e. if !me.isCreate
    * add deleteEmpty: false in column


On Wed, May 15, 2019 at 03:21:56PM +0200, Oguz Bektas wrote:
> 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.
> 
> Co-Authored-by: Dominik Csapak <d.csapak at proxmox.com>
> Signed-off-by: Oguz Bektas <o.bektas at proxmox.com>
> ---
> 
> this patch depends on the patches from dominik[0] and thomas[1] in
> pve-common and pve-storage and shouldn't be applied without them.
> 
> [0]: https://git.proxmox.com/?p=pve-common.git;a=commit;h=d0ba18e17e96e9a2db54d050c4bd86b6d2d2dd03
> [1]: https://git.proxmox.com/?p=pve-storage.git;a=commit;h=4273e3ace94a22c39d98385d9dfb72249eac09aa
> 
> 
>  www/manager6/storage/NFSEdit.js | 56 ++++++++++++++++++++++++++++++++++++++---
>  1 file changed, 52 insertions(+), 4 deletions(-)
> 
> diff --git a/www/manager6/storage/NFSEdit.js b/www/manager6/storage/NFSEdit.js
> index 9eaa8bc5..bc512e3b 100644
> --- a/www/manager6/storage/NFSEdit.js
> +++ b/www/manager6/storage/NFSEdit.js
> @@ -62,18 +62,49 @@ Ext.define('PVE.storage.NFSInputPanel', {
>  
>      onlineHelp: 'storage_nfs',
>  
> +    options : [],
> +
>      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;
> +	var res = [];
> +	for (i = 0; i < me.options.length; i++) {
> +	    var item = me.options[i];
> +	    if (!item.match(/^vers=(.*)$/)) {
> +		res.push(item);
> +	    }
> +	}
> +	if (values.nfsversion && values.nfsversion !== '__default__') {
> +	    res.push('vers=' + values.nfsversion);
> +	}
> +	delete values.nfsversion;
> +	values.options = res.join(',');
> +	if (values.options === '') {
> +	    delete values.options;
> +	    if (!me.isCreate) {
> +		values["delete"] = "options";
> +	    }
>  	}
>  
>  	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 +157,23 @@ Ext.define('PVE.storage.NFSInputPanel', {
>  	    }
>  	];
>  
> +	me.advancedColumn1 = [
> +	    {
> +		xtype: 'proxmoxKVComboBox',
> +		fieldLabel: gettext('NFS Version'),
> +		name: 'nfsversion',
> +		value: '__default__',
> +		deleteEmpty: false,
> +		comboItems: [
> +			['__default__', Proxmox.Utils.defaultText],
> +			['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