
On 05/27/2013 04:41 PM, Paolo Bonzini wrote:
Il 27/05/2013 12:46, Deepak C Shetty ha scritto:
On 05/27/2013 02:00 PM, Paolo Bonzini wrote:
Il 26/05/2013 15:54, Deepak C Shetty ha scritto:
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 ? What version of QEMU is this?
Can you search the logs for the QMP commands related to the hotplug? Do you mean starting my domain using -d option for qemu, which dumps the log in /tmp/qemu.log ? I mean libvirt.log. You can start libvirtd with these environment variables:
LIBVIRT_DEBUG=debug LIBVIRT_LOG_OUTPUTS=1:file:/tmp/libvirt.log
dom.attachDevice(nbdxml)
Thanks, this helped. Here is the summary With latest libvirtd (1.0.5 built from git)... <disk type='network'> <driver name="qemu" type="qcow2"/> <source protocol="nbd"> <host name="deepakcs-lx" transport="unix" socket="/tmp/mysock2" /> </source> <target dev="vdc" bus="virtio" /> </disk> 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 * from /tmp/libvirt.log QEMU_MONITOR_IO_WRITE: mon=0x7f8308003d40 buf={"execute":"human-monitor-command","arguments":{"command-line":"drive_add dummy file=nbd:unix:/tmp/mysock2,if=none,id=drive-virtio-disk2,format=qcow2"},"id":"libvirt-390"} QEMU_MONITOR_RECV_REPLY: mon=0x7f8308003d40 reply={"return": "could not open disk image nbd:unix:/tmp/mysock2: Invalid argument\r\n", "id": "libvirt-390"} On command line... qemu-kvm -drive file=nbd:unix:/tmp/mysock2,format=qcow2 qemu-kvm: -drive file=nbd:unix:/tmp/mysock2,format=qcow2: could not open disk image nbd:unix:/tmp/mysock2: Invalid argument but qemu-kvm -drive file=nbd:unix:/tmp/mysock2 - works! So looks like format=qcow2 is causing issues!!! Then tried... (removing the <driver... altoghether) <disk type='network'> <source protocol="nbd"> <host name="deepakcs-lx" transport="unix" socket="/tmp/mysock2" /> </source> <target dev="vdc" bus="virtio" /> </disk>
dom.attachDevice(nbdxml) 0
dom.detachDevice(nbdxml) 0
* from /tmp/libvirt.log QEMU_MONITOR_IO_WRITE: mon=0x7f8308003d40 buf={"execute":"human-monitor-command","arguments":{"command-line":"drive_add dummy file=nbd:unix:/tmp/mysock2,if=none,id=drive-virtio-disk2"},"id":"libvirt-867"} This works and I was able to successfully add/remove a disk exported via qemu-nbd to a running VM !
I am using a VM started from virt-manager.... i don't see a way to pass -d to it from virt-manager... I can try using a hand-coded qemu cmdline tho'
I assume when i am using python (import libvirt) and/or virsh.. it uses qemu-kvm qemu-kvm version is 1.0.1 Ok.
Do i need to try with latest qemu git ? No, I don't think so, but you can try (1.4.0 or 1.5.0 will do).
I was using qemu-kvm version 1.0.1... for all of the ^^ above
On irc.. you asked me to check if cold-plug works.. but attach-device is for active domain only... am i missing something here ? You can try putting the <disk> item and start the VM. In this case the logs in /var/log/libvirt/qemu will be helpful, because they contain the command-line that is used to start QEMU.
Tried putting the above nbdxml usign virsh edit <domname> as an addnl disk and domain booted fine It throws the same error if u add format=qcow2 under <driver>... So looks like the right way to use NBD is *not* to specify format and let QEMU autosense it ? thanx, deepak
Paolo