Re: [ovirt-devel] python path conflicts issues while running python scripts from vdsm verbs

2016-12-02 Thread Nir Soffer
בתאריך 2 בדצמ׳ 2016 10:04 לפנה״צ,‏ "Dan Kenigsberg"  כתב:

On Thu, Dec 01, 2016 at 11:32:07PM -0500, Ramesh Nachimuthu wrote:
> Thank you all for helping me in this issue. Finally vdsm.gluster
> modules are moved python site-packages.
>

Yay!

There's a bit more work to be done:
https://travis-ci.org/oVirt/vdsm/jobs/180630800 is failing since its
docker images do not yet include python-magic and python-blivet.

Nir, would you take https://gerrit.ovirt.org/#/c/67727/ and rebuild them?



Sure, thanks.
___
Devel mailing list
Devel@ovirt.org
http://lists.ovirt.org/mailman/listinfo/devel

Re: [ovirt-devel] python path conflicts issues while running python scripts from vdsm verbs

2016-12-02 Thread Dan Kenigsberg
On Thu, Dec 01, 2016 at 11:32:07PM -0500, Ramesh Nachimuthu wrote:
> Thank you all for helping me in this issue. Finally vdsm.gluster
> modules are moved python site-packages. 
> 

Yay!

There's a bit more work to be done:
https://travis-ci.org/oVirt/vdsm/jobs/180630800 is failing since its
docker images do not yet include python-magic and python-blivet.

Nir, would you take https://gerrit.ovirt.org/#/c/67727/ and rebuild them?
___
Devel mailing list
Devel@ovirt.org
http://lists.ovirt.org/mailman/listinfo/devel


Re: [ovirt-devel] python path conflicts issues while running python scripts from vdsm verbs

2016-12-01 Thread Dan Kenigsberg
On Thu, Dec 01, 2016 at 03:38:36AM -0500, Ramesh Nachimuthu wrote:
> 
> 
> 
> 
> - Original Message -
> > From: "Dan Kenigsberg" 
> > To: "Ramesh Nachimuthu" 
> > Cc: "Aravinda" , igoih...@redhat.com, "Nir Soffer" 
> > , "devel"
> > , "Piotr Kliczewski" , "Yaniv 
> > Bronheim" , "Sahina Bose"
> > 
> > Sent: Wednesday, November 30, 2016 4:54:59 PM
> > Subject: Re: python path conflicts issues while running python scripts from 
> > vdsm verbs
> > 
> > On Wed, Nov 30, 2016 at 03:49:02AM -0500, Ramesh Nachimuthu wrote:
> > > 
> > > 
> > > 
> > > 
> > > - Original Message -
> > > > From: "Dan Kenigsberg" 
> > > > To: "Aravinda" , igoih...@redhat.com
> > > > Cc: "Ramesh Nachimuthu" , "Nir Soffer"
> > > > , "devel" , "Piotr
> > > > Kliczewski" , "Yaniv Bronheim"
> > > > , "Sahina Bose" 
> > > > Sent: Wednesday, November 30, 2016 2:02:43 PM
> > > > Subject: Re: python path conflicts issues while running python scripts
> > > > from vdsm verbs
> > > > 
> > > > 
> > > > Regardless of the solution you plan to take, let it serve as a reminder
> > > > about moving gluster bits out of /usr/share/vdsm/ and into
> > > > site-packages. I am willing to pay the price of an ugly
> > > > exception-handling in xmlrpc, if this is the cost.
> > > 
> > > Yes. I think this is the right time to revive the patch
> > > https://gerrit.ovirt.org/#/c/57530/ and
> > > https://gerrit.ovirt.org/#/c/57524/ to move all the gluster code to
> > > site-packages. Let me re-post these packages for review.
> > 
> > Please do.
> > 
> > IIRC https://gerrit.ovirt.org/#/c/57530/9 is broken in xmlrpc.
> > 
> > Since xmlrpc is going to be used only by the command line in 4.1, I'd be
> > pleased to see the problem solved via a simplistic hack.
> > 
> 
> 
> I have updated the patch https://gerrit.ovirt.org/#/c/57530/ for moving 
> vdsm/gluster into  site-packages. I took the patch 
> https://gerrit.ovirt.org/#/c/57524/ as an workaround to solve the ClientIF 
> issue. 
> 
> Dan: Please let me know if you have any simple fix for clientIF issue.

