Add host drives section for non-enclosure drives

This commit is contained in:
2026-03-07 05:16:30 +00:00
parent 927a5ccf3a
commit 798308d2bf
4 changed files with 257 additions and 0 deletions

View File

@@ -6,10 +6,12 @@ from fastapi import APIRouter
from models.schemas import (
DriveHealthSummary,
EnclosureWithDrives,
HostDrive,
Overview,
SlotWithDrive,
)
from services.enclosure import discover_enclosures, list_slots
from services.host import get_host_drives
from services.smart import get_smart_data
from services.zfs import get_zfs_pool_map
@@ -119,10 +121,24 @@ async def get_overview():
slots=slots_out,
))
# Host drives (non-enclosure)
host_drives_raw = await get_host_drives()
host_drives_out: list[HostDrive] = []
for hd in host_drives_raw:
total_drives += 1
hs = hd.get("health_status", "healthy")
if hs == "error":
errors += 1
all_healthy = False
elif hs == "warning":
warnings += 1
host_drives_out.append(HostDrive(**hd))
return Overview(
healthy=all_healthy and errors == 0,
drive_count=total_drives,
warning_count=warnings,
error_count=errors,
enclosures=enc_results,
host_drives=host_drives_out,
)