Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Addressing issue #154 #379

merged 4 commits into from Oct 2, 2018
Changes from 3 commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.


Just for now

@@ -389,8 +389,8 @@ my $createSnapshot = sub {
#no HUP handler in child

my $snapshotName = $backupSet->{src} . '@'
. $self->zTime->createSnapshotTime($timeStamp, $backupSet->{tsformat});
my $snapshotSuffix = $self->zTime->createSnapshotTime($timeStamp, $backupSet->{tsformat});
my $snapshotName = $backupSet->{src} . '@'. $snapshotSuffix;

#set env variables for pre and post scripts use
local $ENV{ZNAP_NAME} = $snapshotName;
@@ -427,6 +427,43 @@ my $createSnapshot = sub {

# remove snapshots from descendant subsystems that have the property "enabled" to "off", if the
# "recursive" flag is set to "on"
if ($backupSet->{recursive} eq 'on') {

$self->zLog->info("checking ZFS dependent datasets from '$backupSet->{src}' explicitely excluded");

# restrict the list to the datasets that are descendant from the current
my @dataSetList = grep /^$backupSet->{src}($|\/)/, @{$self->zZfs->listDataSets()};
if (@dataSetList) {

# for each dataset: if the property "enabled" is set to "off", set the
# newly created snapshot for removal
my @dataSetsExplicitelyDisabled = ();
for my $dataSet (@dataSetList){

# get the value for org.znapzend property
my @cmd = (@{$self->zZfs->priv}, qw(zfs get -H -s local -o value org.znapzend:enabled), $dataSet);
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";
if ( $prop eq 'off' ) {
push(@dataSetsExplicitelyDisabled, $dataSet . '@' . $snapshotSuffix);

# remove the snapshots previously marked
if ( @dataSetsExplicitelyDisabled ){
$self->zLog->info("Requesting removal of marked datasets: ". join( ", ", @dataSetsExplicitelyDisabled));

#clean up env variables
delete $ENV{ZNAP_NAME};
delete $ENV{ZNAP_TIME};
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.