Thanks. I think that the approach of your
https://gerrit.ovirt.org/#/c/67660/ is much better.
___
Devel mailing list
Devel@ovirt.org
http://lists.ovirt.org/mailman/listinfo/devel


Re: [ovirt-devel] python path conflicts issues while running python scripts from vdsm verbs

2016-12-01 Thread Ramesh Nachimuthu




- Original Message -
> From: "Dan Kenigsberg" 
> To: "Ramesh Nachimuthu" 
> Cc: "Aravinda" , igoih...@redhat.com, "Nir Soffer" 
> , "devel"
> , "Piotr Kliczewski" , "Yaniv Bronheim" 
> , "Sahina Bose"
> 
> Sent: Wednesday, November 30, 2016 4:54:59 PM
> Subject: Re: python path conflicts issues while running python scripts from 
> vdsm verbs
> 
> On Wed, Nov 30, 2016 at 03:49:02AM -0500, Ramesh Nachimuthu wrote:
> > 
> > 
> > 
> > 
> > - Original Message -
> > > From: "Dan Kenigsberg" 
> > > To: "Aravinda" , igoih...@redhat.com
> > > Cc: "Ramesh Nachimuthu" , "Nir Soffer"
> > > , "devel" , "Piotr
> > > Kliczewski" , "Yaniv Bronheim"
> > > , "Sahina Bose" 
> > > Sent: Wednesday, November 30, 2016 2:02:43 PM
> > > Subject: Re: python path conflicts issues while running python scripts
> > > from vdsm verbs
> > > 
> > > 
> > > Regardless of the solution you plan to take, let it serve as a reminder
> > > about moving gluster bits out of /usr/share/vdsm/ and into
> > > site-packages. I am willing to pay the price of an ugly
> > > exception-handling in xmlrpc, if this is the cost.
> > 
> > Yes. I think this is the right time to revive the patch
> > https://gerrit.ovirt.org/#/c/57530/ and
> > https://gerrit.ovirt.org/#/c/57524/ to move all the gluster code to
> > site-packages. Let me re-post these packages for review.
> 
> Please do.
> 
> IIRC https://gerrit.ovirt.org/#/c/57530/9 is broken in xmlrpc.
> 
> Since xmlrpc is going to be used only by the command line in 4.1, I'd be
> pleased to see the problem solved via a simplistic hack.
> 


I have updated the patch https://gerrit.ovirt.org/#/c/57530/ for moving 
vdsm/gluster into  site-packages. I took the patch 
https://gerrit.ovirt.org/#/c/57524/ as an workaround to solve the ClientIF 
issue. 

Dan: Please let me know if you have any simple fix for clientIF issue.

Regards,
Ramesh
___
Devel mailing list
Devel@ovirt.org
http://lists.ovirt.org/mailman/listinfo/devel


Re: [ovirt-devel] python path conflicts issues while running python scripts from vdsm verbs

2016-11-30 Thread Aravinda

If vdsm setting PYTHONPATH as below

export PYTHONPATH=/usr/share/vdsm:$PYTHONPATH

change it as

export PYTHONPATH=$PYTHONPATH:/usr/share/vdsm

With this change, /usr/share/vdsm will not get first preference compared 
to /usr/lib*/python2.7/site-packages


regards
Aravinda

On 11/30/2016 10:25 AM, Ramesh Nachimuthu wrote:




- Original Message -

From: "Nir Soffer" 
To: "Ramesh Nachimuthu" 
Cc: "devel" , "Dan Kenigsberg" , "Piotr Kliczewski" 
, "Yaniv
Bronheim" , "Aravinda Vishwanathapura Krishna Murthy" 
, "Sahina Bose"

Sent: Tuesday, November 29, 2016 7:20:57 PM
Subject: Re: python path conflicts issues while running python scripts from 
vdsm verbs

On Tue, Nov 29, 2016 at 3:26 PM, Ramesh Nachimuthu 
wrote:

Hi,

  I am trying to run a python script '/sbin/gluster-eventsapi' in vdsm verb
  which internally imports some python modules from
  /usr/lib/python2.7/site-packages/gluster/cliutils/. But it fails with the
  import error. Following error is seen in the supervdsm log.


