Doc Text:
|
Cause:
Libvirt offers so called 'autostart' feature which can be set on some objects that libvirt manages (e.g. domains, networks, storage pools). If an object is marked as 'autostart' then the idea is that such object is started automatically on host boot. Historically this was done by libvirtd - when it was starting up, it also started all objects that were marked as autostart. But with recent work on daemon split and socket activation this old approach was not good enough. Thing is, libvirtd can be now socket activated and after some period of inactivity it shuts down again (this is achieved by adding --timeout onto the libvirtd's command line). Therefore, libvirtd may start up and shut down multiple times which would also start all autostarted objects again.
Consequence:
For instance, let's assume I have a domain A, makred as autostart, the host boots up and the domain is started automatically. But then I shut the domain down (virsh shutdown A). Now, after some time of inactivity, I call a libvirt API (say virsh list) which starts the daemon again, which also starts the domain A again.
Fix:
On first autostart, libvirtd creates a dummy file (under a location that doesn't survive reboots), and if the file already exists autostart is suppressed. This means, that no matter how many times libvirtd starts and shuts down, the autostart is done exactly once.
Result:
Autostart feature works as designed again.
|