fallback to old zfs list snapshot method in case of error

This commit is contained in:
Björn 2025-08-25 17:52:48 +02:00 committed by GitHub
parent 510becee2f
commit 24b0293b0f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 1 deletions

8
sanoid
View File

@ -887,7 +887,13 @@ sub getsnaps {
open FH, "$zfs get -Hrpt snapshot creation ".join(" ",keys %$config)." |";
@rawsnaps = <FH>;
close FH;
$exit_code = $? >> 8;
if ($exit_code != 0) {
print "INFO: zfs list shapshots with dataset names does not work.. retrying without dataset names (this will spin-up all disks)\n";
open FH, "$zfs get -Hrpt snapshot creation |";
@rawsnaps = <FH>;
close FH;
}
open FH, "> $cache.tmp" or die "Could not write to $cache.tmp!\n";
print FH @rawsnaps;
close FH;