Skip to content

Commit

Permalink
fix: Add a subvolume syscall exception for btrfs (#454) (#473)
Browse files Browse the repository at this point in the history
  • Loading branch information
studioego committed Jun 15, 2022
1 parent b5d3565 commit db7063d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions changes/473.fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Let it ignore a permission error when calling Python `os.statvfs()` on a btrfs subvolume (e.g., `/var/lib/docker/btrfs`) as the intention of the call is to retrieve filesystem-level disk usage rather than subvolume statistics
2 changes: 2 additions & 0 deletions src/ai/backend/agent/docker/intrinsic.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,8 @@ def get_disk_stat():
per_disk_stat = {}
for disk_info in psutil.disk_partitions():
if disk_info.fstype not in pruned_disk_types:
if '/var/lib/docker/btrfs' == disk_info.mountpoint:
continue
dstat = os.statvfs(disk_info.mountpoint)
disk_usage = Decimal(dstat.f_frsize * (dstat.f_blocks - dstat.f_bavail))
disk_capacity = Decimal(dstat.f_frsize * dstat.f_blocks)
Expand Down

0 comments on commit db7063d

Please sign in to comment.