
This is a multipart message in MIME format. ------=_NextPart_000_001E_01D1E509.19780F20 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 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; 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@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. ------=_NextPart_000_001E_01D1E509.19780F20 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable <html xmlns:v=3D"urn:schemas-microsoft-com:vml" = xmlns:o=3D"urn:schemas-microsoft-com:office:office" = xmlns:w=3D"urn:schemas-microsoft-com:office:word" = xmlns:m=3D"http://schemas.microsoft.com/office/2004/12/omml" = xmlns=3D"http://www.w3.org/TR/REC-html40"><head><meta = http-equiv=3DContent-Type content=3D"text/html; = charset=3Dus-ascii"><meta name=3DGenerator content=3D"Microsoft Word 14 = (filtered medium)"><style><!-- /* Font Definitions */ @font-face {font-family:SimSun; panose-1:2 1 6 0 3 1 1 1 1 1;} @font-face {font-family:SimSun; panose-1:2 1 6 0 3 1 1 1 1 1;} @font-face {font-family:Calibri; panose-1:2 15 5 2 2 2 4 3 2 4;} @font-face {font-family:SimSun; panose-1:2 1 6 0 3 1 1 1 1 1;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {margin:0cm; margin-bottom:.0001pt; text-align:justify; text-justify:inter-ideograph; font-size:10.5pt; font-family:"Calibri","sans-serif";} a:link, span.MsoHyperlink {mso-style-priority:99; color:blue; text-decoration:underline;} a:visited, span.MsoHyperlinkFollowed {mso-style-priority:99; color:purple; text-decoration:underline;} span.EmailStyle17 {mso-style-type:personal-compose; font-family:"Calibri","sans-serif"; color:windowtext;} .MsoChpDefault {mso-style-type:export-only; font-family:"Calibri","sans-serif";} /* Page Definitions */ @page WordSection1 {size:612.0pt 792.0pt; margin:72.0pt 90.0pt 72.0pt 90.0pt;} div.WordSection1 {page:WordSection1;} --></style><!--[if gte mso 9]><xml> <o:shapedefaults v:ext=3D"edit" spidmax=3D"1026" /> </xml><![endif]--><!--[if gte mso 9]><xml> <o:shapelayout v:ext=3D"edit"> <o:idmap v:ext=3D"edit" data=3D"1" /> </o:shapelayout></xml><![endif]--></head><body lang=3DZH-CN link=3Dblue = vlink=3Dpurple style=3D'text-justify-trim:punctuation'><div = class=3DWordSection1><p class=3DMsoNormal><span lang=3DEN-US>I debugged = vdsm with PyCharm, And I logged on my Centos 7.2 with root, and = get an error as follows:<o:p></o:p></span></p><p class=3DMsoNormal><span = lang=3DEN-US><o:p> </o:p></span></p><p class=3DMsoNormal><span = lang=3DEN-US>Problem:<o:p></o:p></span></p><p class=3DMsoNormal><span = lang=3DEN-US><o:p> </o:p></span></p><p class=3DMsoNormal><span = lang=3DEN-US>Traceback (most recent call last):<o:p></o:p></span></p><p = class=3DMsoNormal><span lang=3DEN-US> File = "/usr/share/vdsm/vdsm", line 149, in = run<o:p></o:p></span></p><p class=3DMsoNormal><span = lang=3DEN-US> = serve_clients(log)<o:p></o:p></span></p><p class=3DMsoNormal><span = lang=3DEN-US> File "/usr/share/vdsm/vdsm", line 104, in = serve_clients<o:p></o:p></span></p><p class=3DMsoNormal><span = lang=3DEN-US> cif =3D clientIF.getInstance(irs, log, = scheduler)<o:p></o:p></span></p><p class=3DMsoNormal><span = lang=3DEN-US> File "/usr/share/vdsm/clientIF.py", line = 204, in getInstance<o:p></o:p></span></p><p class=3DMsoNormal><span = lang=3DEN-US> cls._instance =3D clientIF(irs, log, = scheduler)<o:p></o:p></span></p><p class=3DMsoNormal><span = lang=3DEN-US> File "/usr/share/vdsm/clientIF.py", line = 106, in __init__<o:p></o:p></span></p><p class=3DMsoNormal><span = lang=3DEN-US> secret.clear()<o:p></o:p></span></p><p = class=3DMsoNormal><span lang=3DEN-US> File = "/usr/lib/python2.7/site-packages/vdsm/virt/secret.py", line = 92, in clear<o:p></o:p></span></p><p class=3DMsoNormal><span = lang=3DEN-US> con =3D = libvirtconnection.get()<o:p></o:p></span></p><p class=3DMsoNormal><span = lang=3DEN-US> File = "/usr/lib/python2.7/site-packages/vdsm/libvirtconnection.py", = line 163, in get<o:p></o:p></span></p><p class=3DMsoNormal><span = lang=3DEN-US> password)<o:p></o:p></span></p><p = class=3DMsoNormal><span lang=3DEN-US> File = "/usr/lib/python2.7/site-packages/vdsm/libvirtconnection.py", = line 99, in open_connection<o:p></o:p></span></p><p = class=3DMsoNormal><span lang=3DEN-US> return = utils.retry(libvirtOpen, timeout=3D10, = sleep=3D0.2)<o:p></o:p></span></p><p class=3DMsoNormal><span = lang=3DEN-US> File = "/usr/lib/python2.7/site-packages/vdsm/utils.py", line 546, in = retry<o:p></o:p></span></p><p class=3DMsoNormal><span = lang=3DEN-US> return func()<o:p></o:p></span></p><p = class=3DMsoNormal><span lang=3DEN-US> File = "/usr/lib64/python2.7/site-packages/libvirt.py", line 105, in = openAuth<o:p></o:p></span></p><p class=3DMsoNormal><span = lang=3DEN-US> if ret is None:raise = libvirtError('virConnectOpenAuth() failed')<o:p></o:p></span></p><p = class=3DMsoNormal><span lang=3DEN-US>libvirtError: Failed to connect = socket to '/var/run/libvirt/libvirt-sock': Permission = denied<o:p></o:p></span></p><p class=3DMsoNormal><span = lang=3DEN-US><o:p> </o:p></span></p><p class=3DMsoNormal><span = lang=3DEN-US>Investitate:<o:p></o:p></span></p><p = class=3DMsoNormal><span lang=3DEN-US>According to the traceback above, = the code in libvirt.py as below, and os.geteuid() get = ‘0’ which shows the current user is = root;<o:p></o:p></span></p><p class=3DMsoNormal><span = lang=3DEN-US><o:p> </o:p></span></p><p class=3DMsoNormal><span = lang=3DEN-US>def openAuth(uri, auth, flags=3D0):<o:p></o:p></span></p><p = class=3DMsoNormal><span = lang=3DEN-US> #print = os.geteuid()<o:p></o:p></span></p><p class=3DMsoNormal><span = lang=3DEN-US> ret =3D = libvirtmod.virConnectOpenAuth(uri, auth, flags)<o:p></o:p></span></p><p = class=3DMsoNormal><span lang=3DEN-US> if ret is = None:raise libvirtError('virConnectOpenAuth() = failed')<o:p></o:p></span></p><p class=3DMsoNormal = style=3D'text-indent:21.0pt'><span lang=3DEN-US>return = virConnect(_obj=3Dret)<o:p></o:p></span></p><p class=3DMsoNormal><span = lang=3DEN-US><o:p> </o:p></span></p><p class=3DMsoNormal><span = lang=3DEN-US>[root@server117 libvirt]# ll = /var/run/libvirt/libvirt-sock<o:p></o:p></span></p><p = class=3DMsoNormal><span lang=3DEN-US>srwxrwx---. 1 root qemu 0 Jul 19 = 23:43 /var/run/libvirt/libvirt-sock<o:p></o:p></span></p><p = class=3DMsoNormal><span lang=3DEN-US><o:p> </o:p></span></p><p = class=3DMsoNormal><span lang=3DEN-US>According that, root should not get = an Permission denied error ? But why?<o:p></o:p></span></p><p = class=3DMsoNormal><span lang=3DEN-US><o:p> </o:p></span></p><p = class=3DMsoNormal><span lang=3DEN-US>And I setenforce=3D0 , and still = show Perssion denied error.<o:p></o:p></span></p><p = class=3DMsoNormal><span lang=3DEN-US><o:p> </o:p></span></p><p = class=3DMsoNormal><span lang=3DEN-US>What’s the reason? And how to = solve it?<o:p></o:p></span></p><p class=3DMsoNormal><span = lang=3DEN-US><o:p> </o:p></span></p><p class=3DMsoNormal><span = lang=3DEN-US>Thank you.<o:p></o:p></span></p></div></body></html> ------=_NextPart_000_001E_01D1E509.19780F20--