Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 949226

Summary: Creating new VM from existing image format (qcow2) is not correctly recognized
Product: Red Hat Enterprise Linux 7 Reporter: CongDong <codong>
Component: virt-managerAssignee: virt-mgr-maint
Status: CLOSED UPSTREAM QA Contact: Virtualization Bugs <virt-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.0CC: acathrow, codong, cwei, dallan, gscrivan, hyao, lcui, mcsontos, mjenner, mzhan, tzheng
Target Milestone: rc   
Target Release: 7.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 918989 Environment:
Last Closed: 2014-06-05 09:11:39 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: 918989    
Bug Blocks: 1048691    

Description CongDong 2013-04-07 05:56:26 UTC
+++ This bug was initially created as a clone of Bug #918989 +++
Reproduce on RHEL7, and clone the bug.
Version-Release number of selected component (if applicable):
libvirt-1.0.2-1.el7.x86_64
virt-manager-0.9.4-4.el7.noarch
qemu-kvm-1.3.0-6.el7.x86_64


Description of problem:
When using virt-manager UI to create a new VM from existing disk qcow2 image, the image format is not recognized and raw is always used. One has to modify configuration manually. `file $IMAGE` states correctly file is qcow2 image.

Version-Release number of selected component (if applicable):
virt-manager-0.9.0-18.el6.x86_64
libvirt-0.10.2-18.el6.x86_64

How reproducible:
100%

Steps to Reproduce:
1. Take an existing qcow2 image
2. Create a VM from the image using virt-manager's UI using existing image
  
Actual results:
- VM does not boot
- see machine's details: image is imported as raw

Expected results:
- image type is recognized and set correctly in the XML

Additional info:
- same behavior seen on F17, clone if upstream is affected, please.

--- Additional comment from CongDong on 2013-04-02 05:37:04 EDT ---

I can't reproduce this bug.
1. Install a win7 guest with qcow2
2. After installation copy the img file of win7 to a new one named "new-win7"
  #qemu-img info new-win7
  image: new-win7.img
  file format: qcow2
  virtual size: 15G (16106127360 bytes)
  disk size: 7.1G
  cluster_size: 65536
3. Create a VM "new-win7" from the image using new-win7, the VM work well, and the disk type is qcow2
 #virsh dumpxml new-win7
    ...
     <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2' cache='none'/>
      <source file='/var/lib/libvirt/images/new-win7.img'/>
      <target dev='hda' bus='ide'/>
      <alias name='ide0-0-0'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
   ...


-----------------
RHEL 6.4 
[root@localhost ~]# rpm -qa virt-manager libvirt qemu-kvm
virt-manager-0.9.0-18.el6.x86_64
libvirt-0.10.2-18.el6.x86_64
qemu-kvm-0.12.1.2-2.355.el6.x86_64
[root@localhost ~]# uname -a
Linux localhost.localdomain 2.6.32-358.el6.x86_64 #1 SMP Tue Jan 29 11:47:41 EST 2013 x86_64 x86_64 x86_64 GNU/Linux

--- Additional comment from Marian Csontos on 2013-04-02 10:04:33 EDT ---

I spot one difference: my image was created on command-line and is not in any pool.

the qemu-img says:

    > qemu-img info f18-clone.img 
    image: f18-clone.img
    file format: qcow2
    virtual size: 8.0G (8589934592 bytes)
    disk size: 4.0G
    cluster_size: 65536

After selecting the image, the last step of the New... VM "Wizard/Guide" says:

    Storage: 4.1 Gb /path/to/the/image

So the size is wrong here.

Also, when I check the Customize configuration before install, opening "Disk 1" `Storage format` is empty. And the VM of course does not boot saying:

    No bootable device

So the type of disk is wrong too.

--- Additional comment from Marian Csontos on 2013-04-02 10:16:24 EDT ---

I verified that's likely the issue. When using image in a pool the type is correct.

--- Additional comment from CongDong on 2013-04-06 23:16:30 EDT ---

I can produce this bug with the image I created with command-line:

# qemu-img create -f qcow2 /home/node.img 10G
Formatting '/home/node.img', fmt=qcow2 size=10737418240 encryption=off cluster_size=65536
# qemu-img info node.img 
image: node.img
file format: qcow2
virtual size: 10G (10737418240 bytes)
disk size: 136K
cluster_size: 65536

Comment 2 Martin Kletzander 2014-01-16 14:45:38 UTC
*** Bug 1044396 has been marked as a duplicate of this bug. ***

Comment 3 Giuseppe Scrivano 2014-06-05 09:11:39 UTC
fixed upstream by:

commit c5f6c6852a9cf920c79f09dedea15c8b95d2a75b
Author: Cole Robinson <crobinso>
Date:   Sat Feb 8 16:36:45 2014 -0500

    VirtualDisk: Always use storage APIs for provisioning
    
    This means if we are passed an unmanaged path, we try to create a
    storage pool for the parent directory.
    
    We skip directories like /dev where doing this might be problematic.
    
    This makes things much friendlier to use for remote connections, and
    means we can always rely on having libvirt's storage APIs to use
    for format probing.

Comment 4 Giuseppe Scrivano 2014-06-09 10:45:31 UTC
*** Bug 1032401 has been marked as a duplicate of this bug. ***