mirror of
https://git.proxmox.com/git/pve-guest-common
synced 2025-08-12 00:19:01 +00:00
vzdump: add 'performance' property string as a setting
Initially, to be used for tuning backup performance with QEMU. A few users reported IO-related issues during backup after upgrading to PVE 7.x and using a modified QEMU build with max-workers reduced to 8 instead of 16 helped them [0]. Also generalizes the way vzdump property string are handled for easier extension in the future. [0]: https://forum.proxmox.com/threads/113790/ Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
This commit is contained in:
parent
bdbc909757
commit
e8d7ef5be3
@ -29,16 +29,21 @@ my $dowhash_to_dow = sub {
|
|||||||
return join ',', @da;
|
return join ',', @da;
|
||||||
};
|
};
|
||||||
|
|
||||||
my $fixup_prune_backups_option = sub {
|
our $PROPERTY_STRINGS = {
|
||||||
|
'performance' => 'backup-performance',
|
||||||
|
'prune-backups' => 'prune-backups',
|
||||||
|
};
|
||||||
|
|
||||||
|
my sub parse_property_strings {
|
||||||
my ($opts) = @_;
|
my ($opts) = @_;
|
||||||
|
|
||||||
return if !defined($opts->{'prune-backups'});
|
for my $opt (keys $PROPERTY_STRINGS->%*) {
|
||||||
|
next if !defined($opts->{$opt});
|
||||||
|
|
||||||
$opts->{'prune-backups'} = PVE::JSONSchema::parse_property_string(
|
my $format = $PROPERTY_STRINGS->{$opt};
|
||||||
'prune-backups',
|
$opts->{$opt} = PVE::JSONSchema::parse_property_string($format, $opts->{$opt});
|
||||||
$opts->{'prune-backups'}
|
}
|
||||||
);
|
}
|
||||||
};
|
|
||||||
|
|
||||||
# parse crontab style day of week
|
# parse crontab style day of week
|
||||||
sub parse_dow {
|
sub parse_dow {
|
||||||
@ -71,6 +76,17 @@ sub parse_dow {
|
|||||||
return $res;
|
return $res;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
PVE::JSONSchema::register_format('backup-performance', {
|
||||||
|
'max-workers' => {
|
||||||
|
description => "Applies to VMs. Allow up to this many IO workers at the same time.",
|
||||||
|
type => 'integer',
|
||||||
|
minimum => 1,
|
||||||
|
maximum => 256,
|
||||||
|
default => 16,
|
||||||
|
optional => 1,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
my $confdesc = {
|
my $confdesc = {
|
||||||
vmid => {
|
vmid => {
|
||||||
type => 'string', format => 'pve-vmid-list',
|
type => 'string', format => 'pve-vmid-list',
|
||||||
@ -196,6 +212,12 @@ my $confdesc = {
|
|||||||
maximum => 8,
|
maximum => 8,
|
||||||
default => 7,
|
default => 7,
|
||||||
},
|
},
|
||||||
|
performance => {
|
||||||
|
type => 'string',
|
||||||
|
description => "Other performance-related settings.",
|
||||||
|
format => 'backup-performance',
|
||||||
|
optional => 1,
|
||||||
|
},
|
||||||
lockwait => {
|
lockwait => {
|
||||||
type => 'integer',
|
type => 'integer',
|
||||||
description => "Maximal time to wait for the global lock (minutes).",
|
description => "Maximal time to wait for the global lock (minutes).",
|
||||||
@ -311,7 +333,7 @@ sub parse_vzdump_cron_config {
|
|||||||
$opts->{starttime} = sprintf "%02d:%02d", $hour, $minute;
|
$opts->{starttime} = sprintf "%02d:%02d", $hour, $minute;
|
||||||
$opts->{dow} = &$dowhash_to_dow($dowhash);
|
$opts->{dow} = &$dowhash_to_dow($dowhash);
|
||||||
|
|
||||||
$fixup_prune_backups_option->($opts); # parse the property string
|
parse_property_strings($opts);
|
||||||
|
|
||||||
push @$jobs, $opts;
|
push @$jobs, $opts;
|
||||||
};
|
};
|
||||||
@ -402,8 +424,8 @@ sub command_line {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$v = join(",", PVE::Tools::split_list($v)) if $p eq 'mailto';
|
$v = join(",", PVE::Tools::split_list($v)) if $p eq 'mailto';
|
||||||
$v = PVE::JSONSchema::print_property_string($v, 'prune-backups')
|
$v = PVE::JSONSchema::print_property_string($v, $PROPERTY_STRINGS->{$p})
|
||||||
if $p eq 'prune-backups';
|
if $PROPERTY_STRINGS->{$p};
|
||||||
|
|
||||||
$cmd .= " --$p " . PVE::Tools::shellquote($v) if defined($v) && $v ne '';
|
$cmd .= " --$p " . PVE::Tools::shellquote($v) if defined($v) && $v ne '';
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user