--- ZnapZend.pm.dist 2019-11-28 17:07:17.927267363 +0100
+++ ZnapZend.pm 2019-11-28 17:44:33.203399136 +0100
@@ -336,6 +336,22 @@
#from being snapshot/sent by setting property "org.znapzend:enabled"
#to "off" on them
for my $srcDataSet (@$srcSubDataSets){
+
+ # get the value for org.znapzend property
+ my @cmd = (@{$self->zZfs->priv}, qw(zfs get -H -o value org.znapzend:enabled), $srcDataSet);
+ print STDERR '# ' . join(' ', @cmd) . "\n" if $self->debug;
+ open my $prop, '-|', @cmd;
+
+ # if the property does not exist, the command will just return. In this case,
+ # the value is implicit "on"
+ $prop = <$prop> || "on";
+ chomp($prop);
+ if ( $prop eq 'off' ) {
+ $self->zLog->debug('Skipping ' . $srcDataSet . ' due to it being explicitly disabled.');
+ next;
+ }
+
+
my $dstDataSet = $srcDataSet;
$dstDataSet =~ s/^\Q$backupSet->{src}\E/$backupSet->{$dst}/;
--- lib/ZnapZend.pm.dist 2019-11-29 00:29:36.980904411 +0100
+++ lib/ZnapZend.pm 2019-11-29 00:21:08.546796322 +0100
@@ -615,7 +615,13 @@
# removal here is non-recursive to allow for fine-grained control
if ( @dataSetsExplicitelyDisabled ){
$self->zLog->info("Requesting removal of marked datasets: ". join( ", ", @dataSetsExplicitelyDisabled));
- $self->zZfs->destroySnapshots(@dataSetsExplicitelyDisabled, 0);
+
+ # We need to explicitly call destroySnapshots for each dataSet we found
+ # because it is only designed to destroy sets of snapshots _for the same filesystem_.
+ # Since we are/have a top-level recursive snapshot, recurse here too.
+ for my $dataSetToDestroy (@dataSetsExplicitelyDisabled){
+ $self->zZfs->destroySnapshots($dataSetToDestroy, 1);
+ }
}
}
}
As a side note, it think
$self->zZfs->destroySnapshots(@dataSetsExplicitelyDisabled, 0);
should have been:
$self->zZfs->destroySnapshots(\@dataSetsExplicitelyDisabled, 0);
but my "Perl"-ish is rusty :)