Bug 746188

Summary: qcow2 image created outside of virt-manager can't be used in install of new VM
Product: [Fedora] Fedora Reporter: Tom Horsley <horsley1953>
Component: virt-managerAssignee: Cole Robinson <crobinso>
Status: CLOSED DUPLICATE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 15CC: berrange, crobinso, dougsland, dpierce, hbrock, jforbes, redhat, virt-maint
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-02-07 22:20:38 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 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):
virt-manager-0.8.7-6.fc15.noarch


How reproducible:
every time

Steps to Reproduce:
1.see above
2.
3.
  
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
Cole,
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).

example:
# 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