MainProcess|Thread-1::DEBUG::2016-11-28
16:54:35,130::commands::93::root::(execCmd) FAILED:  = 'Traceback
(most recent call last):\n  File "/sbin/gluster-eventsapi", line 25, in
\nfrom gluster.cliutils.cliutils import (Cmd, execute,
node_output_ok, node_output_notok,\nImportError: No module named
cliutils.cliutils\n';  = 1


I think the import statement "from gluster.cliutils.cliutils import (Cmd,
execute, node_output_ok, node_output_notok)" in the python script resolves
to '/usr/share/vdsm/gluster' instead of
/usr/lib/python2.7/site-packages/gluster/cliutils.

I see the following in python sys.path while executing a python script from
vdsm.

['/usr/libexec/glusterfs', '/usr/share/vdsm', '/usr/lib64/python27.zip',
'/usr/lib64/python2.7', '/usr/lib64/python2.7/plat-linux2',
'/usr/lib64/python2.7/lib-tk', '/usr/lib64/python2.7/lib-old',
'/usr/lib64/python2.7/lib-dynload', '/usr/lib64/python2.7/site-packages',
'/usr/lib64/python2.7/site-packages/gtk-2.0',
'/usr/lib/python2.7/site-packages']

Looks like '/usr/share/vdsm' take precedence over
'/usr/lib64/python2.7/site-packages'.

Can someone suggests a way to fix this issue?

Note: '/sbin/gluster-eventsapi' works perfectly while running directly from
CLI.

Related vdsm patch:
https://gerrit.ovirt.org/#/c/67168/2/vdsm/gluster/events.py

If an import fails because /usr/share/vdsm/foo hides a package in
/usr/lib/python2.7/site-packages/vdsm it means that you have a wrong
import, you need to import anything like this:

 from vdsm.foo import bar

