onl query not ignored datasets for snapshots

This commit is contained in:
Bjoern Riemer 2025-11-09 22:44:20 +01:00 committed by Bjoern
parent 24b0293b0f
commit 1c6d7d6459
1 changed files with 28 additions and 1 deletions

29
sanoid
View File

@ -144,6 +144,33 @@ if ($args{'cron'}) {
exit 0; exit 0;
####################################################################################
####################################################################################
####################################################################################
sub get_active_datasets {
my ($config, $snaps, $snapsbytype, $snapsbypath) = @_;
#my %datestamp = get_date();
#my $errlevel = 0;
#my $msg;
#my @msgs;
my @paths;
foreach my $section (keys %config) {
if ($section =~ /^template/) { next; }
if (! $config{$section}{'autoprune'}) { next; }
if (! $config{$section}{'autosnap'}) { next; }
if ($config{$section}{'process_children_only'}) { next; }
my $path = $config{$section}{'path'};
push @paths, $path;
}
my @sorted_paths = sort { lc($a) cmp lc($b) } @paths;
my $paths = join (" ", @sorted_paths);
return $paths
}
#################################################################################### ####################################################################################
#################################################################################### ####################################################################################
#################################################################################### ####################################################################################
@ -884,7 +911,7 @@ sub getsnaps {
} }
} }
# just get snapshots from configured datasets to not spin up the disks # just get snapshots from configured datasets to not spin up the disks
open FH, "$zfs get -Hrpt snapshot creation ".join(" ",keys %$config)." |"; open FH, "$zfs get -Hrpt snapshot creation ".get_active_datasets(@params)." |";
@rawsnaps = <FH>; @rawsnaps = <FH>;
close FH; close FH;
$exit_code = $? >> 8; $exit_code = $? >> 8;