mirror of https://github.com/digint/btrbk
btrbk: add compat=ignore_receive_errors option
parent
023d75f7a5
commit
b8464119f6
16
btrbk
16
btrbk
|
@ -141,9 +141,9 @@ my %config_options = (
|
|||
backend_remote => { default => undef, accept => [qw( no btrfs-progs btrfs-progs-btrbk btrfs-progs-sudo btrfs-progs-doas )] },
|
||||
backend_local_user => { default => undef, accept => [qw( no btrfs-progs btrfs-progs-btrbk btrfs-progs-sudo btrfs-progs-doas )] },
|
||||
|
||||
compat => { default => undef, accept => [qw( no busybox )] },
|
||||
compat_local => { default => undef, accept => [qw( no busybox )] },
|
||||
compat_remote => { default => undef, accept => [qw( no busybox )] },
|
||||
compat => { default => undef, accept => [qw( no busybox ignore_receive_errors )], split => 1 },
|
||||
compat_local => { default => undef, accept => [qw( no busybox ignore_receive_errors )], split => 1 },
|
||||
compat_remote => { default => undef, accept => [qw( no busybox ignore_receive_errors )], split => 1 },
|
||||
safe_commands => { default => undef, accept => [qw( yes no )], context => [qw( global )] },
|
||||
|
||||
snapshot_qgroup_destroy => { default => undef, accept => [qw( yes no )], context => [qw( global volume subvolume )] },
|
||||
|
@ -1575,6 +1575,7 @@ sub btrfs_send_receive($$;$$$)
|
|||
INFO "[send/receive] clone-src: $_->{PRINT}" foreach(@$clone_src);
|
||||
|
||||
my $stream_options = config_stream_hash($snapshot, $target);
|
||||
my $compat_ignore_err = config_key_lru($target, "compat", "ignore_receive_errors");
|
||||
|
||||
my @send_options;
|
||||
my @receive_options;
|
||||
|
@ -1582,6 +1583,7 @@ sub btrfs_send_receive($$;$$$)
|
|||
push(@send_options, '-c', { unsafe => $_ } ) foreach(map { $_->{PATH} } @$clone_src);
|
||||
# push(@send_options, '-v') if($loglevel >= 3);
|
||||
# push(@receive_options, '-v') if($loglevel >= 3);
|
||||
push(@receive_options, '--max-errors=0') if($compat_ignore_err);
|
||||
|
||||
my @cmd_pipe;
|
||||
push @cmd_pipe, {
|
||||
|
@ -1594,7 +1596,13 @@ sub btrfs_send_receive($$;$$$)
|
|||
push @cmd_pipe, {
|
||||
cmd => vinfo_cmd($target, "btrfs receive", @receive_options, { unsafe => $target_path . '/' } ),
|
||||
rsh => vinfo_rsh($target, disable_compression => $stream_options->{stream_compress}),
|
||||
fatal_stderr => sub { m/^ERROR: /; }, # NOTE: btrfs-progs < 4.11: if "btrfs send" fails, "btrfs receive" returns 0!
|
||||
fatal_stderr => sub {
|
||||
# NOTE: btrfs-progs < 4.11: if "btrfs send" fails, "btrfs receive" returns 0!
|
||||
if($compat_ignore_err && s/^ERROR: (.*)//) {
|
||||
WARN "Ignoring btrfs receive error (compat=ignore_receive_errors): $1";
|
||||
}
|
||||
m/^ERROR: /;
|
||||
},
|
||||
};
|
||||
|
||||
my $send_receive_error = 0;
|
||||
|
|
Loading…
Reference in New Issue