Bug 746188 - qcow2 image created outside of virt-manager can't be used in install of new VM
Summary: qcow2 image created outside of virt-manager can't be used in install of new VM
Status: CLOSED DUPLICATE of bug 557107
Alias: None
Product: Fedora
Classification: Fedora
Component: virt-manager
Version: 15
Hardware: Unspecified
OS: Unspecified
Target Milestone: ---
Assignee: Cole Robinson
QA Contact: Fedora Extras Quality Assurance
Depends On:
TreeView+ depends on / blocked
Reported: 2011-10-14 10:18 UTC by Tom Horsley
Modified: 2012-02-10 20:42 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2012-02-07 22:20:38 UTC
Type: ---

Attachments (Terms of Use)

Description Tom Horsley 2011-10-14 10:18:51 UTC
Description of problem:
If I try to install a new virtual machine (I'm running on
fedora 15 with all updates, but no virt-preview) using
the virt-manager and going through the new VM wizard
pages, I get errors if I take a path it apparently
doesn't like:

If I tell it to use existing or other storage and
browse local and pick a qcow2 image file I manually
created outside of virt-manager thusly:

qemu-img create -f qcow2 testf16b.img 20G

qemu-img info testf16b.img 
image: testf16b.img
file format: qcow2
virtual size: 20G (21474836480 bytes)
disk size: 140K
cluster_size: 65536

When I advance to actually creating the virtual machine,
it tells me there is no disk space. Looking at the hardware
info it says: Storage size 0.19 MB

If, on the other hand, when I get to the storage def
page, I use virt-manager to create a new qcow2 image
file via the gui dialog, then when I go to start the
actual install, the hardware info page does indeed
know that the image is a 20G virtual disk.

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

How reproducible:
every time

Steps to Reproduce:
1.see above
Actual results:
Seems to be treating the file as though it were a raw image

Expected results:
recognize qcow2 image I told it to use.

Additional info:
Work around is to go ahead and define a new storage pool where I want the
image to go and tell virt-manager to create it via "New Volume"

Comment 1 Cole Robinson 2011-10-14 15:00:46 UTC
Another workaround is the choose 'customize before install', navigate to the disk info, and change storage format to 'qcow2'.

The proper fix is for virt-manager to autopoolify storage so we can determine these properties for any arbitrary path.

Comment 2 Tom Horsley 2011-10-14 15:20:38 UTC
Actually, I should have mentioned that I tried that. Apparently once
it has decided the image is only 0.19 mb, it saves it somewhere and
changing those fields (even stopping and restarting the VM) doesn't
seem to change its mind.

Comment 3 Cole Robinson 2012-02-07 22:20:38 UTC
Indeed virt-manager isn't going to give you the correct size for an unmanaged qcow2 file, even if you tell it the image is format=qcow2. However, when booting the guest, it should see the correct disk image size (as long as that format=qcow2 was set in the details page).

Duping this to the bug tracking auto detection for unmanaged disks:

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

Comment 4 Malakei 2012-02-10 17:36:50 UTC
For what it's worth, I found this thread while googling for the same issue with another distribution. I've got qemu-kvm-0.12.3 and virt-manager 0.8.2 with libvirt libvirtd (libvirt) 0.7.5. 

When I try to install to a qcow2 image, libvirt/virt-manager/kvm (whoever) is seeing the qcow2 image as 264k when I've given it a size of 36G (created via way of qemu-img).

# qemu-img create -f qcow2 test.img 36G
Formatting 'test.img', fmt=qcow2 size=38654705664 encryption=off cluster_size=0 

and then the installer sees this when booting from the install CD: http://imgur.com/Gr2jw

Indeed, when booting the guest it does not see the correct size (Also, I don't see how this bug is a duplicate of 557107 which talks about UI enhancements..??)

Comment 5 Cole Robinson 2012-02-10 20:42:47 UTC
Malakei, did you choose 'customize before install' and change the disk storage format to qcow2 before starting the install? If not, please try that and confirm it works. If it doesn't work, please reproduce against current upstream, and file a bug in our upstream tracker with the --debug output when reproducing (http://virt-manager.org/page/BugReporting)

Indeed duping to that other bug is pretty vague, but I'm now using that bug to track the proper fix to a whole bunch of storage issues, which is always using libvirt's storage capabilities to introspect information about storage, in this case being able to automatically detect the correct image format. I've added a comment in that bug trying to clarify

Note You need to log in before you can comment on or make changes to this bug.