[libvirt] Feature-Request: Network-Hook

Daniel Kraft daniel.kraft at d9t.de
Sat Aug 7 21:30:29 UTC 2010


Hi,

I already talked about that issue with photron on the irc channel. Thanks for 
the great response and the hint that I should come up with this here.

I need to add a physical interface to a bridge generated from libvirt. More 
precisely, I need a vlan-ethernet-device in my bridge to allow guest-clusters 
to communicate efficiently (i.e. without a gateway).

For this example let's say, I want eth0.2 to be a member of the bridge virbr2.

So I could add code to the start-guest hook which checks if eth0.2 is member 
of the same bridge as the configured interface's tun device(s) and if not, add it.
Then I'd add code to the stop-guest hook which checks if there are interfaces 
other than the configured ones as members of the bridge and if not, remove 
eth0.2 from the bridge so that the bridge could be removed (or would be empty 
at least).

This is all ugly and most likely unstable, because it's at the wrong position. 
Depending on the way of the implementation it could happen that eth0.2 is 
removed even if there are guests relying on it or that eth0.2 isn't removed if 
it should be (e.g. if there are manually added interfaces on the bridge). 
Endless debugging sessions and a huge amount of code would be the result.

Anything would be very clear if I had a network hook script. Something like a 
"<script path='...'>" node in the network xml. There I could very cleanly add 
and remove secondary interfaces or modify properties of the bridge. So the 
perfect position of that hook would be *after* the bridge has been created. 
The parameters should at least be
  - bridge name
  - action (start, stop, ...)


Any hints to existing features that could help me to realize that use-case are 
very welcome ;)


Daniel




More information about the libvir-list mailing list