Hi, I find a bug of the latest qemu-xen-traditional whose git path is
git://xenbits.xen.org/qemu-xen-unstable.git
The bug will cause “boot from disk failed : not a bootable disk” error when you create a hvm guest os from a multi-level image whose format is not raw
Following is the details:
Code : xen-4.2.3/tools/qemu-xen-traditional
Real git url : git://xenbits.xen.org/qemu-xen-unstable.git
file: block.c
function: bdrv_open2
line number: 455
l
bug details:
block.c:455: ret = bdrv_open2(bs->backing_hd, backing_filename, open_flags, &bdrv_raw);
when we use multi level incremental image as boot image for guest os , such as : xl create test.hvm.conf , the config file is as follow:
kernel = “/usr/lib/xen/boot/hvmloader”
builder=”hvm”
disk=[‘format=qcow2,vdev=hda,access=rw,target=/yourpath/test.level2.qcow2’]
device_model=”/usr/lib64/xen/bin/qemu-dm”
…….
And test.level2.qcow2 is a level2 qcow2 image, it can be created by :
qemu-img ?f qcow2 ?b base.img test.level2.qcow2 10G
with the old code, xl create will post an error like : “boot from disk failed : not a bootable disk” in hvmloader-rombios , that is beausese the daemon
qemu-dm
which builds from qemu-xen-traditional cannot process multi-level incremental image ,the function bdrv_open2 takes &bdrv_raw as the default driver, and this
driver can not process image whose format is not raw
l
Bug fix:
I fix this bug by simply makes the forth arg of bdrv_open2 to be NULL, so it will calls bdrv_find_format
latter and find its right format
ret = bdrv_open2(bs->backing_hd, backing_filename, open_flags, NULL);