VM autostart fails because bridge interface is not ready

asked 2017-07-02 01:50:25 -0500

becks21 gravatar image

Hi there,

I want to have have several VMs powered up automatically on host boot, but that fails because during host boot the dedicated bridge-interface is not ready yet - log output from libvirtd:

Jul 02 07:54:27 saba1 libvirtd[1337]: Preferred CPU model cpu64-rhel6 not allowed by hypervisor; closest supported model will be used
Jul 02 07:54:27 saba1 libvirtd[1337]: Cannot get interface MTU on 'bridge0': No such device
Jul 02 07:54:27 saba1 libvirtd[1337]: internal error: Failed to autostart VM 'openmediavault': Cannot get interface MTU on 'bridge0': No such device
Jul 02 07:54:28 saba1 dnsmasq[1851]: failed to access /etc/resolv.conf: No such file or directory
Jul 02 07:54:28 saba1 dnsmasq[1851]: reading /etc/resolv.conf
Jul 02 07:54:28 saba1 dnsmasq[1851]: using nameserver 192.168.178.1#53
Jul 02 07:54:28 saba1 dnsmasq[1851]: reading /etc/resolv.conf
Jul 02 07:54:28 saba1 dnsmasq[1851]: using nameserver 192.168.178.1#53

How can I ensure that the VM startup is delayed until all network interfaces are up?

And on a side question: when the host is instructed to shut down, how do I properly power off all the VMs automatically - is there some kind of shutdown-script I have to modify?

Thx and cheers!

edit retag flag offensive close merge delete

Comments

ok got the automatic shutdown part solved by enabling the libvirt-guests service and modifying the '/etc/sysconfig/libvirt-guests' appropriately.. libvirt-guests can also deal with the automatic start of VMs, but the same problems remain, that the used bridge interface is not up yet and thus the VM domain fails to start.. :(

becks21 gravatar imagebecks21 ( 2017-07-02 02:55:58 -0500 )edit

well well.. from freedesktop.org I got that I can enable the service "systemd-networkd-wait-online" but as explicitly stated there, this might considerably delay the boot of the whole system and thus is discouraged as a general procedure.. still looking for a solution to limit this to the scope of "vm attached interfaces" only..

becks21 gravatar imagebecks21 ( 2017-07-02 05:33:37 -0500 )edit

Maybe you can add "Wants=network-online.target" and "After=network-online.target" to libvirtd's systemd service file? The problem is that this holds libvirtd back. Hopefully, this is better than freedesktop's solution.

Benjamin Doron gravatar imageBenjamin Doron ( 2019-03-21 19:35:56 -0500 )edit