Return optimistic life time estimate for eMMC storage (#6063)

This avoids that we display a 10% life time use for a brand new
eMMC storage. The values are estimates anyways, and there is a
separate value which represents life time completely used (100%).
This commit is contained in:
Stefan Agner 2025-08-05 10:43:57 +02:00 committed by GitHub
parent 628a18c6b8
commit f150d1b287
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 3 deletions

View File

@ -178,8 +178,8 @@ class HwDisk(CoreSysAttributes):
)
return 100.0
# Return the pessimistic estimate (0x02 -> 10%-20%, return 20%)
return life_time_value * 10.0
# Return the optimistic estimate (0x02 -> 10%-20%, return 10%)
return (life_time_value - 1) * 10.0
async def get_disk_life_time(self, path: str | Path) -> float | None:
"""Return life time estimate of the underlying SSD drive."""

View File

@ -160,7 +160,7 @@ def test_try_get_emmc_life_time(coresys, tmp_path):
str(tmp_path / "fake-{}-lifetime"),
):
value = coresys.hardware.disk._try_get_emmc_life_time("mmcblk0")
assert value == 20.0
assert value == 10.0
async def test_try_get_nvme_life_time(