1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-12-03 01:16:10 +00:00

feat(instances): the Guest Info tab shows how full the guest's file systems are

A disk filling up inside a guest was seen only from the guest. The Guest Info
tab now lists, from the guest agent, each mounted file system with its type
and used / total size, a bar turning amber from 85 %. File systems the agent
gives no size of (pseudo ones, Windows' System Reserved) are left out; an
agent without the command still shows the rest of the tab.
This commit is contained in:
catborise 2026-11-20 09:13:59 +03:00
parent 981ff7b294
commit 46931bdbdb
10 changed files with 544 additions and 401 deletions

View file

@ -784,8 +784,21 @@ class wvmInstance(wvmConnect):
for command in ("guest-get-timezone", "guest-get-host-name"):
with contextlib.suppress(libvirtError):
info.update(agent_command(self.instance, command))
with contextlib.suppress(libvirtError):
info["filesystems"] = self.guest_filesystems()
return info
def guest_filesystems(self):
"""The guest's mounted file systems the agent gives both sizes of (not
pseudo ones), by mount point: [{"mountpoint", "type", "used", "total"}], bytes."""
filesystems = []
for fs in agent_command(self.instance, "guest-get-fsinfo") or []:
used, total = (fs or {}).get("used-bytes"), (fs or {}).get("total-bytes")
if isinstance(used, int) and isinstance(total, int) and total > 0:
filesystems.append({"mountpoint": str(fs.get("mountpoint", "")), "type": str(fs.get("type", "")),
"used": used, "total": total})
return sorted(filesystems, key=lambda fs: fs["mountpoint"])
def start(self, flags=0):
self.instance.createWithFlags(flags)