Add host drives section for non-enclosure drives
This commit is contained in:
@@ -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,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user