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]: