Repository navigation
Clean up cut-off compacts next to disks outside the data folder - #163
Conversation
The startup cleanup from #151 only looked in the disks folder, but a compact writes its temporary file next to the disk, and a VM's config can point at a disk anywhere. For each VM it now also removes <diskPath>.compact.tmp if it is there. It checks only that exact path, so it never scans the user's other folders. In the disks folder it also catches a disk that isn't named .qcow2, which the folder scan skips.
…ing leaves The Still working question said an unfinished clone or compact stays behind. Both are deleted at the next start now, so it says that.
A21-devs
left a comment
There was a problem hiding this comment.
Read the diff and the startup order in registerIpc: the cleanup runs before autostart or any IPC can start a VM, and it only ever touches <diskPath>.compact.tmp for configs that exist. One wording problem below.
| removing: 'the profile may not be deleted', | ||
| cloning: 'the unfinished copy of the disk stays in the disks folder', | ||
| compacting: 'the unfinished compacted copy stays next to the disk until the next compact', | ||
| cloning: 'the unfinished copy of the disk is deleted the next time the app starts', |
There was a problem hiding this comment.
This is only true for a full clone. A linked clone has no .vmm-clone file to delete: it renames the source disk to the base and creates two overlays, and cut off in between it leaves the source VM without a disk (#156). Saying the copy "is deleted the next time the app starts" tells the user quitting is harmless when for a linked clone it isn't. It should at least say full copy, until #156 lands.
A21-devs
left a comment
There was a problem hiding this comment.
Checked the follow-up: the cloning line now only promises the cleanup for a full copy and names the linked clone risk. The message box joins the detail parts with ", and ", so the longer sentence still reads fine with a second kind of work. Nothing else open here.
Only a full clone writes a separate file the startup cleanup removes. A linked clone stopped between its rename and its overlays leaves the source VM without a disk (#156), so say so.
Closes #157
#151 deletes a cut-off clone or compact at startup, but only in the disks folder. A compact writes
<diskPath>.compact.tmpnext to the disk, and a VM's disk can be anywhere, so a VM pointed at an existing qcow2 elsewhere kept its leftover (as big as the used part of the disk) until its next compact.removeUnfinishedCompacts(configs)insrc/main/disks.ts: for each VM it checks the one path a compact of that VM would have written and deletes it if it is there. It never lists those folders, so nothing else in them is looked at..qcow2, which the folder scan skips on purpose.Testing
tests/clones.test.ts: a leftover next to a disk outside the disks folder (with another program's file and a compact file no VM points at left alone), a non-.qcow2disk, and no leftover at allnpm run typecheck,npm test(195 pass),npm run test:qemu(212 pass),npm run build.compact.tmp: the log saysremoved unfinished disk files: ...Elsewhere.qcow2.compact.tmp, the disk is still there, SMOKE OK