Bug 370131 - qcow2 images appear as 0 sized and virt-manager won't let you use them
qcow2 images appear as 0 sized and virt-manager won't let you use them
Status: CLOSED ERRATA
Product: Fedora
Classification: Fedora
Component: virt-manager (Show other bugs)
rawhide
All Linux
low Severity low
: ---
: ---
Assigned To: Cole Robinson
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2007-11-07 13:56 EST by Jeremy Katz
Modified: 2008-01-22 10:52 EST (History)
2 users (show)

See Also:
Fixed In Version: 0.5.3-1.fc8
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2008-01-22 10:52:37 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Patch to return disksize = None if File Size field is disabled. (1.20 KB, patch)
2007-11-16 16:00 EST, Cole Robinson
no flags Details | Diff

  None (edit)
Description Jeremy Katz 2007-11-07 13:56:13 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
using qemu/kvm.
Comment 1 Daniel Berrange 2007-11-07 14:02:35 EST
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

http://www.redhat.com/archives/libvir-list/2007-October/msg00195.html
http://www.redhat.com/archives/libvir-list/2007-October/msg00254.html

Until this is done, its not worth changing virt-manager.
Comment 2 Jeremy Katz 2007-11-07 14:37:55 EST
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):
         else:
             self.window.get_widget("storage-file-size").set_sensitive(False)
             self.window.get_widget("non-sparse").set_sensitive(False)
-            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
                 self.window.get_widget("storage-file-size").set_value(size)
             else:
                 self.window.get_widget("storage-file-size").set_value(0)

seems plausible enough
Comment 3 Cole Robinson 2007-11-16 15:58:37 EST
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.
Comment 4 Cole Robinson 2007-11-16 16:00:48 EST
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
creation.
Comment 5 Cole Robinson 2007-12-04 11:57:09 EST
I committed that patch:

http://hg.et.redhat.com/virt/applications/virt-manager--devel?cs=b8ea95b4841a

Then realized it was busted and fixed it:

http://hg.et.redhat.com/virt/applications/virt-manager--devel?cs=42a959f20ab2

So this issue is fixed.
Comment 6 Fedora Update System 2008-01-11 17:23:40 EST
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'
Comment 7 Fedora Update System 2008-01-22 10:52:22 EST
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.

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