From e3b42caf0148e1406cf41f85760f2de09ed32f64 Mon Sep 17 00:00:00 2001 From: Patrick Date: Thu, 4 Jun 2026 22:59:40 +0200 Subject: [PATCH] Fix: list_snapshots mit -r statt -d1, Cache-Key pro Dataset -d 1 begrenzte auf direkte Snapshots des Datasets, tank/share wurde nicht eingeschlossen. -r (recursive) liefert alle Sub-Datasets. Cache-Key jetzt dataset-spezifisch um Kollisionen zu vermeiden. Co-Authored-By: Claude Sonnet 4.6 --- backend/services/zfs_runner.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/backend/services/zfs_runner.py b/backend/services/zfs_runner.py index 664333b..23860cf 100644 --- a/backend/services/zfs_runner.py +++ b/backend/services/zfs_runner.py @@ -362,16 +362,16 @@ class ZFSRunner: """ List snapshots (with limit for performance on many snapshots) """ - cached = self.cache.get("snapshots") + cache_key = f"snapshots:{dataset_name or '*'}" + cached = self.cache.get(cache_key) if cached: return cached - # If no dataset specified, list all if dataset_name: - cmd = ["zfs", "list", "-t", "snapshot", "-d", "1", "-H", "-p", + # No -d limit so sub-datasets (e.g. tank/share) are included + cmd = ["zfs", "list", "-t", "snapshot", "-r", "-H", "-p", "-o", "name,used,referenced,creation", dataset_name] else: - # Get all snapshots, limited cmd = ["zfs", "list", "-t", "snapshot", "-H", "-p", "-o", "name,used,referenced,creation"] @@ -402,7 +402,7 @@ class ZFSRunner: snapshots.sort(key=lambda x: x["creation"], reverse=True) snapshots = snapshots[:limit] - self.cache.set("snapshots", snapshots, ttl_seconds=60) + self.cache.set(cache_key, snapshots, ttl_seconds=60) return snapshots def create_snapshot(self, dataset_name: str, snapshot_name: Optional[str] = None) -> Dict[str, str]: