mirror of https://github.com/digint/btrbk
btrbk: on resume, abort on unexpected if receive target is not present
A more sophisticated implementation would be to check this after scheduling, only if the target really needs to be backuped. We could as well automatically trigger a `btrfs snapshot -r` on target in these cases, but this seems counter-intuitive.pull/542/head
parent
d498dbb5c3
commit
c0da910276
13
btrbk
13
btrbk
|
@ -7006,9 +7006,10 @@ MAIN:
|
||||||
my $resume_total = 0;
|
my $resume_total = 0;
|
||||||
my $resume_success = 0;
|
my $resume_success = 0;
|
||||||
|
|
||||||
|
my $unexpected_only = [];
|
||||||
foreach my $snapshot (@snapshots)
|
foreach my $snapshot (@snapshots)
|
||||||
{
|
{
|
||||||
if(get_receive_targets($droot, $snapshot, exact => 1, warn => 1)){
|
if(get_receive_targets($droot, $snapshot, exact => 1, warn => 1, ret_unexpected_only => $unexpected_only)) {
|
||||||
DEBUG "Found correlated target of: $snapshot->{PRINT}";
|
DEBUG "Found correlated target of: $snapshot->{PRINT}";
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
|
@ -7021,6 +7022,16 @@ MAIN:
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(scalar @$unexpected_only && ((config_key($droot, "incremental") // "") eq "strict")) {
|
||||||
|
# If target exists at unexpected location ONLY, we can't send/receive it.
|
||||||
|
ABORTED($droot, "Receive targets of backup candidates exist at unexpected location only");
|
||||||
|
WARN "Skipping backup of \"$sroot->{PRINT}/${snapshot_basename}.*\": " . ABORTED_TEXT($droot),
|
||||||
|
"Please check your target configuration, or fix manually by running" . ($droot->{URL_PREFIX} ? " (on $droot->{URL_PREFIX}):" : ":"),
|
||||||
|
"`btrfs subvolume snapshot -r <found> <target>`",
|
||||||
|
map { "target: $droot->{PATH}/$_->{src_vol}{NAME}, found: " . _fs_path($_->{target_node}) } @$unexpected_only;
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
|
||||||
if(scalar @schedule)
|
if(scalar @schedule)
|
||||||
{
|
{
|
||||||
DEBUG "Checking schedule for backup candidates";
|
DEBUG "Checking schedule for backup candidates";
|
||||||
|
|
Loading…
Reference in New Issue