So names in /usr/share/vdsm/* cannot hide names in vdsm package.


Here its a different case. Some external python script (which I am trying to 
run from vdsm verb) is trying to import some gluster package from 
/usr/lib/python2.7/site-packages/gluster. But it is conflicting with gluster 
modules under /usr/share/vdsm/gluster

Python Script which I am trying to run: 
https://github.com/gluster/glusterfs/blob/master/events/src/peer_eventsapi.py

Regards,
Ramesh


Nir



___
Devel mailing list
Devel@ovirt.org
http://lists.ovirt.org/mailman/listinfo/devel


Re: [ovirt-devel] python path conflicts issues while running python scripts from vdsm verbs

2016-11-30 Thread Dan Kenigsberg
On Wed, Nov 30, 2016 at 03:49:02AM -0500, Ramesh Nachimuthu wrote:
> 
> 
> 
> 
> - Original Message -
> > From: "Dan Kenigsberg" 
> > To: "Aravinda" , igoih...@redhat.com
> > Cc: "Ramesh Nachimuthu" , "Nir Soffer" 
> > , "devel" , "Piotr
> > Kliczewski" , "Yaniv Bronheim" , 
> > "Sahina Bose" 
> > Sent: Wednesday, November 30, 2016 2:02:43 PM
> > Subject: Re: python path conflicts issues while running python scripts from 
> > vdsm verbs
> > 
> > 
> > Regardless of the solution you plan to take, let it serve as a reminder
> > about moving gluster bits out of /usr/share/vdsm/ and into
> > site-packages. I am willing to pay the price of an ugly
> > exception-handling in xmlrpc, if this is the cost.
> 
> Yes. I think this is the right time to revive the patch 
> https://gerrit.ovirt.org/#/c/57530/ and https://gerrit.ovirt.org/#/c/57524/ 
> to move all the gluster code to site-packages. Let me re-post these packages 
> for review.

Please do.

IIRC https://gerrit.ovirt.org/#/c/57530/9 is broken in xmlrpc.

Since xmlrpc is going to be used only by the command line in 4.1, I'd be
pleased to see the problem solved via a simplistic hack.
___
Devel mailing list
Devel@ovirt.org
http://lists.ovirt.org/mailman/listinfo/devel


Re: [ovirt-devel] python path conflicts issues while running python scripts from vdsm verbs

2016-11-30 Thread Ramesh Nachimuthu




- Original Message -
> From: "Dan Kenigsberg" 
> To: "Aravinda" , igoih...@redhat.com
> Cc: "Ramesh Nachimuthu" , "Nir Soffer" 
> , "devel" , "Piotr
> Kliczewski" , "Yaniv Bronheim" , 
> "Sahina Bose" 
> Sent: Wednesday, November 30, 2016 2:02:43 PM
> Subject: Re: python path conflicts issues while running python scripts from 
> vdsm verbs
> 
> 
> Regardless of the solution you plan to take, let it serve as a reminder
> about moving gluster bits out of /usr/share/vdsm/ and into
> site-packages. I am willing to pay the price of an ugly
> exception-handling in xmlrpc, if this is the cost.

Yes. I think this is the right time to revive the patch 
https://gerrit.ovirt.org/#/c/57530/ and https://gerrit.ovirt.org/#/c/57524/ to 
move all the gluster code to site-packages. Let me re-post these packages for 
review.

Regards,
Ramesh

> 
> On Wed, Nov 30, 2016 at 11:27:06AM +0530, Aravinda wrote:
> > If vdsm setting PYTHONPATH as below
> > 
> > export PYTHONPATH=/usr/share/vdsm:$PYTHONPATH
> > 
> > change it as
> > 
> > export PYTHONPATH=$PYTHONPATH:/usr/share/vdsm
> > 
> > With this change, /usr/share/vdsm will not get first preference compared to
> > /usr/lib*/python2.7/site-packages
> > 
> > regards
> > Aravinda
> > 
> > On 11/30/2016 10:25 AM, Ramesh Nachimuthu wrote:
> > > 
> > > 
> > > 
> > > - Original Message -
> > > > From: "Nir Soffer" 
> > > > To: "Ramesh Nachimuthu" 
> > > > Cc: "devel" , "Dan Kenigsberg" ,
> > > > "Piotr Kliczewski" , "Yaniv
> > > > Bronheim" , "Aravinda Vishwanathapura Krishna
> > > > Murthy" , "Sahina Bose"
> > > > 
> > > > Sent: Tuesday, November 29, 2016 7:20:57 PM
> > > > Subject: Re: python path conflicts issues while running python scripts
> > > > from vdsm verbs
> > > > 
> > > > On Tue, Nov 29, 2016 at 3:26 PM, Ramesh Nachimuthu
> > > > 
> > > > wrote:
> > > > > Hi,
> > > > > 
> > > > >   I am trying to run a python script '/sbin/gluster-eventsapi' in
> > > > >   vdsm verb
> > > > >   which internally imports some python modules from
> > > > >   /usr/lib/python2.7/site-packages/gluster/cliutils/. But it fails
> > > > >   with the
> > > > >   import error. Following error is seen in the supervdsm log.
> > > > > 
> > > > > 
> > > > > MainProcess|Thread-1::DEBUG::2016-11-28
> > > > > 16:54:35,130::commands::93::root::(execCmd) FAILED:  =
> > > > > 'Traceback
> > > > > (most recent call last):\n  File "/sbin/gluster-eventsapi", line 25,
> > > > > in
> > > > > \nfrom gluster.cliutils.cliutils import (Cmd, execute,
> > > > > node_output_ok, node_output_notok,\nImportError: No module named
> > > > > cliutils.cliutils\n';  = 1
> > > > > 
> > > > > 
> > > > > I think the import statement "from gluster.cliutils.cliutils import
> > > > > (Cmd,
> > > > > execute, node_output_ok, node_output_notok)" in the python script
> > > > > resolves
> > > > > to '/usr/share/vdsm/gluster' instead of
> > > > > /usr/lib/python2.7/site-packages/gluster/cliutils.
> > > > > 
> > > > > I see the following in python sys.path while executing a python
> > > > > script from
> > > > > vdsm.
> > > > > 
> > > > > ['/usr/libexec/glusterfs', '/usr/share/vdsm',
> > > > > '/usr/lib64/python27.zip',
> > > > > '/usr/lib64/python2.7', '/usr/lib64/python2.7/plat-linux2',
> > > > > '/usr/lib64/python2.7/lib-tk', '/usr/lib64/python2.7/lib-old',
> > > > > '/usr/lib64/python2.7/lib-dynload',
> > > > > '/usr/lib64/python2.7/site-packages',
> > > > > '/usr/lib64/python2.7/site-packages/gtk-2.0',
> > > > > '/usr/lib/python2.7/site-packages']
> > > > > 
> > > > > Looks like '/usr/share/vdsm' take precedence over
> > > > > '/usr/lib64/python2.7/site-packages'.
> > > > > 
> > > > > Can someone suggests a way to fix this issue?
> > > > > 
> > > > > Note: '/sbin/gluster-eventsapi' works perfectly while running
> > > > > directly from
> > > > > CLI.
> > > > > 
> > > > > Related vdsm patch:
> > > > > https://gerrit.ovirt.org/#/c/67168/2/vdsm/gluster/events.py
> > > > If an import fails because /usr/share/vdsm/foo hides a package in
> > > > /usr/lib/python2.7/site-packages/vdsm it means that you have a wrong
> > > > import, you need to import anything like this:
> > > > 
> > > >  from vdsm.foo import bar
> > > > 
> > > > So names in /usr/share/vdsm/* cannot hide names in vdsm package.
> > > > 
> > > Here its a different case. Some external python script (which I am trying
> > > to run from vdsm verb) is trying to import some gluster package from
> > > /usr/lib/python2.7/site-packages/gluster. But it is conflicting with
> > > gluster modules under /usr/share/vdsm/gluster
> > > 
> > > Python Script which I am trying to run:
> > > 

Re: [ovirt-devel] python path conflicts issues while running python scripts from vdsm verbs

2016-11-30 Thread Dan Kenigsberg

Regardless of the solution you plan to take, let it serve as a reminder
about moving gluster bits out of /usr/share/vdsm/ and into
site-packages. I am willing to pay the price of an ugly
exception-handling in xmlrpc, if this is the cost.

On Wed, Nov 30, 2016 at 11:27:06AM +0530, Aravinda wrote:
> If vdsm setting PYTHONPATH as below
> 
> export PYTHONPATH=/usr/share/vdsm:$PYTHONPATH
> 
> change it as
> 
> export PYTHONPATH=$PYTHONPATH:/usr/share/vdsm
> 
> With this change, /usr/share/vdsm will not get first preference compared to
> /usr/lib*/python2.7/site-packages
> 
> regards
> Aravinda
> 
> On 11/30/2016 10:25 AM, Ramesh Nachimuthu wrote:
> > 
> > 
> > 
> > - Original Message -
> > > From: "Nir Soffer" 
> > > To: "Ramesh Nachimuthu" 
> > > Cc: "devel" , "Dan Kenigsberg" , 
> > > "Piotr Kliczewski" , "Yaniv
> > > Bronheim" , "Aravinda Vishwanathapura Krishna 
> > > Murthy" , "Sahina Bose"
> > > 
> > > Sent: Tuesday, November 29, 2016 7:20:57 PM
> > > Subject: Re: python path conflicts issues while running python scripts 
> > > from vdsm verbs
> > > 
> > > On Tue, Nov 29, 2016 at 3:26 PM, Ramesh Nachimuthu 
> > > wrote:
> > > > Hi,
> > > > 
> > > >   I am trying to run a python script '/sbin/gluster-eventsapi' in vdsm 
> > > > verb
> > > >   which internally imports some python modules from
> > > >   /usr/lib/python2.7/site-packages/gluster/cliutils/. But it fails with 
> > > > the
> > > >   import error. Following error is seen in the supervdsm log.
> > > > 
> > > > 
> > > > MainProcess|Thread-1::DEBUG::2016-11-28
> > > > 16:54:35,130::commands::93::root::(execCmd) FAILED:  = 'Traceback
> > > > (most recent call last):\n  File "/sbin/gluster-eventsapi", line 25, in
> > > > \nfrom gluster.cliutils.cliutils import (Cmd, execute,
> > > > node_output_ok, node_output_notok,\nImportError: No module named
> > > > cliutils.cliutils\n';  = 1
> > > > 
> > > > 
> > > > I think the import statement "from gluster.cliutils.cliutils import 
> > > > (Cmd,
> > > > execute, node_output_ok, node_output_notok)" in the python script 
> > > > resolves
> > > > to '/usr/share/vdsm/gluster' instead of
> > > > /usr/lib/python2.7/site-packages/gluster/cliutils.
> > > > 
> > > > I see the following in python sys.path while executing a python script 
> > > > from
> > > > vdsm.
> > > > 
> > > > ['/usr/libexec/glusterfs', '/usr/share/vdsm', '/usr/lib64/python27.zip',
> > > > '/usr/lib64/python2.7', '/usr/lib64/python2.7/plat-linux2',
> > > > '/usr/lib64/python2.7/lib-tk', '/usr/lib64/python2.7/lib-old',
> > > > '/usr/lib64/python2.7/lib-dynload', 
> > > > '/usr/lib64/python2.7/site-packages',
> > > > '/usr/lib64/python2.7/site-packages/gtk-2.0',
> > > > '/usr/lib/python2.7/site-packages']
> > > > 
> > > > Looks like '/usr/share/vdsm' take precedence over
> > > > '/usr/lib64/python2.7/site-packages'.
> > > > 
> > > > Can someone suggests a way to fix this issue?
> > > > 
> > > > Note: '/sbin/gluster-eventsapi' works perfectly while running directly 
> > > > from
> > > > CLI.
> > > > 
> > > > Related vdsm patch:
> > > > https://gerrit.ovirt.org/#/c/67168/2/vdsm/gluster/events.py
> > > If an import fails because /usr/share/vdsm/foo hides a package in
> > > /usr/lib/python2.7/site-packages/vdsm it means that you have a wrong
> > > import, you need to import anything like this:
> > > 
> > >  from vdsm.foo import bar
> > > 
> > > So names in /usr/share/vdsm/* cannot hide names in vdsm package.
> > > 
> > Here its a different case. Some external python script (which I am trying 
> > to run from vdsm verb) is trying to import some gluster package from 
> > /usr/lib/python2.7/site-packages/gluster. But it is conflicting with 
> > gluster modules under /usr/share/vdsm/gluster
> > 
> > Python Script which I am trying to run: 
> > https://github.com/gluster/glusterfs/blob/master/events/src/peer_eventsapi.py
> > 
> > Regards,
> > Ramesh
___
Devel mailing list
Devel@ovirt.org
http://lists.ovirt.org/mailman/listinfo/devel


Re: [ovirt-devel] python path conflicts issues while running python scripts from vdsm verbs

2016-11-29 Thread Ramesh Nachimuthu




- Original Message -
> From: "Nir Soffer" 
> To: "Ramesh Nachimuthu" 
> Cc: "devel" , "Dan Kenigsberg" , "Piotr 
> Kliczewski" , "Yaniv
> Bronheim" , "Aravinda Vishwanathapura Krishna Murthy" 
> , "Sahina Bose"
> 
> Sent: Tuesday, November 29, 2016 7:20:57 PM
> Subject: Re: python path conflicts issues while running python scripts from 
> vdsm verbs
> 
> On Tue, Nov 29, 2016 at 3:26 PM, Ramesh Nachimuthu 
> wrote:
> > Hi,
> >
> >  I am trying to run a python script '/sbin/gluster-eventsapi' in vdsm verb
> >  which internally imports some python modules from
> >  /usr/lib/python2.7/site-packages/gluster/cliutils/. But it fails with the
> >  import error. Following error is seen in the supervdsm log.
> >
> >
> > MainProcess|Thread-1::DEBUG::2016-11-28
> > 16:54:35,130::commands::93::root::(execCmd) FAILED:  = 'Traceback
> > (most recent call last):\n  File "/sbin/gluster-eventsapi", line 25, in
> > \nfrom gluster.cliutils.cliutils import (Cmd, execute,
> > node_output_ok, node_output_notok,\nImportError: No module named
> > cliutils.cliutils\n';  = 1
> >
> >
> > I think the import statement "from gluster.cliutils.cliutils import (Cmd,
> > execute, node_output_ok, node_output_notok)" in the python script resolves
> > to '/usr/share/vdsm/gluster' instead of
> > /usr/lib/python2.7/site-packages/gluster/cliutils.
> >
> > I see the following in python sys.path while executing a python script from
> > vdsm.
> >
> > ['/usr/libexec/glusterfs', '/usr/share/vdsm', '/usr/lib64/python27.zip',
> > '/usr/lib64/python2.7', '/usr/lib64/python2.7/plat-linux2',
> > '/usr/lib64/python2.7/lib-tk', '/usr/lib64/python2.7/lib-old',
> > '/usr/lib64/python2.7/lib-dynload', '/usr/lib64/python2.7/site-packages',
> > '/usr/lib64/python2.7/site-packages/gtk-2.0',
> > '/usr/lib/python2.7/site-packages']
> >
> > Looks like '/usr/share/vdsm' take precedence over
> > '/usr/lib64/python2.7/site-packages'.
> >
> > Can someone suggests a way to fix this issue?
> >
> > Note: '/sbin/gluster-eventsapi' works perfectly while running directly from
> > CLI.
> >
> > Related vdsm patch:
> > https://gerrit.ovirt.org/#/c/67168/2/vdsm/gluster/events.py
> 
> If an import fails because /usr/share/vdsm/foo hides a package in
> /usr/lib/python2.7/site-packages/vdsm it means that you have a wrong
> import, you need to import anything like this:
> 
> from vdsm.foo import bar
> 
> So names in /usr/share/vdsm/* cannot hide names in vdsm package.
> 

Here its a different case. Some external python script (which I am trying to 
run from vdsm verb) is trying to import some gluster package from 
/usr/lib/python2.7/site-packages/gluster. But it is conflicting with gluster 
modules under /usr/share/vdsm/gluster

Python Script which I am trying to run: 
https://github.com/gluster/glusterfs/blob/master/events/src/peer_eventsapi.py

Regards,
Ramesh

> Nir
> 
___
Devel mailing list
Devel@ovirt.org
http://lists.ovirt.org/mailman/listinfo/devel


Re: [ovirt-devel] python path conflicts issues while running python scripts from vdsm verbs

2016-11-29 Thread Nir Soffer
On Tue, Nov 29, 2016 at 3:26 PM, Ramesh Nachimuthu  wrote:
> Hi,
>
>  I am trying to run a python script '/sbin/gluster-eventsapi' in vdsm verb 
> which internally imports some python modules from 
> /usr/lib/python2.7/site-packages/gluster/cliutils/. But it fails with the 
> import error. Following error is seen in the supervdsm log.
>
>
> MainProcess|Thread-1::DEBUG::2016-11-28 
> 16:54:35,130::commands::93::root::(execCmd) FAILED:  = 'Traceback (most 
> recent call last):\n  File "/sbin/gluster-eventsapi", line 25, in \n  
>   from gluster.cliutils.cliutils import (Cmd, execute, node_output_ok, 
> node_output_notok,\nImportError: No module named cliutils.cliutils\n';  = 
> 1
>
>
> I think the import statement "from gluster.cliutils.cliutils import (Cmd, 
> execute, node_output_ok, node_output_notok)" in the python script resolves to 
> '/usr/share/vdsm/gluster' instead of 
> /usr/lib/python2.7/site-packages/gluster/cliutils.
>
> I see the following in python sys.path while executing a python script from 
> vdsm.
>
> ['/usr/libexec/glusterfs', '/usr/share/vdsm', '/usr/lib64/python27.zip', 
> '/usr/lib64/python2.7', '/usr/lib64/python2.7/plat-linux2', 
> '/usr/lib64/python2.7/lib-tk', '/usr/lib64/python2.7/lib-old', 
> '/usr/lib64/python2.7/lib-dynload', '/usr/lib64/python2.7/site-packages', 
> '/usr/lib64/python2.7/site-packages/gtk-2.0', 
> '/usr/lib/python2.7/site-packages']
>
> Looks like '/usr/share/vdsm' take precedence over 
> '/usr/lib64/python2.7/site-packages'.
>
> Can someone suggests a way to fix this issue?
>
> Note: '/sbin/gluster-eventsapi' works perfectly while running directly from 
> CLI.
>
> Related vdsm patch: 
> https://gerrit.ovirt.org/#/c/67168/2/vdsm/gluster/events.py

If an import fails because /usr/share/vdsm/foo hides a package in
/usr/lib/python2.7/site-packages/vdsm it means that you have a wrong
import, you need to import anything like this:

from vdsm.foo import bar

So names in /usr/share/vdsm/* cannot hide names in vdsm package.

Nir
___
Devel mailing list
Devel@ovirt.org
http://lists.ovirt.org/mailman/listinfo/devel