[libvirt] Issue with libvirtd

Michal Privoznik mprivozn at redhat.com
Tue Jan 10 09:19:39 UTC 2017


On 01/10/2017 07:48 AM, Faysal Ali wrote:
> Hi Michal,

[It is usually good idea to keep the list CCed - it may help others
finding a solution to their problems]

> 
> Well I have created my little python/libivrt app to manage my virtual
> machines. I am using python socket to check libivrt port availability, and
> the error End of file while reading data: Input/output error* only happens
> whenever that python socket script is trigger.
> 
> Here is the script of python socket
> 
> import libvirt, socket, sys
> 
> hostname='kvm09'
> port = 16509
> 
> try:
>       socket_host = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
>       socket_host.settimeout(1)
>       socket_host.connect((hostname, port))
>       socket_host.close()
>       print 'true'
> except Exception as err:
>       print err

Ah, I haven't expected this. Of course your are seeing the error
message. Libvirt has its own protocol on the top of TCP and since you
are connecting and dying immediately - without sending any valid libvirt
packet, the daemon logs an error. This is perfectly expected.

Also, this is *not* how you connect to libvirt. You want to open a
libvirt connection:

conn = libvirt.open(uri)
dom = conn.lookupByName(name)
...

Michal




More information about the libvir-list mailing list