Re: [ovirt-users] Users Digest, Vol 52, Issue 72 vdsm hook issues

2016-01-12 Thread Jean-Pierre Ribeauville
Hi,

What I did from the beginning of this affair :


1)  Chown and chmod of  myhook.py


2)  Don’t try to run it from shell


3)  Up to now,  I may avoid to play with custom properties.
( BTW,  do you know how , within myhook.py , one may retrieve this custom 
property
   that will indicate if the hook has to be go further or must exist without 
doing anything ?)

What’s remaining :

1) debug the .py
2) check wether, by migrating the Guest , the hook is also called on the target 
host  ( maybe you know the answer ?)

That’s all.

Regards,

J.P.

De : Gianluca Cecchi [mailto:gianluca.cec...@gmail.com]
Envoyé : mardi 12 janvier 2016 19:42
À : Jean-Pierre Ribeauville
Cc : users@ovirt.org
Objet : Re: [ovirt-users] Users Digest, Vol 52, Issue 72 vdsm hook issues

On Tue, Jan 12, 2016 at 5:32 PM, Jean-Pierre Ribeauville 
<jpribeauvi...@axway.com<mailto:jpribeauvi...@axway.com>> wrote:
Hi,

My vdsm hook is now invoked.

Up to me to debug it.

Thanks a lot.

J.P.


I don't understand at the end what you had to change: from your previous 
messages it resulted that all things requested were in place already
Thanks,
Gianluca
___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [ovirt-users] Users Digest, Vol 52, Issue 72 vdsm hook issues

2016-01-12 Thread Jean-Pierre Ribeauville
Perfect.

Thanks.

De : Dan Yasny [mailto:dya...@gmail.com]
Envoyé : mardi 12 janvier 2016 20:51
À : Jean-Pierre Ribeauville
Cc : Gianluca Cecchi; users@ovirt.org
Objet : Re: [ovirt-users] Users Digest, Vol 52, Issue 72 vdsm hook issues



On Tue, Jan 12, 2016 at 2:35 PM, Jean-Pierre Ribeauville 
<jpribeauvi...@axway.com<mailto:jpribeauvi...@axway.com>> wrote:
Hi,

What I did from the beginning of this affair :


1)  Chown and chmod of  myhook.py

2)  Don’t try to run it from shell

3)  Up to now,  I may avoid to play with custom properties.
( BTW,  do you know how , within myhook.py , one may retrieve this custom 
property
   that will indicate if the hook has to be go further or must exist without 
doing anything ?)


This is documented on the hooks wiki page and in github. The basic idea is to 
add a custom property to a VM with specific text, and check for it in the hook. 
If you detect it, apply hook to VM, if not - pass

What’s remaining :

1) debug the .py
2) check wether, by migrating the Guest , the hook is also called on the target 
host  ( maybe you know the answer ?)

before_vm_migrate_source and before_vm_migrate_destination - also documented in 
the wiki.

Generally, just follow an existing hook, it should have everything


That’s all.

Regards,

J.P.

De : Gianluca Cecchi 
[mailto:gianluca.cec...@gmail.com<mailto:gianluca.cec...@gmail.com>]
Envoyé : mardi 12 janvier 2016 19:42
À : Jean-Pierre Ribeauville
Cc : users@ovirt.org<mailto:users@ovirt.org>
Objet : Re: [ovirt-users] Users Digest, Vol 52, Issue 72 vdsm hook issues

On Tue, Jan 12, 2016 at 5:32 PM, Jean-Pierre Ribeauville 
<jpribeauvi...@axway.com<mailto:jpribeauvi...@axway.com>> wrote:
Hi,

My vdsm hook is now invoked.

Up to me to debug it.

Thanks a lot.

J.P.

I don't understand at the end what you had to change: from your previous 
messages it resulted that all things requested were in place already
Thanks,
Gianluca

___
Users mailing list
Users@ovirt.org<mailto:Users@ovirt.org>
http://lists.ovirt.org/mailman/listinfo/users

___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [ovirt-users] Users Digest, Vol 52, Issue 72 vdsm hook issues

2016-01-12 Thread Gianluca Cecchi
On Tue, Jan 12, 2016 at 5:32 PM, Jean-Pierre Ribeauville <
jpribeauvi...@axway.com> wrote:

> Hi,
>
> My vdsm hook is now invoked.
>
> Up to me to debug it.
>
> Thanks a lot.
>
> J.P.
>
>
>
I don't understand at the end what you had to change: from your previous
messages it resulted that all things requested were in place already
Thanks,
Gianluca
___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [ovirt-users] Users Digest, Vol 52, Issue 72 vdsm hook issues

2016-01-12 Thread Dan Yasny
On Tue, Jan 12, 2016 at 2:35 PM, Jean-Pierre Ribeauville <
jpribeauvi...@axway.com> wrote:

> Hi,
>
>
>
> What I did from the beginning of this affair :
>
>
>
> 1)  Chown and chmod of  myhook.py
>
> 2)  Don’t try to run it from shell
>
> 3)  Up to now,  I may avoid to play with custom properties.
> ( BTW,  do you know how , within myhook.py , one may retrieve this custom
> property
>that will indicate if the hook has to be go further or must exist
> without doing anything ?)
>
>
>
This is documented on the hooks wiki page and in github. The basic idea is
to add a custom property to a VM with specific text, and check for it in
the hook. If you detect it, apply hook to VM, if not - pass


> What’s remaining :
>
> 1) debug the .py
>
> 2) check wether, by migrating the Guest , the hook is also called on the
> target host  ( maybe you know the answer ?)
>

before_vm_migrate_source and before_vm_migrate_destination - also
documented in the wiki.

Generally, just follow an existing hook, it should have everything


>
>
> That’s all.
>
>
>
> Regards,
>
>
>
> J.P.
>
>
>
> *De :* Gianluca Cecchi [mailto:gianluca.cec...@gmail.com]
> *Envoyé :* mardi 12 janvier 2016 19:42
> *À :* Jean-Pierre Ribeauville
> *Cc :* users@ovirt.org
> *Objet :* Re: [ovirt-users] Users Digest, Vol 52, Issue 72 vdsm hook
> issues
>
>
>
> On Tue, Jan 12, 2016 at 5:32 PM, Jean-Pierre Ribeauville <
> jpribeauvi...@axway.com> wrote:
>
> Hi,
>
> My vdsm hook is now invoked.
>
> Up to me to debug it.
>
> Thanks a lot.
>
> J.P.
>
>
>
> I don't understand at the end what you had to change: from your previous
> messages it resulted that all things requested were in place already
>
> Thanks,
>
> Gianluca
>
> ___
> Users mailing list
> Users@ovirt.org
> http://lists.ovirt.org/mailman/listinfo/users
>
>
___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [ovirt-users] Users Digest, Vol 52, Issue 72 vdsm hook issues

2016-01-12 Thread Jean-Pierre Ribeauville
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 
To: Jean-Pierre Ribeauville 
Cc: "users@ovirt.org" 
Subject: Re: [ovirt-users] vdsm hook issues
Message-ID:

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)   
>
> 13)  path='//var/lib/libvirt/qemu/VM_RHEL7-1_omnivision_1.agent'/>
>
> 14) 
>
> 15)   
>
> 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)