Bug 622684

Summary: virt-convert: converted qcow2 image failed to boot guest
Product: Red Hat Enterprise Linux 6 Reporter: weizhang <weizhan>
Component: python-virtinstAssignee: Cole Robinson <crobinso>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: low    
Version: 6.1CC: berrange, dallan, dyuan, llim, mhideo, myllynen, nzhang, weizhan, xen-maint, yoyzhang, zpeng
Target Milestone: rcKeywords: RHELNAK
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
virt-convert did not preserve the storage format in the generated xml configuration file causing some image files to fail to boot with the error "no bootable device". The xml configuration now correctly preserves the storage format allowing the image to boot successfully.
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-05-19 13:45:50 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description weizhang 2010-08-10 07:13:51 UTC
Description of problem:
Converting vmdk to qcow2 format image files succeeded, but the image files failed to boot with error "no bootable device".


Version-Release number of selected component (if applicable):
libvirt-0.8.1-21.el6.x86_64
python-virtinst-0.500.3-7.el6.noarch
qemu-kvm-0.12.1.2-2.108.el6.x86_64
kernel 2.6.32-59.1.el6.x86_64

How reproducible:
always

Steps to Reproduce:
1.# virt-convert -i vmx -o virt-image -D qcow2 ESX4-RHEL5U4-x86_64-kvm-smp.vmx 
Generating output in 'virt-image' format to ESX4-RHEL5U4-x86_64-kvm-smp/
Converting disk 'ESX4-RHEL5U4-x86_64-kvm-smp-flat.vmdk' to type qcow2...
Done.
2.ls ESX4-RHEL5U4-x86_64-kvm-smp
ESX4-RHEL5U4-x86_64-kvm-smp-flat.qcow2  ESX4-RHEL5U4-x86_64-kvm-smp.virt-image.xml
3.boot the qcow2 file
  
Actual results:
fail to boot with error "no bootable device"

Expected results:
boot successfully

Additional info:
vi ESX4-RHEL5U4-x86_64-kvm-smp.virt-image.xml

<image>
 <name>ESX4-RHEL5U4-x86_64-kvm-smp</name>
 <label>ESX4-RHEL5U4-x86_64-kvm-smp</label>
 <description></description>
 <domain>

  <boot type="hvm">
   <guest>
    <arch>x86_64</arch>
   </guest>
   <os>
    <loader dev="hd"/>
   </os>
   <drive disk="ESX4-RHEL5U4-x86_64-kvm-smp-flat.qcow2" target="hda" />

  </boot>

  <devices>
   <vcpu>2</vcpu>
   <memory>524288</memory>
   <interface />
   <graphics />
  </devices>
 </domain>
 <storage>
  <disk file="ESX4-RHEL5U4-x86_64-kvm-smp-flat.qcow2" use="system" format="raw"/>

 </storage>
</image>

# qemu-img info ESX4-RHEL5U4-x86_64-kvm-smp-flat.qcow2 
image: ESX4-RHEL5U4-x86_64-kvm-smp-flat.qcow2
file format: qcow2
virtual size: 10G (10737418240 bytes)
disk size: 2.2G
cluster_size: 65536

Comment 2 RHEL Program Management 2010-08-10 07:38:41 UTC
This issue has been proposed when we are only considering blocker
issues in the current Red Hat Enterprise Linux release.

** If you would still like this issue considered for the current
release, ask your support representative to file as a blocker on
your behalf. Otherwise ask that it be considered for the next
Red Hat Enterprise Linux release. **

Comment 3 RHEL Program Management 2010-08-18 21:29:55 UTC
Thank you for your bug report. This issue was evaluated for inclusion
in the current release of Red Hat Enterprise Linux. Unfortunately, we
are unable to address this request in the current release. Because we
are in the final stage of Red Hat Enterprise Linux 6 development, only
significant, release-blocking issues involving serious regressions and
data corruption can be considered.

