mirror of https://github.com/jimsalterjrs/sanoid
CLIMATE-1151: added config option to use zfs recursion
This commit is contained in:
parent
a7cb1e2226
commit
1605a60c62
16
sanoid
16
sanoid
|
|
@ -502,7 +502,14 @@ sub take_snapshots {
|
||||||
# update to most current possible datestamp
|
# update to most current possible datestamp
|
||||||
%datestamp = get_date();
|
%datestamp = get_date();
|
||||||
# print "we should have had a $type snapshot of $path $maxage seconds ago; most recent is $newestage seconds old.\n";
|
# print "we should have had a $type snapshot of $path $maxage seconds ago; most recent is $newestage seconds old.\n";
|
||||||
push(@newsnaps, "$path\@autosnap_$datestamp{'sortable'}${dateSuffix}_$type");
|
|
||||||
|
# use zfs recursion if specified in config
|
||||||
|
if ($config{$section}{'zfs_recursion'}) {
|
||||||
|
push(@newsnaps, "-r $path\@autosnap_$datestamp{'sortable'}_$type");
|
||||||
|
|
||||||
|
}else{
|
||||||
|
push(@newsnaps, "$path\@autosnap_$datestamp{'sortable'}_$type");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -530,7 +537,7 @@ sub take_snapshots {
|
||||||
}
|
}
|
||||||
if ($args{'verbose'}) { print "taking snapshot $snap\n"; }
|
if ($args{'verbose'}) { print "taking snapshot $snap\n"; }
|
||||||
if (!$args{'readonly'}) {
|
if (!$args{'readonly'}) {
|
||||||
system($zfs, "snapshot", "$snap") == 0
|
system("$zfs snapshot $snap") == 0
|
||||||
or warn "CRITICAL ERROR: $zfs snapshot $snap failed, $?";
|
or warn "CRITICAL ERROR: $zfs snapshot $snap failed, $?";
|
||||||
}
|
}
|
||||||
if ($config{$dataset}{'post_snapshot_script'} and !$args{'readonly'}) {
|
if ($config{$dataset}{'post_snapshot_script'} and !$args{'readonly'}) {
|
||||||
|
|
@ -846,7 +853,10 @@ sub init {
|
||||||
my $recursive = $ini{$section}{'recursive'} && grep( /^$ini{$section}{'recursive'}$/, @istrue );
|
my $recursive = $ini{$section}{'recursive'} && grep( /^$ini{$section}{'recursive'}$/, @istrue );
|
||||||
my $skipChildren = $ini{$section}{'skip_children'} && grep( /^$ini{$section}{'skip_children'}$/, @istrue );
|
my $skipChildren = $ini{$section}{'skip_children'} && grep( /^$ini{$section}{'skip_children'}$/, @istrue );
|
||||||
my @datasets;
|
my @datasets;
|
||||||
if ($recursive || $skipChildren) {
|
|
||||||
|
if($ini{$section}{'recursive'} =~ /zfs/i) {
|
||||||
|
$config{$section}{'zfs_recursion'} = 1;
|
||||||
|
}elsif ($ini{$section}{'recursive'}) {
|
||||||
@datasets = getchilddatasets($config{$section}{'path'});
|
@datasets = getchilddatasets($config{$section}{'path'});
|
||||||
DATASETS: foreach my $dataset(@datasets) {
|
DATASETS: foreach my $dataset(@datasets) {
|
||||||
chomp $dataset;
|
chomp $dataset;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue