btrbk: fix output of "btrbk list backups" and "btrbk stats" (match all uuid/received_uuid combinations)

pull/204/merge
Axel Burri 2018-02-07 16:23:46 +01:00
parent a835241ccf
commit db1fe2d11a
1 changed files with 14 additions and 2 deletions

16
btrbk
View File

@ -2165,6 +2165,18 @@ sub _fs_path
} }
sub _is_correlated($$)
{
my $a = shift; # node a
my $b = shift; # node b
return 0 if($a->{is_root} || $b->{is_root});
return 0 unless($a->{readonly} && $b->{readonly});
return (($a->{uuid} eq $b->{received_uuid}) ||
($b->{uuid} eq $a->{received_uuid}) ||
(($a->{received_uuid} ne '-') && ($a->{received_uuid} eq $b->{received_uuid})));
}
sub _is_child_of sub _is_child_of
{ {
my $node = shift; my $node = shift;
@ -5366,7 +5378,7 @@ MAIN:
$incomplete_backup = 1; $incomplete_backup = 1;
last; last;
} }
if($_->{node}{uuid} eq $target_vol->{node}{received_uuid}) { if(_is_correlated($_->{node}, $target_vol->{node})) {
$parent_snapshot = $_; $parent_snapshot = $_;
last; last;
} }
@ -5456,7 +5468,7 @@ MAIN:
time => $start_time, time => $start_time,
legend => [ legend => [
"up-to-date: latest snapshot/backup is up to date with source subvolume", "up-to-date: latest snapshot/backup is up to date with source subvolume",
"correlated: corresponding (reveived-from) source snapshot is present", "correlated: corresponding (received-from) source snapshot is present",
], ],
); );