Skip to content

Commit

Permalink
Add missing disks to Systemmonitor (#106541)
Browse files Browse the repository at this point in the history
  • Loading branch information
gjohansson-ST authored and bramkragten committed Dec 28, 2023
1 parent 0de6030 commit 227a69d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions homeassistant/components/systemmonitor/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,16 @@
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

Expand Down

0 comments on commit 227a69d

Please sign in to comment.