[pve-devel] [PATCH V3 manager 2/3] fix #3967: enable ZFS dRAID creation in WebGUI

Stefan Hrdlicka s.hrdlicka at proxmox.com
Mon Jun 13 16:55:58 CEST 2022


add fields for additional settings required by ZFS dRAID

Signed-off-by: Stefan Hrdlicka <s.hrdlicka at proxmox.com>
---
 www/manager6/node/ZFS.js | 69 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 69 insertions(+)

diff --git a/www/manager6/node/ZFS.js b/www/manager6/node/ZFS.js
index 5b3bdbda..75d7d8e1 100644
--- a/www/manager6/node/ZFS.js
+++ b/www/manager6/node/ZFS.js
@@ -9,6 +9,27 @@ Ext.define('PVE.node.CreateZFS', {
     isCreate: true,
     width: 800,
 
+    viewModel: {
+	data: {
+	    raidLevel: 'single',
+	},
+	formulas: {
+	    isdraid: function(get) {
+		return get('raidLevel').startsWith("draid");
+	    },
+	    draidconfig: function(get) {
+		if (get('isdraid')) {
+		    var config = {};
+		    config.data = get('draiddata');
+		    config.spares = get('draidspares');
+		    return PVE.Parser.printPropertyString(config);
+		} else {
+		    return "";
+		}
+	    },
+	},
+    },
+
     initComponent: function() {
 	let me = this;
 
@@ -49,7 +70,54 @@ Ext.define('PVE.node.CreateZFS', {
 				['raidz', 'RAIDZ'],
 				['raidz2', 'RAIDZ2'],
 				['raidz3', 'RAIDZ3'],
+				['draid', 'dRAID'],
+				['draid2', 'dRAID2'],
+				['draid3', 'dRAID3'],
 			    ],
+			    bind: {
+				value: '{raidLevel}',
+			    },
+			},
+			{
+			    xtype: 'proxmoxtextfield',
+			    name: 'draid-config',
+			    hidden: true,
+			    submitValue: true,
+			    bind: {
+				value: '{draidconfig}',
+			    },
+			},
+			{
+			    xtype: 'proxmoxintegerfield',
+			    fieldLabel: gettext('DRAID data devices'),
+			    minValue: 1,
+			    allowBlank: false,
+			    disabled: true,
+			    hidden: true,
+			    submitValue: false,
+			    bind: {
+				disabled: '{!isdraid}',
+				hidden: '{!isdraid}',
+				value: '{draiddata}',
+			    },
+			    reference: 'draiddata',
+			    name: 'draiddata',
+			},
+			{
+			    xtype: 'proxmoxintegerfield',
+			    fieldLabel: gettext('DRAID spares'),
+			    minValue: 0,
+			    allowBlank: false,
+			    disabled: true,
+			    hidden: true,
+			    submitValue: false,
+			    bind: {
+				disabled: '{!isdraid}',
+				hidden: '{!isdraid}',
+				value: '{draidspares}',
+			    },
+			    reference: 'draidspares',
+			    name: 'draidspares',
 			},
 			{
 			    xtype: 'proxmoxKVComboBox',
@@ -101,6 +169,7 @@ Ext.define('PVE.node.CreateZFS', {
 
         me.callParent();
     },
+
 });
 
 Ext.define('PVE.node.ZFSList', {
-- 
2.30.2





More information about the pve-devel mailing list