[libvirt] qemu hook is not starting

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 #!/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? Thanks in advance, Gyula --- [1] http://libvirt.org/hooks.html

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@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/

Hi! Thank you very much for your response! It was the version... you pointed at. I was testing on my home coputer... that is on Ubuntu it has libvirt v.0.7. Fortunately our real environment (Debian) has libvirt v.0.8. Cheers, Gyula ________________________________________ Feladó: Daniel Veillard [veillard@redhat.com] Küldve: 2010. július 8. 22:01 Címzett: Csom Gyula Másolatot kap: libvir-list@redhat.com Tárgy: Re: [libvirt] qemu hook is not starting 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@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/
participants (2)
-
Csom Gyula
-
Daniel Veillard