btrbk: add warn_unknown_targets config option

pull/409/head
Axel Burri 2021-07-15 13:21:40 +02:00
parent 54bb876b85
commit 5524d16707
2 changed files with 12 additions and 2 deletions

6
btrbk
View File

@ -150,6 +150,8 @@ my %config_options = (
cache_dir => { default => undef, accept_file => { absolute => 1 }, allow_multiple => 1, context => [ "global" ] },
ignore_extent_data_inline => { default => "yes", accept => [ "yes", "no" ] },
warn_unknown_targets => { default => undef, accept => [ "yes", "no" ] },
# deprecated options
ssh_port => { default => "default", accept => [ "default" ], accept_numeric => 1,
deprecated => { DEFAULT => { warn => 'Please use "ssh://hostname[:port]" notation in the "volume" and "target" configuration lines.' } } },
@ -3552,8 +3554,8 @@ sub get_receive_targets($$;@)
else {
TRACE "get_receive_targets: skip unexpected match: " . _fs_path($_) if($do_trace);
${$opts{ret_unexpected}} = 1 if($opts{ret_unexpected});
if($opts{warn}) {
WARN "Receive target of \"$src_vol->{PRINT}\" exists at unexpected location: " . ($vinfo ? $vinfo->{PRINT} : _fs_path($_));
if($opts{warn} && config_key($droot, "warn_unknown_targets")) {
WARN "Receive target of \"$src_vol->{PRINT}\" exists at unknown location: " . ($vinfo ? $vinfo->{PRINT} : _fs_path($_));
}
next;
}

View File

@ -451,6 +451,14 @@ If you want to set this option for regular (non-root) user only, set
<https://bugzilla.kernel.org/show_bug.cgi?id=91751>
=== Informative Options
*warn_unknown_targets* yes|no::
If set, prints a warning if btrbk encounters a target subvolume at
a unknown location (i.e. not following btrbk naming scheme, or
outside the target directory). Defaults to ``no''.
RETENTION POLICY
----------------