Il 24/05/2013 06:59, Deepak C Shetty ha scritto:
Hi List,
Facing issues trying to use virDomainAttachDevice API of libvirt
from python.
Here is what I am trying to do
1) Setup qemu-nbd to export a qcow2 disk image over unix socket on my
localhost
qemu-nbd -t -k /tmp/mysock2 /home/dpkshetty/work/img/iscsi_disk
The above blocks. and i am able to use
qemu-system-x86_64 -drive file=nbd:unix:/tmp/mysock2
Just to test it...and it works. Since currently the disk is a blank
disk.. I see "No bootable device" and QEMU stops.. whcih is expected
So qemu-nbd is setup and working properly
2)
>>> print nbdxml
<disk type='network' device='disk'>
<driver name="qemu" type="qcow2"/>
<source protocol="nbd">
<host name="deepakcs-lx" port="10809"
transport="unix"
socket="/tmp/mysock2" />
</source>
<target dev="vdc" bus="virtio" />
</disk>
>>> dom.attachDevice(nbdxml)
libvir: QEMU error : operation failed: open disk image file failed
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib64/python2.7/site-packages/libvirt.py", line 400, in
attachDevice
if ret == -1: raise libvirtError ('virDomainAttachDevice() failed',
dom=self)
libvirt.libvirtError: operation failed: open disk image file failed
and I see... in the VM's log....
inet_connect_opts:
connect(ipv4,deepakcs-lx.local.lan,192.168.1.7,10809): Connection refused
What version of libvirt is this? It should work starting from 1.0.4.
Paolo