Hi, My vdsm hook is now invoked.
Up to me to debug it. Thanks a lot. J.P. -----Message d'origine----- De : users-boun...@ovirt.org [mailto:users-boun...@ovirt.org] De la part de users-requ...@ovirt.org Envoyé : mardi 12 janvier 2016 17:04 À : users@ovirt.org Objet : Users Digest, Vol 52, Issue 72 Send Users mailing list submissions to users@ovirt.org To subscribe or unsubscribe via the World Wide Web, visit http://lists.ovirt.org/mailman/listinfo/users or, via email, send a message with subject or body 'help' to users-requ...@ovirt.org You can reach the person managing the list at users-ow...@ovirt.org When replying, please edit your Subject line so it is more specific than "Re: Contents of Users digest..." Today's Topics: 1. Re: vdsm hook issues (Dan Yasny) ---------------------------------------------------------------------- Message: 1 Date: Tue, 12 Jan 2016 11:03:34 -0500 From: Dan Yasny <dya...@gmail.com> To: Jean-Pierre Ribeauville <jpribeauvi...@axway.com> Cc: "users@ovirt.org" <users@ovirt.org> Subject: Re: [ovirt-users] vdsm hook issues Message-ID: <callxwb4_hxrq8ziqfh+mu8cdwr6enjxbr7egmdfw0pihak3...@mail.gmail.com> Content-Type: text/plain; charset="utf-8" yup. Now add the sys.stderr.write line somewhere, with a marker you can grep for, and try, then check the vdsm.log file for the marker. I'd also add an external log dump for the development testing, and comment it out before going into production On Tue, Jan 12, 2016 at 11:02 AM, Jean-Pierre Ribeauville < jpribeauvi...@axway.com> wrote: > Hi, > > > > 173078 4 -rwxrwxrwx. 1 vdsm kvm 1292 Jan 12 15:51 test_hook.py > > > > > > Looks fine , isn?t ? > > > > J.P. > > > > *De :* Dan Yasny [mailto:dya...@gmail.com] *Envoy? :* mardi 12 janvier > 2016 17:00 > > *? :* Jean-Pierre Ribeauville > *Cc :* users@ovirt.org > *Objet :* Re: [ovirt-users] vdsm hook issues > > > > So, to make is work, you need to chown 36:36 and chmod +x for 36:36 of > course. > > > > As for logging, since the hook is run under the vdsm context, you can > tap right into the logging of vdsm, or you can write your own log > file, whatever you prefer to code. > > > > See > https://github.com/oVirt/vdsm/blob/master/vdsm_hooks/vmfex/before_vm_s > tart.py line 197 - sys.stderr.write will actually dump into the vdsm > log. > > > > On Tue, Jan 12, 2016 at 10:55 AM, Jean-Pierre Ribeauville < > jpribeauvi...@axway.com> wrote: > > Hi, > > > > /usr/share/vdsm/hooking.py is present on my host. > > > > I placed my test_hook.py in /usr/libexec/vdsm/hooks/before_vm_start > > > > As I want to have it invoked for every started VM , I don?t need > custom property ; Am I right ? > > > > Remains the point ?make it accessible to vdsm:kvm? what do you mean ? > > > > BTW , are vdsm hooks log infos located in /var/log/vdsm/vdsm.log ? > > > > Thx for help. > > > > J.P. > > > > *De :* Dan Yasny [mailto:dya...@gmail.com] *Envoy? :* mardi 12 janvier > 2016 16:48 > > > *? :* Jean-Pierre Ribeauville > *Cc :* users@ovirt.org > *Objet :* Re: [ovirt-users] vdsm hook issues > > > > OK, so the hooking module is included in the vdsm package itself. > Please make sure you have /usr/share/vdsm/hooking.py on the host. > > > > The manual run fails, because it is not running in the vdsm context, > and so the modules imported are the python site-packages and not the > submodules under vdsm. > > > > To make a hook work, you need to place it on the host, make it > accessible to vdsm:kvm, and maybe define a custom property, if you > don't want the hook to just run on every started VM. > > > > On Tue, Jan 12, 2016 at 10:35 AM, Jean-Pierre Ribeauville < > jpribeauvi...@axway.com> wrote: > > Hi, > > > > 1? It?s a full RHEL7 OS. > 2? > vdsm-python-zombiereaper-4.16.27-0.el7.centos.noarch > > vdsm-python-4.16.27-0.el7.centos.noarch > > vdsm-yajsonrpc-4.16.27-0.el7.centos.noarch > > vdsm-xmlrpc-4.16.27-0.el7.centos.noarch > > vdsm-cli-4.16.27-0.el7.centos.noarch > > vdsm-jsonrpc-java-1.0.15-1.el7.noarch > > vdsm-jsonrpc-4.16.27-0.el7.centos.noarch > > vdsm-4.16.27-0.el7.centos.x86_64 > > 3? > > #!/usr/bin/python > > 1) > > 2) import os > > 3) import sys > > 4) import grp > > 5) import pwd > > 6) import traceback > > 7) > > 8) import hooking > > 9) > > 10) def createChannelElement(domxml): > > 11) ''' > > 12) <channel type='unix'> > > 13) <source mode='bind' > path='//var/lib/libvirt/qemu/VM_RHEL7-1_omnivision_1.agent'/> > > 14) <target type='virtio' name='omnivision_1.agent'/> > > 15) </channel> > > 16) ''' > > 17) > > 18) channel = domxml.createElement('channel') > > 19) disk.setAttribute('type', 'unix') > > 20) > > 21) source = domxml.createElement('source') > > 22) source.setAttribute('mode', 'bind') > > 23) > > 24) # find domain name > > 25) domainame = domxml.getElementsByTagName('name') > > 26) > > 27) source.setAttribute('path', '//var/lib/libvirt/qemu/' + > domainame + '_omnivision_1.agent') > > 28) disk.appendChild(source) > > 29) > > 30) target = domxml.createElement('target') > > 31) target.setAttribute('type', 'virtio') > > 32) target.setAttribute('name', 'omnivision_1.agent') > > 33) disk.appendChild(target) > > 34) > > 35) return channel > > 36) > > 37) try: > > 38) domxml = hooking.read_domxml() > > 39) devices = domxml.getElementsByTagName('devices')[0] > > 40) channeldev = createChannelElement(domxml) > > 41) sys.stderr.write('createChannel: adding xml: %s\n' % > channeldev.toxml()) > > 42) devices.appendChild(channeldev) > > 43) > > 44) hooking.write_domxml(domxml) > > 45) except: > > 46) sys.stderr.write('createChannel: [unexpected error]: %s\n' % > > 47) traceback.format_exc()) > > 48) sys.exit(2) > > > > > > > > Thx for help. > > > > Regards, > > > > J.P. > > > > > > *De :* Dan Yasny [mailto:dya...@gmail.com] *Envoy? :* mardi 12 janvier > 2016 16:23 *? :* Jean-Pierre Ribeauville *Cc :* users@ovirt.org *Objet > :* Re: [ovirt-users] vdsm hook issues > > > > 1. Are you using a full OS or a node? > > 2. rpm -qa |grep vdsm > > 3. if possible, post the hook code > > > > Thanks > > > > On Tue, Jan 12, 2016 at 10:17 AM, Jean-Pierre Ribeauville < > jpribeauvi...@axway.com> wrote: > > > > Hi, > > > > 1) is it enough to add a hook.py in > /usr/libexec/vdsm/hooks/before_vm_start directory , and then shut down and > reboot a guest to > > see this hook.py invoked ? > > > > 2) when running manually my hook.py, I got following error : > > ImportError: No module named hooking > > > > Do I have to install anything to solve this issue ? > > > > Thanks for help. > > > > > > Regards, > > > > > > > > *J.P. Ribeauville* > > > > P: +33.(0).1.47.17.20.49 > > . > > Puteaux 3 Etage 5 Bureau 4 > > > > *jpribeauvi...@axway.com <jpribeauvi...@axway.com>* > http://www.axway.com > > > > > > P Pensez ? l?environnement avant d?imprimer. > > > > > > > _______________________________________________ > Users mailing list > Users@ovirt.org > http://lists.ovirt.org/mailman/listinfo/users > > > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.ovirt.org/pipermail/users/attachments/20160112/45a10a2a/attachment.html> ------------------------------ _______________________________________________ Users mailing list Users@ovirt.org http://lists.ovirt.org/mailman/listinfo/users End of Users Digest, Vol 52, Issue 72 ************************************* _______________________________________________ Users mailing list Users@ovirt.org http://lists.ovirt.org/mailman/listinfo/users