Bug 620456

Summary: virt-install misidentify qcow2 images as raw
Product: Red Hat Enterprise Linux 6 Reporter: Juan Quintela <quintela>
Component: python-virtinstAssignee: Cole Robinson <crobinso>
Status: CLOSED CURRENTRELEASE QA Contact: Virtualization Bugs <virt-bugs>
Severity: urgent Docs Contact:
Priority: low    
Version: 6.0CC: amit.shah, crobinso, eblake, hbrock, jialiu, mjenner, syeghiay, tburke, xen-maint
Target Milestone: rcKeywords: RHELNAK
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: python-virtinst-0.500.3-7.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-11-10 21:23:58 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:
Attachments:
Description Flags
Set qemu format= value from passed virt-install format= none

Description Juan Quintela 2010-08-02 15:07:01 UTC
Description of problem:

virt-install (via libvirt) misidentifies qcow2 images as raw failing installation

Version-Release number of selected component (if applicable):


How reproducible:

Always

Steps to Reproduce:
1. create new qcow2 image
   $ qemu-img create /var/lib/libvirt/images/rhel6.0X-64.img 6G -f  qcow2
   Formatting '/var/lib/libvirt/images/rhel6.0X-64.img', fmt=qcow2
   size=6442450944 encryption=off cluster_size=0 

2. run virt-install
time virt-install --pxe --disk path=/mnt/images/r60X-64.img  --name r60X-64 --ram=1024 --network bridge=br0 --os-variant=rhel6
  
Actual results:

Installation fails with error "Disk not big enough".
doing a ps -aux shows that qemu is launched with format=raw for the image.

Expected results:

Complete the installation using format=qcow2

Additional info:

Adding format=qcow2 to the virt-install command line makes no difference.

Comment 2 RHEL Program Management 2010-08-02 15:27:56 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 Cole Robinson 2010-08-02 16:41:23 UTC
Created attachment 436064 [details]
Set qemu format= value from passed virt-install format=

This is the unfortunate fallout of the recent libvirt CVE fixes. We
currently depend on libvirt's image file format detection for setting
the qemu format= option, however that just offloaded the original qemu
format CVE to libvirt. Now libvirt defaults to reporting all image files
as 'raw' format.

virt-install needs to be fixed to use the user passed format= option
when setting the qemu format= value. This is easy if the user is asking
virt-install to create a new disk image, since the format needs to be
required, but pointing to an existing qcow2 image now requires explictly
specifying the --disk format= value.

Comment 4 Cole Robinson 2010-08-02 16:50:15 UTC
This is potential blocker material, depending on how important qcow2 is. Risk is low, but it is in an area of the code that is slightly complex, QE would want to make sure raw disk creation still works fine.

Instructions for QE:

virt-install --disk path=...,format=qcow2 --debug should show

<driver name='qemu' type='qcow2'/>

in the generated XML. If a format isn't specified, type should be ='raw'. Verify that creating a guest from an existing qcow2 image boots up fine.

Workaround for this unfortunately requires manually editing the XML after creating the guest. And this fix doesn't address adding qcow2 images via virt-manager: that is still broken and would require manually editing the XML.

Comment 8 Cole Robinson 2010-08-03 18:04:28 UTC
Fixed in python-virtinst-0.500.3-7.el6

Comment 10 Cole Robinson 2010-08-06 18:10:04 UTC
*** Bug 615239 has been marked as a duplicate of this bug. ***

Comment 11 Johnny Liu 2010-08-11 08:16:15 UTC
Verify this bug with python-virtinst-0.500.3-7.el6.noarch, and PASSED.

1. Create new qcow2 image
   $ qemu-img create /var/lib/libvirt/images/rhel6.0X-64.img 6G -f  qcow2
   Formatting '/var/lib/libvirt/images/rhel6.0X-64.img', fmt=qcow2
   size=6442450944 encryption=off cluster_size=0

2. Copy this image file to /mnt/images

3. Run virt-install
# virt-install --pxe --disk path=/mnt/images/r60X-64.img,format=qcow2  --name r60X-64 --ram=1024 --network bridge=br0 --os-variant=rhel6

4. Dump domain xml to check disk driver type:
<---SNIP---->
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2' cache='none'/>
      <source file='/mnt/images/rhel6.0X-64.img'/>
<---SNIP---->

And installation is finished successfully.

If not specify format at step 3, the disk type will be "raw", this will cause installation failed. This is expected behaviour.
# virt-install --pxe --disk path=/mnt/images/rhel6.0X-64.img  --name r60X-64 --ram=1024 --network bridge=br0 --os-variant=rhel6

Dump domain xml to check disk driver type:
<---SNIP---->
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw' cache='none'/>
      <source file='/mnt/images/rhel6.0X-64.img'/>
<---SNIP---->

So this bug is fixed.

Comment 12 releng-rhel@redhat.com 2010-11-10 21:23:58 UTC
Red Hat Enterprise Linux 6.0 is now available and should resolve
the problem described in this bug report. This report is therefore being closed
with a resolution of CURRENTRELEASE. You may reopen this bug report if the
solution does not work for you.