btrbk: assume unreachable target as clean on snapshot creation if snapshot_create_always is set

pull/30/head
Axel Burri 2015-05-15 13:36:18 +02:00
parent 2034b51058
commit d28ed97065
2 changed files with 15 additions and 1 deletions

View File

@ -1,3 +1,8 @@
btrbk-current
* Bugfix: assume unreachable target as clean on snapshot creation if
snapshot_create_always is set (closes: #19).
btrbk-0.17.0
* New versioning scheme using more common three-level versions.

11
btrbk
View File

@ -47,7 +47,7 @@ use Date::Calc qw(Today Delta_Days Day_of_Week);
use Getopt::Std;
use Data::Dumper;
our $VERSION = "0.17.0";
our $VERSION = "0.17.1-dev";
our $AUTHOR = 'Axel Burri <axel@tty0.ch>';
our $PROJECT_HOME = '<http://www.digint.ch/btrbk/>';
@ -1719,9 +1719,14 @@ MAIN:
}
# find unique snapshot name
my @unconfirmed_target_name;
my @lookup = keys %{vinfo_subvol_list($sroot)};
@lookup = grep s/^\Q$snapdir\E\/// , @lookup;
foreach my $config_target (@{$config_subvol->{TARGET}}) {
if($config_target->{ABORTED}) {
push(@unconfirmed_target_name, vinfo($config_target->{url}, $config_target));
next;
}
my $droot = $config_target->{droot} || die;
push(@lookup, keys %{vinfo_subvol_list($droot)});
}
@ -1733,6 +1738,10 @@ MAIN:
$postfix_counter++;
my $snapshot_name = $snapshot_basename . '.' . $timestamp . ($postfix_counter ? "_$postfix_counter" : "");
if(@unconfirmed_target_name) {
INFO "Failed to check all targets, assuming non-present subvolume \"$snapshot_name\" in: " . join(", ", map { "\"$_->{PRINT}\"" } @unconfirmed_target_name);
}
# finally create the snapshot
INFO "Creating subvolume snapshot for: $svol->{PRINT}";
if(btrfs_subvolume_snapshot($svol, "$sroot->{PATH}/$snapdir/$snapshot_name")) {