Fix: ZFS-Erkennung via tatsächlichem zpool-Test statt which()

shutil.which() reicht nicht: auf privilegierten LXC-Containern ist
zpool installiert, aber /dev/zfs fehlt → Befehl schlägt fehl.
_probe_zfs() führt zpool list einmal aus und wertet den Exit-Code aus.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-05 15:15:55 +02:00
parent 2b6d508ca4
commit 3bc57ef36b
+11 -2
View File
@@ -16,8 +16,17 @@ import re
logger = logging.getLogger(__name__)
# Detect ZFS availability once at import time — avoids repeated ERROR logs on LXC/non-ZFS systems
import shutil as _shutil
ZFS_AVAILABLE = bool(_shutil.which("zpool"))
# shutil.which is not enough: on privileged LXC containers zpool exists but /dev/zfs is missing
def _probe_zfs() -> bool:
try:
r = subprocess.run(["zpool", "list"], capture_output=True, timeout=3)
return r.returncode == 0
except (FileNotFoundError, subprocess.TimeoutExpired, OSError):
return False
ZFS_AVAILABLE = _probe_zfs()
if not ZFS_AVAILABLE:
logger.info("ZFS not available on this system (pools/snapshots disabled)")
# Cache with TTL
@dataclass