]> xenbits.xensource.com Git - libvirt.git/commit
network: inhibit idle timeout of daemon if there are any active networks
authorLaine Stump <laine@redhat.com>
Fri, 30 Aug 2024 16:37:05 +0000 (12:37 -0400)
committerLaine Stump <laine@redhat.com>
Thu, 10 Oct 2024 18:07:12 +0000 (14:07 -0400)
commit37800af9a400385801da6d73654249fdb51a93d8
tree81f82c8a50f6f230929cbe04d929cc8905d09ea8
parentf677665ce9ee598d9896e3587d1aa117b56f170d
network: inhibit idle timeout of daemon if there are any active networks

When the daemons were split out from the monolithic libvirtd, the
network driver didn't implement "inhibit idle timeout if there are any
active objects" as was done for other drivers, so virtnetworkd would
always exit after 120 seconds of no incoming connections. This didn't
every cause any visible problem, although it did mean that anytime a
network API was called after an idle time > 120 seconds, that the
restarting virtnetworkd would flush and reload all the
iptables/nftables rules for any active networks.

This patch replicates what is done in the QEMU driver - an nactive is
added to the network driver object, along with an inhibitCallback; the
latter is passed into networkStateInitialize when the driver is
loaded, and the former is incremented for each already-active network,
then incremented/decremented each time a network is started or
stopped. If nactive transitions from 0 to 1 or 1 to 0, inhibitCallback
is called, and it "does the right stuff" to prevent/enable the idle
timeout.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
src/network/bridge_driver.c
src/network/bridge_driver_conf.h