[pve-devel] [PATCH v3 manager 1/4] vzdump: actually honor schema defaults for performance

Fiona Ebner f.ebner at proxmox.com
Tue Nov 7 14:49:24 CET 2023


The 'performance' option itself defines no 'default' in the schema, so
what happened is that the defaults used by the backends (i.e. QEMU and
proxmox-backup-client) would be used. Luckily, they correspond to the
default values defined in the schema, i.e. in the 'backup-performance'
format. Make the code future-proof and use the actual defaults defined
in the schema instead of relying on that correspondence.

Signed-off-by: Fiona Ebner <f.ebner at proxmox.com>
---

New in v3.

 PVE/VZDump.pm | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/PVE/VZDump.pm b/PVE/VZDump.pm
index 454ab494..182fb80b 100644
--- a/PVE/VZDump.pm
+++ b/PVE/VZDump.pm
@@ -277,8 +277,14 @@ sub read_vzdump_defaults {
 	     defined($default) ? ($_ => $default) : ()
 	} keys %$confdesc_for_defaults
     };
+    my $performance_fmt = PVE::JSONSchema::get_format('backup-performance');
+    $defaults->{performance} = {
+	map {
+	    my $default = $performance_fmt->{$_}->{default};
+	    defined($default) ? ($_ => $default) : ()
+	} keys $performance_fmt->%*
+    };
     $parse_prune_backups_maxfiles->($defaults, "defaults in VZDump schema");
-    parse_performance($defaults);
 
     my $raw;
     eval { $raw = PVE::Tools::file_get_contents($fn); };
-- 
2.39.2






More information about the pve-devel mailing list