[Kimchi-devel] [PATCH] use LibvirtConnection instead of libivrt open directily to to get connection

Sheldon shaohef at linux.vnet.ibm.com
Fri May 23 08:21:36 UTC 2014


On 05/23/2014 12:07 AM, Crístian Viana wrote:
> On 22-05-2014 11:26, shaohef at linux.vnet.ibm.com wrote:
>> From: ShaoHe Feng <shaohef at linux.vnet.ibm.com>
>>
>> On my F20, the kimchi can not start. It report:
>> $ sudo PYTHONPATH=src ./src/kimchid
>> *** Running feature tests ***
>> [21/May/2014:19:41:48] ENGINE Error in 'start' listener <bound method
>> CapabilitiesModel._set_capabilities of
>> <kimchi.model.config.CapabilitiesModel object at 0x314ac10>>
>> Traceback (most recent call last):
>> File "/usr/lib/python2.7/site-packages/cherrypy/process/wspbus.py",
>> line 197, in publish
>> output.append(listener(*args, **kwargs))
>> File "/home/shhfeng/work/workdir/kimchi/src/kimchi/model/config.py",
>> line 69, in _set_capabilities
>> self.metadata_support = FeatureTests.has_metadata_support()
>> File "/home/shhfeng/work/workdir/kimchi/src/kimchi/featuretests.py",
>> line 197, in has_metadata_support
>> conn = libvirt.open('qemu:///system')
>> File "/usr/lib64/python2.7/site-packages/libvirt.py", line 247, in
>> open
>> if ret is None:raise libvirtError('virConnectOpen() failed')
>> libvirtError: Failed to connect socket to
>> '/var/run/libvirt/libvirt-sock': Connection refused
>>
>> [21/May/2014:19:41:48] ENGINE Shutting down due to error in start
>> listener:
>> [21/May/2014:19:41:48] ENGINE Bus STOPPING
>>
>> Now use LibvirtConnection to get connection, kimchi can work well.
>>
>> Signed-off-by: ShaoHe Feng <shaohef at linux.vnet.ibm.com>
> Do you know why that problem is happening to you? Do you know why that 
> is the right solution?
> I'm running Kimchi on Fedora 20 as well and I don't have that error. 
> And by reading the commit message, I didn't understand why using that 
> other class/method works well.
>
>

Not sure the root reason, I have look into this for a long time, not 
find the root reason.

Also zhengsheng also can not reproduce it on his Fedora20.


This is caused by:
libvirt_support_fc_host in libvirt_support_fc_host. as follow:
try:
conn = libvirt.open('qemu:///system')
pool = None
pool = conn.storagePoolDefineXML(SCSI_FC_XML, 0)
except libvirt.libvirtError as e:
if e.get_error_code() == 27:
# Libvirt requires adapter name, not needed when supports to FC
else:
print e.get_error_code(), e
finally:
print "finally close pool and conn"
pool is None or pool.undefine()
print pool, conn
conn is None or conn.close()
conn = libvirt.open("qemu:///system")
conn.close()


it does not raise VIR_ERR_XML_ERROR(27), an XML description is not well 
formed or broken.
It raise VIR_ERR_SYSTEM_ERROR(38) , general system call failure

from the libvirt log it is:
2014-05-23 02:09:32.831+0000: 17127: info : libvirt version: 1.1.3.4, 
package: 4.fc20 (Fedora Project, 2014-03-18-18:53:51, 
buildvm-21.phx2.fedoraproject.org)
2014-05-23 02:09:32.831+0000: 17127: error : virCommandWait:2376 : 
internal error: Child process (/usr/sbin/iscsiadm --mode session) 
unexpected exit status 21

And this error log raises about several seconds later after connection 
is closed.

Not sure why libvirt call "iscsiadm" when we just try to create a scsi pool.

Maybe need to look into libvirt code.

LibvirtConnection will try to get connection several times with 2s interval.

so LibvirtConnection can avoid this problem.

-- 
Thanks and best regards!

Sheldon Feng(冯少合)<shaohef at linux.vnet.ibm.com>
IBM Linux Technology Center




More information about the Kimchi-devel mailing list