Interface changed after 'started' event in hook

Christopher Pereira kripper at imatronix.cl
Sun Oct 23 16:57:23 UTC 2022


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?




More information about the libvir-list mailing list