Skip to content

Libvirt hooks

Francesc Guasch edited this page Dec 12, 2018 · 1 revision

Libvirt hooks can be used to trigger scripts on guest start/stop. Than can be used to run cleanup code.

Examples:

  • close iptables when guest down
  • enforce user limits when guest up
  • logging and accounting

Code

Code can run with any interpreter so hooks in Perl with the Ravada API can be created

Caveats

A hook script must not call back into libvirt, as the libvirt daemon is already waiting for the script to exit. So the Ravada code must be reviewed carefully before using it in the hooks.

Links

https://www.libvirt.org/hooks.html

Clone this wiki locally