[libvirt] Executing scripts when bridge interface becomes available

Felix Schwarz felix.schwarz at oss.schwarz.eu
Sun Dec 20 13:38:27 UTC 2009


I'm using libvirt on a CentOS 5.4 host (so my libvirt is quite old) with a 
routed setup. My configuration is easy and works reliable as far as I can tell 

As far as I know, I have to add routes manually (so that the host knows which 
IPs need to be routed to the virbr1). My ip command looks like this:
    /sbin/ip route add <guest ip> dev virbr1  scope link

Currently I have really problems finding the right spot where I should 
configure the routes and it looks like libvirt does not offer any support for 

1. I can add the route when my network comes up because virbr1 is not
    available at that time.
2. If I switch my vm to the 'ethernet' interface, I can use a custom script
    but then I have to do all the network setup myself which looks like
    overkill and time-consuming (as I have to rebuild things that libvirt
    already does perfectly). I just want to add some routes...

To me the perfect solution would be either:
a) have start/stop scripts defined in the network configuration
b) have start/stop scripts defined in the vm configuration

- Does libvirt 0.7 offer things like that? (I could not find something in the
- Is there an obvious way that I missed when it comes to route configuration?


More information about the libvir-list mailing list