Bug 370131 - qcow2 images appear as 0 sized and virt-manager won't let you use them
Summary: qcow2 images appear as 0 sized and virt-manager won't let you use them
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: virt-manager
Version: rawhide
Hardware: All
OS: Linux
low
low
Target Milestone: ---
Assignee: Cole Robinson
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2007-11-07 18:56 UTC by Jeremy Katz
Modified: 2008-01-22 15:52 UTC (History)
2 users (show)

Fixed In Version: 0.5.3-1.fc8
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2008-01-22 15:52:37 UTC
Type: ---
Embargoed:


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

Description Jeremy Katz 2007-11-07 18:56:13 UTC
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 Berrangé 2007-11-07 19:02:35 UTC
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 19:37:55 UTC
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 20:58:37 UTC
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 21:00:48 UTC
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 16:57:09 UTC
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 22:23:40 UTC
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 15:52:22 UTC
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.