diff --git a/docs/hooks.html.in b/docs/hooks.html.in new file mode 100644 index 0000000000..2afdecfe14 --- /dev/null +++ b/docs/hooks.html.in @@ -0,0 +1,70 @@ + + +
+Libvirt includes synchronous hooks, starting from version 0.8.0, as a + way to tie in specific tailored system actions at a specific time. + If these scripts are present on the host where the hypervisor + is running, then they are called when the libvirt daemon is doingi + some significant action.
+The scripts are expected to execute quickly, return a zero exit + status if all conditions are set for the daemon to continue the + action (non zero will be considered a failure which may + be ignored but in general will stop the ongoing operation). + The script also should not call back into libvirt as the daemon + is waiting for the script exit and deadlock is likely to occur.
+The scripts are stored in the directory /etc/libvirt/hooks/
+ when using a standard installation path
+ ($SYSCONF_DIR/libvirt/hooks/
in general).
Each script is given the following command line arguments:
+There are currently scripts for 3 domains of operation: +
/etc/libvirt/hooks/daemon
script if
+ present is called at 3 points in time:
at daemon startup, typically started with the following + arguments:
+/etc/libvirt/hooks/daemon - start - start+
at daemon shutdown when it is about to exit, with the following + arguments:
+/etc/libvirt/hooks/daemon - shutdown - shutdown+
When the daemon is asked to reload its driver state when + receiving the SIGHUP signal, arguments are:
+/etc/libvirt/hooks/daemon - reload begin SIGHUP+
/etc/libvirt/hooks/qemu
script and
+ /etc/libvirt/hooks/lxc
associate hooks for domain
+ operation on the respective QEmu/KVM and LXC drivers.
The domain related hooks also receive the full XML description + for the concerned domain on their stdin, which allows them to get + all the information from the domain, including UUID or storage + if that is needed for the script operation.
+ Currently only domain startup and domain end operations
+ involve the hook, the first one just before the domain gets
+ created.
+ For example if starting a QEmu domain named test
+ the following script will get called:
/etc/libvirt/hooks/qemu test start begin -+
note that a non-zero return value from the script will abort the + domain startup operation, and if an error string is passed on + stderr by the hook script, it will be provided back to the user + at the libvirt API level.
+For domain shutdown, the script will be called just after the + domain has finished execution, and the script will get:
+/etc/libvirt/hooks/qemu test stopped end -+
It is expected that other operations will be associated to hooks + but at the time of 0.8.0 only those 2 are associated to the + domains life cycle
+