[libvirt] Issues with qemu-nbd over AF_UNIX and virDomainAttachDevice

Deepak C Shetty deepakcs at linux.vnet.ibm.com
Sun May 26 13:54:16 UTC 2013


On 05/25/2013 02:04 AM, Paolo Bonzini wrote:
> Il 24/05/2013 10:01, Deepak C Shetty ha scritto:
>>> Il 24/05/2013 06:59, Deepak C Shetty ha scritto:
>>> What version of libvirt is this?  It should work starting from 1.0.4.
>> Ah, thats what I seem to have missed. I was using the distro provided
>> libvirt.. which seems to be old (0.9)!
>> I will compile latest libvirt and try.
>>
>> I still have a Q.. for qemu-nbd exporting over Unix socket.. what should
>> i put for port attr of <host> tag ?
>> I am assuming its ignored for Unix sockets ?
> It's not required anymore.  In fact it was a bug that transport='unix'
> was accepted in the old libvirt, because it didn't know how to process it.
>
> Paolo

I tried with the latest git version of libvirt (1.0.5). I still get the 
same error for trying to attach nbd device, where as file based device 
works.

./daemon/libvirtd --version
/home/dpkshetty/work/newlibvirt2/libvirt/daemon/.libs/lt-libvirtd 
(libvirt) 1.0.5

My qemu-nbd exports the disk as...
qemu-nbd -t -k /tmp/mysock2 /home/dpkshetty/work/img/iscsi_disk


1) My libvirtd started as
./run ./daemon/libvirtd

and in this console i see...

error : qemuMonitorTextAddDrive:2691 : operation failed: open disk image 
file failed

2) My python example ( I tried with virsh (started as ./run 
./tools/virsh...)  - see same error)

 >>> print filexml
<disk type='file' device='disk'>
   <driver name="qemu" type="qcow2"/>
   <source file='/home/dpkshetty/work/img/iscsi_disk'>
   </source>
   <target dev="vdc" bus="virtio" />
</disk>
 >>> dom.attachDevice(filexml)
0
 >>> help(dom)

 >>> dom.detachDevice(filexml)
0
 >>> nbdxml='''<disk type='network'>\n  <driver name="qemu" 
type="qcow2"/>\n  <source protocol="nbd">\n <host name="deepakcs-lx" 
port="1111" transport="unix" socket="/tmp/mysock2" />\n  </source>\n  
<target dev="vdc" bus="virtio" />\n</disk>'''
 >>> print nbdxml
<disk type='network'>
   <driver name="qemu" type="qcow2"/>
   <source protocol="nbd">
     <host name="deepakcs-lx" port="1111" transport="unix" 
socket="/tmp/mysock2" />
   </source>
   <target dev="vdc" bus="virtio" />
</disk>
 >>> dom.attachDevice(nbdxml)
libvirt: QEMU Driver error : operation failed: open disk image file failed
Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
   File "/home/dpkshetty/work/newlibvirt2/libvirt/python/libvirt.py", 
line 419, in attachDevice
     if ret == -1: raise libvirtError ('virDomainAttachDevice() failed', 
dom=self)
libvirt.libvirtError: operation failed: open disk image file failed

3) In nbdxml, i tried removing port="1111".. it didn't give any error 
with regards to port beign mandatory.. which si good.. but the attach 
device still gives the same error as above

Is the `nbdxml` I am using for attachign a qemu-nbd exported drive, 
correct ?

thanx,
deepak



>
>




More information about the libvir-list mailing list