Skip disk types in System Monitor (#107943)

* Skip disk types in System Monitor

* change back
pull/107960/head^2
G Johansson 2024-01-13 14:34:24 +01:00 committed by GitHub
parent c49246dd07
commit 1d2c23d81c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 0 deletions

View File

@ -7,6 +7,8 @@ import psutil
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
SKIP_DISK_TYPES = {"proc", "tmpfs", "devtmpfs"}
def get_all_disk_mounts() -> set[str]: def get_all_disk_mounts() -> set[str]:
"""Return all disk mount points on system.""" """Return all disk mount points on system."""
@ -18,6 +20,9 @@ def get_all_disk_mounts() -> set[str]:
# ENOENT, pop-up a Windows GUI error for a non-ready # ENOENT, pop-up a Windows GUI error for a non-ready
# partition or just hang. # partition or just hang.
continue continue
if part.fstype in SKIP_DISK_TYPES:
# Ignore disks which are memory
continue
try: try:
usage = psutil.disk_usage(part.mountpoint) usage = psutil.disk_usage(part.mountpoint)
except PermissionError: except PermissionError: