[libvirt] qemu hook is not starting

Csom Gyula csom at interface.hu
Thu Jul 8 18:49:25 UTC 2010

Hi there!

Since our cloud system that is currently under development, might need it, I've tested libvirt
domain hooks but unfortunately failed. I've tried the following scenario:

1. create the hook directory...

# mkdir /etc/libvirt/hook
# chmod 755 /etc/libvirt/hook

2. ... or maybe hooks?

# ln -s hook hooks

3. create the hook script

# vi /etc/libvirt/hook/qemu
# cat /etc/libvirt/hook/qemu

echo "*****************************************************" >> /tmp/libvirt.log
echo "qemu-hook: $@" >> /tmp/libvirt.log
echo "*****************************************************" >> /tmp/libvirt.log

echo "test error" >&2
exit 1

# chmod 755 /etc/libvirt/hook/qemu

4. Then I restarted the libvirt daemon and created a domain through virsh. Unfortunately nothing
happened. That is the vm started - although according to the documentation [1] it should not have
to start: "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". Also the messages echod by the script did not appear in the log.

Could you please tell what I missed? What (else) should be done in order to run hooks?

Thanks in advance,


[1] http://libvirt.org/hooks.html

More information about the libvir-list mailing list