Fix vdev parsing: use leading whitespace count instead of tab count

This commit is contained in:
2026-03-07 04:20:42 +00:00
parent 3ef7061aa5
commit 3280d66888

View File

@@ -59,11 +59,11 @@ async def get_zfs_pool_map() -> dict[str, dict]:
if not in_config or not current_pool:
continue
# Count leading tab depth to distinguish pool/vdev/device lines.
# Pool name = 1 tab, vdev = 2 tabs, device = 3+ tabs
tab_count = len(line) - len(line.lstrip('\t'))
# Indentation: 1 tab = pool name, 1 tab + 2 spaces = vdev,
# 1 tab + 4 spaces = device. Count chars before content.
leading = len(line) - len(line.lstrip())
if tab_count == 2 and "/dev/" not in stripped:
if "/dev/" not in stripped and leading == 3:
# This is a vdev line (mirror-0, raidz2-0, etc.)
current_vdev = stripped.split()[0]
elif "/dev/" in stripped: