Red Hat Bugzilla – Bug 370131
qcow2 images appear as 0 sized and virt-manager won't let you use them
Last modified: 2008-01-22 10:52:37 EST
If you create an image file with qemu-img that's qcow2 formatted and then try to
use it within virt-manager, you get told that you can't use an image that's 0
MB. But it's not 0 MB, it's an empty qcow2 that will grow.
Would be nice as qcow2 is a lot nicer than pre-allocated or sparse files when
When libvirt gets the storagemanagement APIs this stuff will all work much
better. We'll be able to automatically detect image formats, automatically
create in qcow2 format from virt-manager, etc, etc
Until this is done, its not worth changing virt-manager.
Not adding support for creating until then I can see, but using already existing
images isn't really a lot of change. The size won't actually be accurate but
that's already foolable if I've actually used the image at all. Something lame like
diff -r 9ba899abb73f src/virtManager/create.py
--- a/src/virtManager/create.py Wed Nov 07 14:11:53 2007 -0500
+++ b/src/virtManager/create.py Wed Nov 07 14:32:45 2007 -0500
@@ -696,8 +696,8 @@ class vmmCreate(gobject.GObject):
- if os.path.isfile(file):
- size = os.path.getsize(file)/(1024*1024)
+ if os.path.isfile(file) and os.path.getsize(file) > 0:
+ size = os.path.getsize(file)/(1024*1024) or 1
seems plausible enough
Regardless of qcow related files this still poses other (if obscure) problems.
If someone wanted to create a disk with a file less than 1 MB, it appears as 0
in the disk size field, preventing you from continuing. It affects this qcow
case, but could also apply to adding a floppy drive in the hardware wizard.
I think virt-manager should just report the "File Size" as None if the field is
disabled (as it is if the file exists). virtinst will gladly accept this and it
is a small change. The only adverse effect would be not reporting the existing
files size in the final review screen of either creation wizard.
Created attachment 261781 [details]
Patch to return disksize = None if File Size field is disabled.
Tested out and works with zero sized files for adding hardware and guest
I committed that patch:
Then realized it was busted and fixed it:
So this issue is fixed.
virt-manager-0.5.3-1.fc8 has been pushed to the Fedora 8 testing repository. If problems still persist, please make note of it in this bug report.
If you want to test the update, you can install it with
su -c 'yum --enablerepo=updates-testing update virt-manager'
virt-manager-0.5.3-1.fc8 has been pushed to the Fedora 8 stable repository. If problems still persist, please make note of it in this bug report.