Support network interface downscript
QEMU has the ability to run a script when a NIC is brought up and down. Libvirt only enables use of the up script at this time.
Currently we support XML like:
<interface type='ethernet'>
<mac address='00:11:22:33:44:55'/>
<script path='/etc/qemu-ifup'/>
</interface>
Where script path maps to qemu -net ...,script=/etc/qemu-ifup
Seems sensible to add
<interface type='ethernet'>
<mac address='00:11:22:33:44:55'/>
<script path='/etc/qemu-ifup'/>
<downscript path='/path/to/my/downscript'/>
</interface>
Here is an example git commit that could be followed as a illustration of what areas of code need changing:
commit 937ebba00e1bbbb7f67e00f5522511e6e650fd0a
Author: Marc-André Lureau <marcandre.lureau@gmail.com>
Date: Fri Feb 19 15:30:15 2016 +0100
qemu: add spice opengl support
The main components are:
- Parsing the new parameter out of the XML (src/conf/domain_conf.c)
- Putting the new parameter on the qemu command line (src/qemu/qemu_command.c)
- Updating the documentation (docs/formatdomain.html.in)
- Adding a test case to the test suite
In general look at the libvirt code for places that deal with the existing "script" parameter - the support for "downscript" will be 98% the same as that.