ui: datastore: add tuning settings to datastore options

Add a simple edit window with 2 combo boxes for `sync-level` and
`chunk-order`.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
 [ T: rework commit message/subject a bit ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Dominik Csapak 2022-11-28 11:13:06 +01:00 committed by Thomas Lamprecht
parent b4a81964d0
commit 2c323b65c6
4 changed files with 96 additions and 0 deletions

View File

@ -313,6 +313,8 @@ There are a few per-datastore options:
* :ref:`Maintenance Mode <maintenance_mode>` * :ref:`Maintenance Mode <maintenance_mode>`
* Verification of incoming backups * Verification of incoming backups
.. _datastore_tuning_options:
Tuning Tuning
^^^^^^ ^^^^^^
There are some tuning related options for the datastore that are more advanced There are some tuning related options for the datastore that are more advanced

View File

@ -143,6 +143,10 @@ const proxmoxOnlineHelpInfo = {
"link": "/docs/storage.html#storage-namespaces", "link": "/docs/storage.html#storage-namespaces",
"title": "Backup Namespaces" "title": "Backup Namespaces"
}, },
"datastore-tuning-options": {
"link": "/docs/storage.html#datastore-tuning-options",
"title": "Tuning"
},
"sysadmin-host-administration": { "sysadmin-host-administration": {
"link": "/docs/sysadmin.html#sysadmin-host-administration", "link": "/docs/sysadmin.html#sysadmin-host-administration",
"title": "Host System Administration" "title": "Host System Administration"

View File

@ -709,4 +709,37 @@ Ext.define('PBS.Utils', {
return Ext.String.htmlEncode(value); 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(', ');
},
}); });

View File

@ -157,5 +157,62 @@ Ext.define('PBS.Datastore.Options', {
xtype: 'pbsMaintenanceOptionEdit', 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__',
},
],
},
},
},
}, },
}); });