Bug 1032401

Summary: Disk format in the virtual image descriptor is detected as raw if unspecified
Product: Red Hat Enterprise Linux 7 Reporter: hyao <hyao>
Component: virt-managerAssignee: Giuseppe Scrivano <gscrivan>
Status: CLOSED DUPLICATE QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.0CC: codong, cwei, dyuan, lcui, mkletzan, mzhan, tzheng, zsong
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 1032399 Environment:
Last Closed: 2014-06-09 10:45:31 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1032399    
Bug Blocks:    

Description hyao@redhat.com 2013-11-20 05:53:59 UTC
Clone the bug since it reproduce with the packages below:
# rpm -qa libvirt virt-manager
virt-manager-0.10.0-7.el7.noarch
libvirt-1.1.1-12.el7.x86_64

+++ This bug was initially created as a clone of Bug #1032399 +++

Description
Add qcow2 and vmdk format disks in the virtual image descriptor. Use virt-image to provision the domain and the disks are detected to be raw. Use qcow2 image  but set format in xml as "raw" or other types,virt-image will not show error. 

Version:
# rpm -qa python-virtinst libvirt
python-virtinst-0.600.0-18.el6.noarch
libvirt-0.10.2-29.el6.x86_64

How reproducible:
100%

Steps to Reproduce:
1.Prepare a virtual image XML descriptor file with qcow2 and vmdk disk included.
# cat vmdk_qcow2.xml
<image>
<name>demo</name>
<domain>
<boot type="hvm">
<guest>
<arch>x86_64</arch>
</guest>
<os>
<loader dev="hd"/>
</os>
<drive disk="mydisk" target="hda"/>
<drive disk="user" target="hdb"/>
</boot>
<devices>
<vcpu>1</vcpu>
<memory>262144</memory>
<interface/>
<graphics/>
</devices>
</domain>
<storage>
<disk id="mydisk" file="kvm-rhel6.4-i386-qcow2.img" use="system"/>
<disk id="user" file="/var/lib/libvirt/images/vmdk" use="user"/>
</storage>
</image>

# qemu-img info vmdk
image: vmdk
file format: vmdk
virtual size: 100M (104857600 bytes)
disk size: 12K

# qemu-img info kvm-rhel6.4-i386-qcow2.img
image: kvm-rhel6.4-i386-qcow2.img
file format: qcow2
virtual size: 5.0G (5368709120 bytes)
disk size: 1.9G
cluster_size: 65536

2. Create a virtual machine from image.xml
#v# virt-image vmdk_qcow2.xml


Creating guest demo...
Creating domain...                                                                                                                |    0 B     00:00  

3. Check the domain configuration file.
[root@7-204 images]# virsh dumpxml demo | grep disk -A 10
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw' cache='none'/> ============>type should be qcow2
      <source file='/var/lib/libvirt/images/kvm-rhel6.4-i386-qcow2.img'/>
      <target dev='hda' bus='ide'/>
      <alias name='ide0-0-0'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk> what format it is.
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw' cache='none'/> ============>type should be vmdk
      <source file='/var/lib/libvirt/images/vmdk'/>
      <target dev='hdb' bus='ide'/>
      <alias name='ide0-0-1'/>
      <address type='drive' controller='0' bus='0' target='0' unit='1'/>
    </disk>
4. Use qcow2 image but set the format to be "raw"
# cat qcow2.xml
<image>
...
<storage>
<disk id="mydisk" file="kvm-rhel6.4-i386-qcow2.img" format="raw"use="system"/>
</storage>
</image>

5. #virt-image qcow2.xml
Creating guest demo...
Creating domain...                                                                                                                |    0 B     00:00 
No error notify the wrong format is given in the xml descriptor. 

Check the domain configuration xml:
#virsh dumpxml demo 
...
<disk type='file' device='disk'>
      <driver name='qemu' type='raw' cache='none'/>
      <source file='/var/lib/libvirt/images/kvm-rhel6.4-i386-qcow2.img'/>
      <target dev='hda' bus='ide'/>
      <alias name='ide0-0-0'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
...


Actual results:
Step3: qcow2 and vmdk format disks in the virtual image descriptor are detected to be raw.  
Step5: And no error pops up about the wrong format in the xml descriptor.

 
Expected results:
Disk format in the virtual image descriptor are detected as what format the disk is. and errors notify the user once the wrong format in the xml descriptor.
Use virt-install to import an existing disk to deploy a vm, the disk format is detected automatically, virt-image is expected to do the same.

Comment 6 Giuseppe Scrivano 2014-06-09 10:45:31 UTC

*** This bug has been marked as a duplicate of bug 949226 ***