r/vmhost: Retry vm-autostart if libvirt is down
If the _libvirt_ daemon has not fully started by the time `vm-autostart` runs, we want it to fail and try again shortly. To allow this, we first attempt to connect to the _libvirt_ socket, and if that fails, stop immediately and try again in a second. This way, the first few VMs don't get skipped with the assumption that they're missing, just because the daemon wasn't ready yet.
This commit is contained in:
@@ -5,6 +5,8 @@ if [ ! -r /etc/vm-autostart ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
virsh connect || exit
|
||||
|
||||
while read name args; do
|
||||
if [ "${name}" = delay ]; then
|
||||
sleep ${args}
|
||||
|
||||
Reference in New Issue
Block a user