On 10/23/22 18:57, Christopher Pereira wrote: > Hi, > > We have a libvirt-qemu hook script that intercepts the "started" event > and configures the virtual network interface (we set a private IP, > remove the interface from the virtual bridge and set some custom iptable > rules). > > After upgrading from libvirt 3.2 to 4.5 we noticed that the interface is > configured *after* the 'started' event is triggered and thus our custom > configuration is overwritten (the IP we set is removed). > > As a workaround we added a "sleep 5" to our scripts which works, but we > wonder what is the correct way to avoid libvirt to change the virtual > interface after the 'started' event is triggered to keep our custom > configuration. > > We have currently this setting: > > <interface type='bridge'> > <mac address='*********'/> > <source bridge='virbr0'/> > <model type='virtio'/> > <address type='pci' domain='0x0000' bus='0x00' slot='0x03' > function='0x0'/> > </interface> > > What would be the correct setting to avoid libvirt to change the > interface after the hook is triggered? > > Looking into the current code, the hook is called only after the domain was started up: int qemuProcessFinishStartup(virQEMUDriver *driver, virDomainObj *vm, virDomainAsyncJob asyncJob, bool startCPUs, virDomainPausedReason pausedReason) { .... if (qemuProcessStartHook(driver, vm, VIR_HOOK_QEMU_OP_STARTED, VIR_HOOK_SUBOP_BEGIN) < 0) return -1; return 0; } There might have been a problem in the past, but honestly, it's more than 4 years old release. Therefore, if you could reproduce it with something more recent you have higher chance of somebody looking deeper into it. Michal