On Fri, May 31, 2013 at 7:25 PM, Richard W.M. Jones <rjones@redhat.com> wrote:
On Fri, May 31, 2013 at 06:39:53PM +0800, Qiu Yu wrote:
> [00098ms] /usr/libexec/qemu-kvm \
>     -global virtio-blk-pci.scsi=off \
>     -drive file=/dev/xenvg/123,cache=off,format=qcow2,if=virtio \
>     -nodefconfig \
>     -enable-kvm \
>     -nodefaults \
>     -nographic \
>     -m 500 \
>     -no-reboot \
>     -device virtio-serial \
>     -serial stdio \
>     -chardev socket,path=/tmp/libguestfssaaw6T/guestfsd.sock,id=channel0 \
>     -device virtserialport,chardev=channel0,name=org.libguestfs.channel.0 \
>     -kernel /var/tmp/.guestfs-501/kernel.30285 \
>     -initrd /var/tmp/.guestfs-501/initrd.30285 \
>     -append 'panic=1 console=ttyS0 udevtimeout=300 no_timer_check acpi=off
> printk.time=1 cgroup_disable=memory selinux=0 guestfs_verbose=1
> TERM=screen-bce ' \
>     -drive
> file=/var/tmp/.guestfs-501/root.30285,snapshot=on,if=virtio,cache=unsafeqemu-kvm:
> -drive file=/dev/xenvg/123,cache=off,format=qcow2,if=virtio: could not open
> disk image /dev/xenvg/123: Invalid argument

I'm assuming it's because the format is wrong (ie. not qcow2 but raw).

The error message is a little bit obscure and could be better, but we
do rely on qemu printing something sensible instead of just "Invalid
argument".
 

Oh, yes. It's indeed the wrong 'format' argument causing the issue. Sorry I'm not familiar with libguestfs, 'invalid argument' should be an obvious hint for me to follow on.

For others who might interests, if you use qcow2 image with OpenStack and choose LVM as image backend, nova libvirt driver will convert it raw when creating a new instance. However, data injection using libguestfs will still assuming the it is qcow2 format, hence hit the above issue. Not sure it is a bug or not, probably one should specify "use_cow_images = False" to avoid the problem in this case.

--
Qiu Yu