Score:0

systemd: How to wait for a network device provided dynamicly at runtime?

co flag

We have a server (hypervisor) hosting many virtual machines controlled by libvirt. libvirt provides a virtual network for communication between the virtual machines and the hypervisor. This virtual network is established at runtime by libvirtd.service and called sys-devices-virtual-net-virbr1.device.

A few services, running on the hypervisor, should be bound to that virtual network, like IMAP, Database and so on.

The problem we face is that the services, running on the hypervisor, are started by systemd before the virtual network is setup and so the startup of the services failed. The current startup order are shown in this graph:

systemd startup order graph

For cases like this there are systemd directives, like

  • After=
  • Required=
  • Wants=

and so on. But they don't help in my case. As far as I understood is the reason for this that the sys-devices-virtual-net-virbr1.device is created by libvirtd.service dynamically at runtime and not known to systemd at system startup. So the dependency can't be resolved at startup by systemd, since the sys-devices-virtual-net-virbr1.device network interface is not known.

Does systemd provides techniques to solve such issues?

Any hint is appreciated. Thanks.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.