[ovirt-devel] Debug vdsm 4.0.0 report error: libvirt: XML-RPC error : Failed to connect socket to '/var/run/libvirt/libvirt-sock': Permission denied

lifuqiong lifuqiong at cncloudsec.com
Tue Jul 26 04:08:33 EDT 2016


 

 

I do make a mistake because I just print os.getuid() show the user root; but os.geteuid() show the current user is still vdsm;

 

Anyway , I still don’t know how to debug vdsm, I cann’t log in to centos with user VDSM, because I don’t know the passwd of user vdsm and if I changed the password, the service vdsmd will cann’t start.

 

the vdsm account is intentionally disabled for interactive login






 

You told me “should follow the devel setup wiki” , what’s the true link of vdsm devel setup wiki ?  I can’t get useful information in  <http://ovirt.org/> ovirt.org or google.

 

 <http://www.ovirt.org/develop/developer-guide/vdsm/developers/> http://www.ovirt.org/develop/developer-guide/vdsm/developers/ has tips how to build from source and what packages are needed

Anything specific you’re troubleshooting?

 

         I do build the source from this instruction , but I want to set breakpoint to view each step and variable value to understand the vdsm’s code using python IDE such as Pycharm , 

 

You know that we can implement this debug requirement in ovirt engine easily, but I can’t implement local debug in vdsm easily, because vdsm didn’t allow root to run or debug.

 

Is there any debug instruction ?

 

I don’t think it’s possible to debug it from PyCharm, or any IDE for that matter, easily. 

It’s a multithreaded application, you can’t really set a breakpoint without affecting other functionality since some of the threads need to keep running

Best advice is to add a debugging/logging code in places you need, printing variables you’re interested in.

 

         I know it’s a multithreaded application , and debug vdsm is a very difficult job, but without debug, I don’t know which code I should replace or logging,   Is there any remote debug solution like ovirt engine?  I found that 

I can do remote debug in simple python application , but I didn’t success yet remote debugging vdsm. 

         

         Now one of our case I want to consider using ovirt as our solution , we may do little change over ovirt. but as described above, without debug , we can hardly understand vdsm clearly and cannot do correctly code change.

Is there some good advice ?

         

         Thank you

         Mark

Thanks,

michal





 

Thank you

Mark

 

Thanks,

michal






 

 

Thank you

 

发件人: Michal Skrivanek [ <mailto:mskrivan at redhat.com> mailto:mskrivan at redhat.com] 
发送时间: 2016年7月26日 5:00
收件人: lifuqiong
抄送: users; devel
主题: Re: [ovirt-devel] Debug vdsm 4.0.0 report error: libvirt: XML-RPC error : Failed to connect socket to '/var/run/libvirt/libvirt-sock': Permission denied

 

 


On 25 Jul 2016, at 21:50, Sandro Bonazzola < <mailto:sbonazzo at redhat.com> sbonazzo at redhat.com> wrote:

Adding some people from virt team.

Il 23/Lug/2016 11:44, "lifuqiong" < <mailto:lifuqiong at cncloudsec.com> lifuqiong at cncloudsec.com> ha scritto:
>
> I debugged vdsm with PyCharm, And I logged on my Centos 7.2 with root,  and get an error as follows:
>
>  
>
> Problem:
>
>  
>
> Traceback (most recent call last):
>
>   File "/usr/share/vdsm/vdsm", line 149, in run
>
>     serve_clients(log)
>
>   File "/usr/share/vdsm/vdsm", line 104, in serve_clients
>
>     cif = clientIF.getInstance(irs, log, scheduler)
>
>   File "/usr/share/vdsm/clientIF.py", line 204, in getInstance
>
>     cls._instance = clientIF(irs, log, scheduler)
>
>   File "/usr/share/vdsm/clientIF.py", line 106, in __init__
>
>     secret.clear()
>
>   File "/usr/lib/python2.7/site-packages/vdsm/virt/secret.py", line 92, in clear
>
>     con = libvirtconnection.get()
>
>   File "/usr/lib/python2.7/site-packages/vdsm/libvirtconnection.py", line 163, in get
>
>     password)
>
>   File "/usr/lib/python2.7/site-packages/vdsm/libvirtconnection.py", line 99, in open_connection
>
>     return utils.retry(libvirtOpen, timeout=10, sleep=0.2)
>
>   File "/usr/lib/python2.7/site-packages/vdsm/utils.py", line 546, in retry
>
>     return func()
>
>   File "/usr/lib64/python2.7/site-packages/libvirt.py", line 105, in openAuth
>
>     if ret is None:raise libvirtError('virConnectOpenAuth() failed')
>
> libvirtError: Failed to connect socket to '/var/run/libvirt/libvirt-sock': Permission denied
>
>  
>
> Investitate:
>
> According to the traceback above, the code in libvirt.py as below, and  os.geteuid() get ‘0’ which shows the current user is root;

 

vdsm is not supposed to be run under root user. For debugging you should follow the devel setup wiki and not change a regular host. 

Depends what you modified, it's impossible to say from what you described....but a general advice is you simply don't do that:)





>
>  
>
> def openAuth(uri, auth, flags=0):
>
>          #print os.geteuid()
>
>     ret = libvirtmod.virConnectOpenAuth(uri, auth, flags)
>
>     if ret is None:raise libvirtError('virConnectOpenAuth() failed')
>
> return virConnect(_obj=ret)
>
>  
>
> [root at server117 libvirt]# ll /var/run/libvirt/libvirt-sock
>
> srwxrwx---. 1 root qemu 0 Jul 19 23:43 /var/run/libvirt/libvirt-sock
>
>  
>
> According that, root should not get an Permission denied error ? But why?
>
>  
>
> And I setenforce=0 , and still show Perssion denied error.
>
>  
>
> What’s the reason? And how to solve it?
>
>  
>
> Thank you.
>
>
> _______________________________________________
> Devel mailing list
>  <mailto:Devel at ovirt.org> Devel at ovirt.org
>  <http://lists.ovirt.org/mailman/listinfo/devel> http://lists.ovirt.org/mailman/listinfo/devel

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ovirt.org/pipermail/devel/attachments/20160726/92369935/attachment.html>


More information about the Devel mailing list