mirror of
https://github.com/home-assistant/core.git
synced 2025-07-09 22:37:11 +00:00
Add missing disks to Systemmonitor (#106541)
This commit is contained in:
parent
0de6030911
commit
227a69da65
@ -11,14 +11,16 @@ _LOGGER = logging.getLogger(__name__)
|
||||
def get_all_disk_mounts() -> list[str]:
|
||||
"""Return all disk mount points on system."""
|
||||
disks: list[str] = []
|
||||
for part in psutil.disk_partitions(all=False):
|
||||
for part in psutil.disk_partitions(all=True):
|
||||
if os.name == "nt":
|
||||
if "cdrom" in part.opts or part.fstype == "":
|
||||
# skip cd-rom drives with no disk in it; they may raise
|
||||
# ENOENT, pop-up a Windows GUI error for a non-ready
|
||||
# partition or just hang.
|
||||
continue
|
||||
disks.append(part.mountpoint)
|
||||
usage = psutil.disk_usage(part.mountpoint)
|
||||
if usage.total > 0 and part.device != "":
|
||||
disks.append(part.mountpoint)
|
||||
_LOGGER.debug("Adding disks: %s", ", ".join(disks))
|
||||
return disks
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user