btrbk: bugfix: do not read target btrfs tree on "btrbk snapshot --preserve"

If running "btrbk snapshot --preserve", there is no need to initialize
targets, and we don't want to warn and fail (exitcode=10) on missing
targets.
pull/235/head
Vít Novotný 2018-05-09 12:33:10 +02:00 committed by Axel Burri
parent 17f41118d3
commit c8fcb01bc2
2 changed files with 31 additions and 22 deletions

View File

@ -8,6 +8,8 @@ btrbk-0.27.0-dev
(close #217). Note that this change may result in (previously (close #217). Note that this change may result in (previously
preserved) backups to be deleted! preserved) backups to be deleted!
* Bugfix: add "btrfs filesystem usage" backend mapping (close #222). * Bugfix: add "btrfs filesystem usage" backend mapping (close #222).
* Bugfix: do not fail (exitcode=10) if targets are not accessible on
"btrfs snapshot --preserve".
* Enhance internal data structures: * Enhance internal data structures:
- Allow snapshot_dir to be a mountpoint. - Allow snapshot_dir to be a mountpoint.
- Search complete target tree for correlated subvolumes. - Search complete target tree for correlated subvolumes.

7
btrbk
View File

@ -5313,6 +5313,12 @@ MAIN:
} }
# read target btrfs tree # read target btrfs tree
if($action_run && $skip_backups && $preserve_snapshots && $preserve_backups) {
# if running "btrbk snapshot --preserve", there is no need to
# initialize targets, and we don't want to fail on missing targets.
DEBUG "Skipping target tree readin (preserving all snapshots and backups)";
}
else {
foreach my $sroot (vinfo_subsection($config, 'volume')) { foreach my $sroot (vinfo_subsection($config, 'volume')) {
foreach my $svol (vinfo_subsection($sroot, 'subvolume')) { foreach my $svol (vinfo_subsection($sroot, 'subvolume')) {
foreach my $droot (vinfo_subsection($svol, 'target')) { foreach my $droot (vinfo_subsection($svol, 'target')) {
@ -5342,6 +5348,7 @@ MAIN:
} }
} }
} }
}
# check for duplicate snapshot locations # check for duplicate snapshot locations
my %snapshot_check; my %snapshot_check;