[pve-devel] [PATCH] add property 'nfsversion' to storage

Frank Brendel frank.brendel at eurolog.com
Thu May 3 09:35:28 CEST 2012


Signed-off-by: Frank Brendel <frank.brendel at eurolog.com>
---
 www/manager/dc/StorageView.js  |    7 ++++---
 www/manager/storage/NFSEdit.js |   35 +++++++++++++++++++++++++++++++----
 2 files changed, 35 insertions(+), 7 deletions(-)

diff --git a/www/manager/dc/StorageView.js b/www/manager/dc/StorageView.js
index 865c7a5..e5a8d9e 100644
--- a/www/manager/dc/StorageView.js
+++ b/www/manager/dc/StorageView.js
@@ -44,7 +44,8 @@ Ext.define('PVE.dc.StorageView', {
 		return;
 	    }
 	    var win = Ext.create(editor, {
-		storageId: rec.data.storage
+		storageId: rec.data.storage,
+		nfsversion: rec.data.nfsversion
 	    });
 
 	    win.show();
@@ -196,11 +197,11 @@ Ext.define('PVE.dc.StorageView', {
     Ext.define('pve-storage', {
 	extend: 'Ext.data.Model',
 	fields: [ 
-	    'path', 'type', 'content', 'server', 'portal', 'target', 'export', 'storage',
+	    'path', 'type', 'content', 'server', 'portal', 'target', 'export', 'storage', 'nfsversion',
 	    { name: 'shared', type: 'boolean'},
 	    { name: 'disable', type: 'boolean'} 
 	],
 	idProperty: 'storage'
     });
 
-});
\ No newline at end of file
+});
diff --git a/www/manager/storage/NFSEdit.js b/www/manager/storage/NFSEdit.js
index 520d490..db7f76b 100644
--- a/www/manager/storage/NFSEdit.js
+++ b/www/manager/storage/NFSEdit.js
@@ -1,3 +1,21 @@
+Ext.define('PVE.form.NFSVersionSelector', {
+    extend: 'PVE.form.KVComboBox',
+    alias: ['widget.pveNFSVersionSelector'],
+
+    deleteEmpty: false,
+
+    initComponent: function() {
+        var me = this;
+
+        me.data = [
+            [undefined, gettext('Use system default')],
+            [3, gettext('NFS3')],
+            [4, gettext('NFS4')]
+        ];
+
+        me.callParent();
+    }
+});
 Ext.define('PVE.storage.NFSScan', {
     extend: 'Ext.form.field.ComboBox',
     alias: 'widget.pveNFSScan',
@@ -63,9 +81,6 @@ Ext.define('PVE.storage.NFSInputPanel', {
 
 	if (me.create) {
 	    values.type = 'nfs';
-	    // hack: for now we always create nvf v3
-	    // fixme: make this configurable
-	    values.options = 'vers=3';
 	} else {
 	    delete values.storage;
 	}
@@ -153,6 +168,17 @@ Ext.define('PVE.storage.NFSInputPanel', {
 	    }
 	];
 
+        if (me.create || me.nfsversion) {
+            me.column2.push({
+                xtype: me.create ? 'pveNFSVersionSelector' : 'displayfield',
+                name: 'nfsversion',
+                value: me.nfsversion ? me.nfsversion : undefined,
+                emptyText: gettext('Use system default'),
+                fieldLabel: gettext('NFS Version'),
+                multiSelect: false
+            });
+        }
+
 	me.callParent();
     }
 });
@@ -175,7 +201,8 @@ Ext.define('PVE.storage.NFSEdit', {
 
 	var ipanel = Ext.create('PVE.storage.NFSInputPanel', {
 	    create: me.create,
-	    storageId: me.storageId
+	    storageId: me.storageId,
+	    nfsversion: me.nfsversion
 	});
 	
 	Ext.apply(me, {
-- 
1.7.0.4




More information about the pve-devel mailing list