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

Ramesh Nachimuthu rnachimu at redhat.com
Tue Nov 29 13:26:08 UTC 2016


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: <err> = 'Traceback (most recent call last):\n  File "/sbin/gluster-eventsapi", line 25, in <module>\n    from gluster.cliutils.cliutils import (Cmd, execute, node_output_ok, node_output_notok,\nImportError: No module named cliutils.cliutils\n'; <rc> = 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


Regards,
Ramesh



More information about the Devel mailing list