[libvirt] Changing the default for qcow2 creation

Eric Blake eblake at redhat.com
Tue Nov 2 22:45:59 UTC 2010


On 10/25/2010 08:06 AM, Richard W.M. Jones wrote:
>> Only step 4 is timed. I ran the program against test.img prepared in
>> 4 different ways:
>>
>> 1. A sparse raw file:                            15.3 seconds
>>     truncate --size 300M test.img
>> 2. A preallocated raw file:                      14.8 seconds
>>     fallocate -l 300M test.img
>> 3. A sparse qcow2 file:                         223.0 seconds
>>     qemu-img create -f qcow2 test.img 300M
>> 4. A metadata preallocated qcow2 file:		 14.5 seconds
>>     qemu-img create -f qcow2 -o preallocated=metadata test.img 300M
>>

>> libvirt's qemu driver doesn't currently preallocate qcow2 metadata
>> when creating a new image. Given the tiny disk space overhead of the
>> metadata (0.02%) and the small processing overhead of pre-creation
>> relative to subsequent creation on-the-fly, I suggest that the
>> libvirt qemu driver is updated to pre-allocate metadata by default.
>>
>> Thoughts?
> 
> Your test might run faster if you did:
> 
>   $g->copy_size ("/dev/zero", "/test", <size of file>);
> 
> However I think making the change is a no-brainer.  We should add this
> flag by default.

Is this something that we should just globally enable if qemu supports
it, or do we need some XML tunable to allow someone to skip the
pre-allocation for some reason?

-- 
Eric Blake   eblake at redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20101102/57ccd6b2/attachment-0001.sig>


More information about the libvir-list mailing list