mirror of https://github.com/digint/btrbk
btrbk: abort on unexpected only if receive target is not present
parent
4234fb2965
commit
c538702d8c
6
btrbk
6
btrbk
|
@ -3517,6 +3517,7 @@ sub get_receive_targets($$;@)
|
|||
my @ret;
|
||||
|
||||
my @correlated = _correlated_nodes($droot->{node}, $src_vol->{node});
|
||||
my $unexpected;
|
||||
foreach (@correlated) {
|
||||
my $vinfo = vinfo_resolved($_, $droot); # returns undef if not below $droot
|
||||
if(exists($_->{BTRBK_RAW})) {
|
||||
|
@ -3530,7 +3531,7 @@ 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});
|
||||
$unexpected = 1;
|
||||
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($_));
|
||||
}
|
||||
|
@ -3538,6 +3539,7 @@ sub get_receive_targets($$;@)
|
|||
}
|
||||
push(@ret, $vinfo);
|
||||
}
|
||||
${$opts{ret_unexpected_only}} = 1 if($opts{ret_unexpected_only} && $unexpected && !scalar(@ret));
|
||||
return @ret;
|
||||
}
|
||||
|
||||
|
@ -4598,11 +4600,11 @@ sub macro_archive_target($$$;$)
|
|||
my $has_unexpected_location = 0;
|
||||
foreach my $svol (@{vinfo_subvol_list($sroot, readonly => 1, btrbk_direct_leaf => $snapshot_name, sort => 'path')})
|
||||
{
|
||||
next if(get_receive_targets($droot, $svol, exact => 1, warn => 1, ret_unexpected => \$has_unexpected_location));
|
||||
if(my $ff = vinfo_match(\@exclude_vf, $svol)) {
|
||||
INFO "Skipping archive candidate \"$svol->{PRINT}\": Match on exclude pattern \"$ff->{unparsed}\"";
|
||||
next;
|
||||
}
|
||||
next if(get_receive_targets($droot, $svol, exact => 1, warn => 1, ret_unexpected_only => \$has_unexpected_location));
|
||||
DEBUG "Adding archive candidate: $svol->{PRINT}";
|
||||
|
||||
push @schedule, { value => $svol,
|
||||
|
|
Loading…
Reference in New Issue