vzdump: fix default values

Not all document default values matched their actual
default, fix this by not maintaining two separate lists of
default values.

Note that this changes:
 - the default compression from none to the documented LZO
 - the documented default mode from stop to snapshot
This commit is contained in:
Wolfgang Bumiller 2016-03-03 15:49:59 +01:00 committed by Dietmar Maurer
parent 0568e342e8
commit 1ab98f059e

View File

@ -77,7 +77,7 @@ my $confdesc = {
type => 'string', type => 'string',
description => "Backup mode.", description => "Backup mode.",
optional => 1, optional => 1,
default => 'stop', default => 'snapshot',
enum => [ 'snapshot', 'suspend', 'stop' ], enum => [ 'snapshot', 'suspend', 'stop' ],
}, },
exclude => { exclude => {
@ -133,12 +133,14 @@ my $confdesc = {
description => "LVM snapshot size in MB.", description => "LVM snapshot size in MB.",
optional => 1, optional => 1,
minimum => 500, minimum => 500,
default => 1024,
}, },
bwlimit => { bwlimit => {
type => 'integer', type => 'integer',
description => "Limit I/O bandwidth (KBytes per second).", description => "Limit I/O bandwidth (KBytes per second).",
optional => 1, optional => 1,
minimum => 0, minimum => 0,
default => 0,
}, },
ionice => { ionice => {
type => 'integer', type => 'integer',
@ -146,24 +148,28 @@ my $confdesc = {
optional => 1, optional => 1,
minimum => 0, minimum => 0,
maximum => 8, maximum => 8,
default => 7,
}, },
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).",
optional => 1, optional => 1,
minimum => 0, minimum => 0,
default => 3*60, # 3 hours
}, },
stopwait => { stopwait => {
type => 'integer', type => 'integer',
description => "Maximal time to wait until a VM is stopped (minutes).", description => "Maximal time to wait until a VM is stopped (minutes).",
optional => 1, optional => 1,
minimum => 0, minimum => 0,
default => 10, # 10 minutes
}, },
maxfiles => { maxfiles => {
type => 'integer', type => 'integer',
description => "Maximal number of backup files per VM.", description => "Maximal number of backup files per VM.",
optional => 1, optional => 1,
minimum => 1, minimum => 1,
default => 1,
}, },
remove => { remove => {
type => 'boolean', type => 'boolean',
@ -328,14 +334,10 @@ sub read_vzdump_defaults {
my $fn = "/etc/vzdump.conf"; my $fn = "/etc/vzdump.conf";
my $defaults = { my $defaults = {
bwlimit => 0, map {
ionice => 7, my $default = $confdesc->{$_}->{default};
size => 1024, defined($default) ? ($_ => $default) : ()
lockwait => 3*60, # 3 hours } keys %$confdesc
stopwait => 10, # 10 minutes
mode => 'snapshot',
maxfiles => 1,
pigz => 0,
}; };
my $raw; my $raw;