]> git.proxmox.com Git - pve-manager.git/commitdiff
ui: backup job: allow to set up fleecing for a job in advanced config
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 22 Apr 2024 10:44:02 +0000 (12:44 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 22 Apr 2024 17:49:33 +0000 (19:49 +0200)
Use the new advanced options tab to expose the fleecing enable and
storage selections per backup job.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
www/manager6/panel/BackupAdvancedOptions.js

index 1dc7096b9a94d93e8baa0bb801af2d80a8ca5f7d..c79c31cbe358df602070bc9dc3492c06d75bcd3e 100644 (file)
@@ -12,6 +12,10 @@ Ext.define('PVE.panel.BackupAdvancedOptions', {
        return {};
     },
 
+    viewModel: {
+       data: {},
+    },
+
     controller: {
        xclass: 'Ext.app.ViewController',
     },
@@ -31,6 +35,7 @@ Ext.define('PVE.panel.BackupAdvancedOptions', {
            ? () => { /* no-op on create */ }
            : key => options.delete.push(key);
 
+       let fleecing = {}, fleecingOptions = ['fleecing-enabled', 'fleecing-storage'];
        let performance = {}, performanceOptions = ['max-workers', 'pbs-entries-max'];
 
        for (const [key, value] of Object.entries(formValues)) {
@@ -47,6 +52,9 @@ Ext.define('PVE.panel.BackupAdvancedOptions', {
                } else if (!performanceOptions.includes(formValues.delete)) {
                    deletePropertyOnEdit(value);
                }
+           } else if (fleecingOptions.includes(key)) {
+               let fleecingKey = key.slice('fleecing-'.length);
+               fleecing[fleecingKey] = value;
            } else {
                options[key] = value;
            }
@@ -58,9 +66,29 @@ Ext.define('PVE.panel.BackupAdvancedOptions', {
            deletePropertyOnEdit('performance');
        }
 
+       if (Object.keys(fleecing).length > 0) {
+           options.fleecing = PVE.Parser.printPropertyString(fleecing);
+       } else {
+           deletePropertyOnEdit('fleecing');
+       }
+
+       if (me.isCreate) {
+           delete options.delete;
+       }
+
        return options;
     },
 
+    onSetValues: function(values) {
+       if (values.fleecing) {
+           for (const [key, value] of Object.entries(values.fleecing)) {
+               values[`fleecing-${key}`] = value;
+           }
+           delete values.fleecing;
+       }
+       return values;
+    },
+
     updateCompression: function(value, disabled) {
        this.lookup('zstdThreadCount').setDisabled(disabled || value !== 'zstd');
     },
@@ -131,6 +159,42 @@ Ext.define('PVE.panel.BackupAdvancedOptions', {
                value: `${gettext('I/O workers in the QEMU process (VMs only).')} ${Ext.String.format(gettext("Schema default: {0}"), 16)}`,
            },
        },
+       {
+           xtype: 'pveTwoColumnContainer',
+           startColumn: {
+               xtype: 'proxmoxcheckbox',
+               name: 'fleecing-enabled',
+               reference: 'fleecingEnabled',
+               fieldLabel: gettext('Fleecing'),
+               uncheckedValue: 0,
+               value: 0,
+           },
+           endFlex: 2,
+           endColumn: {
+               xtype: 'displayfield',
+               value: gettext('Backup write cache that can reduce IO pressure inside guests (VMs only).'),
+           },
+       },
+       {
+           xtype: 'pveTwoColumnContainer',
+           startColumn: {
+               xtype: 'pveStorageSelector',
+               name: 'fleecing-storage',
+               fieldLabel: gettext('Fleecing Storage'),
+               reference: 'storageSelector',
+               clusterView: true,
+               storageContent: 'images',
+               allowBlank: false,
+               bind: {
+                   disabled: '{!fleecingEnabled.checked}',
+               },
+           },
+           endFlex: 2,
+           endColumn: {
+               xtype: 'displayfield',
+               value: gettext('Prefer a fast and local storage, ideally with support for discard and thin-provisioning or sparse files.'),
+           },
+       },
        {
            // It's part of the 'performance' property string, so have a field to preserve the
            // value, but don't expose it. It's a rather niche setting and difficult to