On Tue, Oct 08, 2024 at 10:57:53AM -0400, Laine Stump wrote: > 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. My bad. When I introduced auto-timeouts (even to libvirtd), I looked at the network driver and thought there was no reason to stop it shutting down as the network could keep working just fine without libvirtd/virtnetworkd running. I totally forgot that we flush and reload firewall rules on every startup /facepalm > > 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@xxxxxxxxxx> > --- > > I had made this patch as a part of a larger series that will require > it, but haven't sent that yet and keep being annoyed when virtnetworkd > exits out from under a gdb session, so I decided it has enough general > usefulness to send by itself. > > src/network/bridge_driver.c | 20 +++++++++++++++++--- > src/network/bridge_driver_conf.h | 9 ++++++++- > 2 files changed, 25 insertions(+), 4 deletions(-) Reviewed-by: Daniel P. Berrangé <berrange@xxxxxxxxxx> With regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|