[libvirt] qemu hook is not starting

Daniel Veillard veillard at redhat.com
Thu Jul 8 20:01:27 UTC 2010


On Thu, Jul 08, 2010 at 06:49:25PM +0000, Csom Gyula wrote:
> 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

  it's hooks and make it a directory !

> 3. create the hook script
> 
> # vi /etc/libvirt/hook/qemu
> # cat /etc/libvirt/hook/qemu
> 
> #!/bin/bash
> 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?

  Can you double check libvirt daemon output ?
Also make sure your version is recent. It was added to libvirt in 0.8.0
so anything older won't have it and ignore yout scripts,

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel at veillard.com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/




More information about the libvir-list mailing list