[pbs-devel] [PATCH proxmox-backup] ui: datastore: add tuning options to gui

Dominik Csapak d.csapak at proxmox.com
Mon Nov 28 11:13:06 CET 2022


in datastore -> options
a simple edit window with 2 comboboxes for
* sync-level
* chunk-order

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 docs/storage.rst            |  2 ++
 www/OnlineHelpInfo.js       |  4 +++
 www/Utils.js                | 33 +++++++++++++++++++++
 www/datastore/OptionView.js | 57 +++++++++++++++++++++++++++++++++++++
 4 files changed, 96 insertions(+)

diff --git a/docs/storage.rst b/docs/storage.rst
index d61c3a40..07c3ad8e 100644
--- a/docs/storage.rst
+++ b/docs/storage.rst
@@ -316,6 +316,8 @@ There are a few per-datastore options:
 * :ref:`Maintenance Mode <maintenance_mode>`
 * Verification of incoming backups
 
+.. _datastore_tuning_options:
+
 Tuning
 ^^^^^^
 There are some tuning related options for the datastore that are more advanced
diff --git a/www/OnlineHelpInfo.js b/www/OnlineHelpInfo.js
index cc00b658..5561f275 100644
--- a/www/OnlineHelpInfo.js
+++ b/www/OnlineHelpInfo.js
@@ -143,6 +143,10 @@ const proxmoxOnlineHelpInfo = {
     "link": "/docs/storage.html#storage-namespaces",
     "title": "Backup Namespaces"
   },
+  "datastore-tuning-options": {
+    "link": "/docs/storage.html#datastore-tuning-options",
+    "title": "Tuning"
+  },
   "sysadmin-host-administration": {
     "link": "/docs/sysadmin.html#sysadmin-host-administration",
     "title": "Host System Administration"
diff --git a/www/Utils.js b/www/Utils.js
index f6d353ef..298ad084 100644
--- a/www/Utils.js
+++ b/www/Utils.js
@@ -709,4 +709,37 @@ Ext.define('PBS.Utils', {
 	return Ext.String.htmlEncode(value);
     },
 
+    tuningOptions: {
+	'chunk-order': {
+	    '__default__': Proxmox.Utils.defaultText + ` (${gettext('None')})`,
+	    none: gettext('None'),
+	    inode: gettext('Inode'),
+	},
+	'sync-level': {
+	    '__default__': Proxmox.Utils.defaultText + ` (${gettext('Filesystem')})`,
+	    none: gettext('None'),
+	    file: gettext('File'),
+	    filesystem: gettext('Filesystem'),
+	},
+    },
+
+    render_tuning_options: function(tuning) {
+	let options = [];
+	let order = tuning['chunk-order'];
+	delete tuning['chunk-order'];
+	order = PBS.Utils.tuningOptions['chunk-order'][order ?? '__default__'];
+	options.push(`${gettext('Chunk Order')}: ${order}`);
+
+	let sync = tuning['sync-level'];
+	delete tuning['sync-level'];
+	sync = PBS.Utils.tuningOptions['sync-level'][sync ?? '__default__'];
+	options.push(`${gettext('Sync Level')}: ${sync}`);
+
+	for (const [k, v] of Object.entries(tuning)) {
+	    options.push(`${k}: ${v}`);
+	}
+
+	return options.join(', ');
+    },
+
 });
diff --git a/www/datastore/OptionView.js b/www/datastore/OptionView.js
index eb335979..e9c8ea36 100644
--- a/www/datastore/OptionView.js
+++ b/www/datastore/OptionView.js
@@ -157,5 +157,62 @@ Ext.define('PBS.Datastore.Options', {
 		xtype: 'pbsMaintenanceOptionEdit',
 	    },
 	},
+	'tuning': {
+	    required: true,
+	    header: gettext('Tuning Options'),
+	    renderer: function(value) {
+		let tuning = PBS.Utils.parsePropertyString(value);
+		return PBS.Utils.render_tuning_options(tuning);
+	    },
+	    editor: {
+		xtype: 'proxmoxWindowEdit',
+		title: gettext('Tuning Options'),
+		onlineHelp: 'datastore_tuning_options',
+		width: 350,
+		items: {
+		    xtype: 'inputpanel',
+		    onGetValues: function(values) {
+			if (!Ext.isArray(values.delete ?? [])) {
+			    values.delete = [values.delete];
+			}
+			for (const k of values.delete ?? []) {
+			    delete values[k];
+			}
+			delete values.delete;
+			let tuning = PBS.Utils.printPropertyString(values);
+			if (!tuning) {
+			    return {
+				'delete': 'tuning',
+			    };
+			}
+			return {
+			    tuning,
+			};
+		    },
+		    setValues: function(values) {
+			values = PBS.Utils.parsePropertyString(values?.tuning);
+			return Proxmox.panel.InputPanel.prototype.setValues.call(this, values);
+		    },
+		    items: [
+			{
+			    xtype: 'proxmoxKVComboBox',
+			    name: 'chunk-order',
+			    fieldLabel: gettext('Chunk Order'),
+			    comboItems: Object.entries(PBS.Utils.tuningOptions['chunk-order']),
+			    deleteEmpty: true,
+			    value: '__default__',
+			},
+			{
+			    xtype: 'proxmoxKVComboBox',
+			    name: 'sync-level',
+			    fieldLabel: gettext('Sync Level'),
+			    comboItems: Object.entries(PBS.Utils.tuningOptions['sync-level']),
+			    deleteEmpty: true,
+			    value: '__default__',
+			},
+		    ],
+		},
+	    },
+	},
     },
 });
-- 
2.30.2






More information about the pbs-devel mailing list