Feature: VdevTree rekursiv + Disk-Aktionen (Offline/Online/Detach/Clear)
- VdevTree rendert jetzt alle Ebenen (pool → mirror → sda/sdb) - Disk-⋮-Menü: Clear Disk Errors, Offline, Online, Detach - Backend: neue Endpoints /disk/offline, /disk/online, /disk/detach Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -125,6 +125,45 @@ async def resilver_pool(pool_name: str, current_user: str = Depends(get_current_
|
||||
raise HTTPException(status_code=500, detail=str(e))
|
||||
|
||||
|
||||
@router.post("/{pool_name}/disk/offline")
|
||||
async def disk_offline(pool_name: str, disk: str, current_user: str = Depends(get_current_user)):
|
||||
try:
|
||||
stdout, stderr, rc = zfs_runner.run_command(["zpool", "offline", pool_name, disk])
|
||||
if rc != 0:
|
||||
raise HTTPException(status_code=400, detail=stderr.strip() or "Failed to offline disk")
|
||||
return {"status": "success", "message": f"{disk} offlined"}
|
||||
except HTTPException:
|
||||
raise
|
||||
except Exception as e:
|
||||
raise HTTPException(status_code=500, detail=str(e))
|
||||
|
||||
|
||||
@router.post("/{pool_name}/disk/online")
|
||||
async def disk_online(pool_name: str, disk: str, current_user: str = Depends(get_current_user)):
|
||||
try:
|
||||
stdout, stderr, rc = zfs_runner.run_command(["zpool", "online", pool_name, disk])
|
||||
if rc != 0:
|
||||
raise HTTPException(status_code=400, detail=stderr.strip() or "Failed to online disk")
|
||||
return {"status": "success", "message": f"{disk} onlined"}
|
||||
except HTTPException:
|
||||
raise
|
||||
except Exception as e:
|
||||
raise HTTPException(status_code=500, detail=str(e))
|
||||
|
||||
|
||||
@router.post("/{pool_name}/disk/detach")
|
||||
async def disk_detach(pool_name: str, disk: str, current_user: str = Depends(get_current_user)):
|
||||
try:
|
||||
stdout, stderr, rc = zfs_runner.run_command(["zpool", "detach", pool_name, disk])
|
||||
if rc != 0:
|
||||
raise HTTPException(status_code=400, detail=stderr.strip() or "Failed to detach disk")
|
||||
return {"status": "success", "message": f"{disk} detached"}
|
||||
except HTTPException:
|
||||
raise
|
||||
except Exception as e:
|
||||
raise HTTPException(status_code=500, detail=str(e))
|
||||
|
||||
|
||||
@router.post("/clear-cache")
|
||||
async def clear_cache(current_user: str = Depends(get_current_user)):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user