If you believe this issue meets the release blocking criteria as
defined and communicated to you by your Red Hat Support representative,
please ask your representative to file this issue as a blocker for the
current release. Otherwise, ask that it be evaluated for inclusion in
the next minor release of Red Hat Enterprise Linux.

Comment 4 Cole Robinson 2010-12-01 16:59:43 UTC
Hmm, is this virt-convert specific? If you take the original file and just try to run it with /usr/libvirt/qemu-kvm, does it work? If you then convert the original file to qcow2 using qemu-img, and again run it manually with qemu-kvm, does that work?

Basically, is it the virt-convert step that breaks things, or maybe qemu-img, or maybe the binary doesn't work

Comment 5 weizhang 2010-12-02 09:50:04 UTC
qemu-kvm command when start domain:
ps aux |grep kvm|grep ESX3.5-RHEL6-64b-20100909.1
qemu     28502  9.9  0.2 1305108 23604 ?       Sl   16:54   4:17 /usr/libexec/qemu-kvm -S -M rhel6.0.0 -enable-kvm -m 1024 -smp 1,sockets=1,cores=1,threads=1 -name ESX3.5-RHEL6-64b-20100909.1 -uuid fba69155-ee15-f867-3e81-4402469bc71b -nodefconfig -nodefaults -chardev socket,id=monitor,path=/var/lib/libvirt/qemu/ESX3.5-RHEL6-64b-20100909.1.monitor,server,nowait -mon chardev=monitor,mode=control -rtc base=utc -boot c -drive file=/var/lib/libvirt/images/ESX3.5-RHEL6-x64-20100807.0/ESX3.5-RHEL6-x64-20100807.0-flat.qcow2,if=none,id=drive-ide0-0-0,boot=on,format=raw,cache=none -device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 -netdev tap,fd=28,id=hostnet0 -device rtl8139,netdev=hostnet0,id=net0,mac=52:54:00:ad:b8:63,bus=pci.0,addr=0x3 -chardev pty,id=serial0 -device isa-serial,chardev=serial0 -usb -vnc 127.0.0.1:3 -k en-us -vga cirrus -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4

convert to qcow2 with qemu-img:
qemu-img convert -O qcow2 ESX3.5-RHEL6-x64-20100807.0-flat.vmdk ESX3.5-RHEL6-x64-20100807.0-flat.qcow2

the same problem as before. I think it is qemu-img problem

Comment 6 Daniel Berrangé 2010-12-02 11:13:01 UTC
> -drive
> file=/var/lib/libvirt/images/ESX3.5-RHEL6-x64-20100807.0/ESX3.5-RHEL6-x64-20100807.0-flat.qcow2,if=none,id=drive-ide0-0-0,boot=on,format=raw,cache=none

There is the problem - the disk is set to  format=raw, rather than format=qcow2. Which must in turn mean the XML config is wrong.

