diff --git a/changes/1728.fix.md b/changes/1728.fix.md new file mode 100644 index 0000000000..63928e0499 --- /dev/null +++ b/changes/1728.fix.md @@ -0,0 +1 @@ +Make root partition filesystem type detection compatible with macOS using psutil diff --git a/src/ai/backend/common/identity.py b/src/ai/backend/common/identity.py index de3e144a45..b373f28940 100644 --- a/src/ai/backend/common/identity.py +++ b/src/ai/backend/common/identity.py @@ -11,6 +11,7 @@ import aiodns import ifaddr +import psutil from .utils import curl @@ -98,14 +99,9 @@ def fetch_local_ipaddrs(cidr: BaseIPNetwork) -> Iterable[BaseIPAddress]: def get_root_fs_type() -> tuple[PosixPath, str]: - with open(Path("/proc/mounts"), "r") as f: - for line in f: - fields = line.split() - if line.startswith("#"): - continue - if len(fields) < 3 or fields[1] != "/": - continue - return PosixPath(fields[0]), fields[2] + for partition in psutil.disk_partitions(): + if partition.mountpoint == "/": + return PosixPath(partition.device), partition.fstype raise RuntimeError("Could not find the root filesystem from the mounts.")