fix: filter out loop devices and system partitions from VM storage overview
Some checks failed
Backend Tests / pytest (Python 3.12) (push) Failing after 1m20s
Deploy to Production / Trigger production update (push) Failing after 10s

Only show user-relevant filesystems by skipping snap/loop mounts
and /boot/* partitions in QEMU guest agent fsinfo response.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-08-14 16:40:01 +05:00
parent 8ff757f8c1
commit f29226a735

View File

@@ -372,6 +372,9 @@ class VmMixin:
try: try:
result = self.proxmox.nodes(node).qemu(vmid).agent('get-fsinfo').get() result = self.proxmox.nodes(node).qemu(vmid).agent('get-fsinfo').get()
fslist = result if isinstance(result, list) else result.get('result', []) fslist = result if isinstance(result, list) else result.get('result', [])
_SKIP_MOUNTPOINT_PREFIXES = ('/snap/', '/boot/')
_SKIP_DISK_PREFIXES = ('loop',)
disks = [] disks = []
seen_disks: set = set() seen_disks: set = set()
for fs in fslist: for fs in fslist:
@@ -380,14 +383,19 @@ class VmMixin:
total = fs.get('total-bytes', 0) or 0 total = fs.get('total-bytes', 0) or 0
if total == 0: if total == 0:
continue continue
# Deduplicate by disk+partition key to avoid pseudo-filesystems mountpoint = fs.get('mountpoint', '/')
disk_key = fs.get('name', '') or fs.get('mountpoint', '') name = fs.get('name', '')
if any(mountpoint.startswith(p) for p in _SKIP_MOUNTPOINT_PREFIXES):
continue
if any(name.lower().startswith(p) for p in _SKIP_DISK_PREFIXES):
continue
disk_key = name or mountpoint
if disk_key in seen_disks: if disk_key in seen_disks:
continue continue
seen_disks.add(disk_key) seen_disks.add(disk_key)
disks.append({ disks.append({
'name': fs.get('name', ''), 'name': name,
'mountpoint': fs.get('mountpoint', '/'), 'mountpoint': mountpoint,
'used': fs.get('used-bytes', 0) or 0, 'used': fs.get('used-bytes', 0) or 0,
'total': total, 'total': total,
}) })