Comment 7 weizhang 2010-12-03 03:06:50 UTC
(In reply to comment #6)
> > -drive
> > file=/var/lib/libvirt/images/ESX3.5-RHEL6-x64-20100807.0/ESX3.5-RHEL6-x64-20100807.0-flat.qcow2,if=none,id=drive-ide0-0-0,boot=on,format=raw,cache=none
> 
> There is the problem - the disk is set to  format=raw, rather than
> format=qcow2. Which must in turn mean the XML config is wrong.

ah, yes. The problem is that after I virt-convert vmx to qcow2, there is a file ESX3.5-RHEL6-x64-20100807.0.virt-image.xml created, with 
> <disk file="ESX4-RHEL5U4-x86_64-kvm-smp-flat.qcow2" use="system"
format="raw"/>

After I create the domain with virt-image, it shows <driver type='raw'>, so that is the problem. After change type from 'raw' to 'qcow2', it works well, so no problem on qemu-img, sorry for wrong conclusion before.

There is another problem that after I manually change the ESX3.5-RHEL6-x64-20100807.0.virt-image.xml from <disk format="raw"/> to <disk format="qcow2"/>, with virt-image to create domain, the driver type is also 'raw', but not 'qcow2'.

Comment 8 Cole Robinson 2010-12-08 01:23:36 UTC
Thanks for the thorough report, fixed upstream now:

http://hg.fedorahosted.org/hg/python-virtinst/rev/4e218aaddb42

Comment 9 Cole Robinson 2011-01-14 22:10:41 UTC
Fix built in python-virtinst-0.500.5-1.el6

Comment 14 Cole Robinson 2011-03-02 21:20:24 UTC
Okay, I fixed virt-image to do the right thing, but virt-convert was still handling 'format' in a funky way. Fixed upstream:

http://hg.fedorahosted.org/hg/python-virtinst/rev/08bf078b2229

Comment 15 Cole Robinson 2011-03-10 16:38:11 UTC
Fixed in python-virtinst-0.500.5-2.el6

Comment 17 Marko Myllynen 2011-03-11 09:08:17 UTC
> Fixed in python-virtinst-0.500.5-2.el6

I can confirm this fixes guest creation with virt-image when using qcow2.

Thanks!

Comment 18 zhe peng 2011-03-23 08:00:03 UTC
Verified on python-virtinst-0.500.5-2.el6
# rpm -qa|grep python-virtinst
python-virtinst-0.500.5-2.el6.noarch

# virt-convert -i vmx -o virt-image -D qcow2 ESX3.5-RHEL6-x64-20100807.0.vmx
Generating output in 'virt-image' format to ESX3.5-RHEL6-64b-20100909.1/
Converting disk 'ESX3.5-RHEL6-x64-20100807.0-flat.vmdk' to type qcow2...
Done.
# ls ESX3.5-RHEL6-64b-20100909.1/
ESX3.5-RHEL6-64b-20100909.1.virt-image.xml
ESX3.5-RHEL6-x64-20100807.0-flat.qcow2
# virt-image -n test ESX3.5-RHEL6-64b-20100909.1.virt-image.xml 
# cat ESX3.5-RHEL6-64b-20100909.1.virt-image.xml 
...........
<storage>
  <disk file="ESX3.5-RHEL6-x64-20100807.0-flat.qcow2" use="system" format="qcow2"/>
 </storage>
...........
# virsh list --all
 Id Name                 State
----------------------------------
 40 test                 running
the guest worked well.
the bug is fixed.

Comment 19 Nan Zhang 2011-03-23 08:21:46 UTC
According to comment #18, move to VERIFIED.

Comment 20 zhe peng 2011-04-15 10:27:58 UTC
verified this bug with:
Linux localhost.localdomain 2.6.32-130.el6.x86_64 #1 SMP Tue Apr 5 19:58:31 EDT
2011 x86_64 x86_64 x86_64 GNU/Linux

python-virtinst-0.500.5-3.el6.noarch
libvirt-0.8.7-17.el6.x86_64

passed.

Comment 22 Michael Hideo 2011-05-12 01:11:23 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
virt-convert did not preserve the storage format in the generated xml configuration file causing some image files to fail to boot with the error "no bootable device". The xml configuration now correctly preserves the storage format allowing the image to boot successfully. (BZ#622684)

Comment 23 Michael Hideo 2011-05-16 21:42:56 UTC
    Technical note updated. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    Diffed Contents:
@@ -1 +1 @@
-virt-convert did not preserve the storage format in the generated xml configuration file causing some image files to fail to boot with the error "no bootable device". The xml configuration now correctly preserves the storage format allowing the image to boot successfully. (BZ#622684)+virt-convert did not preserve the storage format in the generated xml configuration file causing some image files to fail to boot with the error "no bootable device". The xml configuration now correctly preserves the storage format allowing the image to boot successfully.

Comment 24 errata-xmlrpc 2011-05-19 13:45:50 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2011-0636.html