[libvirt] Changing the default for qcow2 creation
Richard W.M. Jones
rjones at redhat.com
Mon Oct 25 15:44:33 UTC 2010
On Tue, Oct 26, 2010 at 02:11:22AM +1100, Justin Clift wrote:
> On 10/26/2010 01:06 AM, Richard W.M. Jones wrote:
> <snip>
> >> 4. A metadata preallocated qcow2 file: 14.5 seconds
> >> qemu-img create -f qcow2 -o preallocated=metadata test.img 300M
>
> Just tested this on a F13 host, and it didn't like the the preallocated
> option:
>
> $ qemu-img create -f qcow2 -o preallocated=metadata testvm.qcow2 20G
> Unknown option 'preallocated'
> qemu-img: Invalid options for file format 'qcow2'.
> $
>
> Looks like we'd need to add some kind of testing for the capability
> first. :)
The option should be '-o preallocation=metadata'. This works for me
on Fedora 13 too.
This option was introduced to qemu upstream in
commit a35e1c177debb01240243bd656caca302410d38c (Aug 17 2009).
You could actually detect this at runtime by running:
$ qemu-img create -f qcow2 -o preallocation=metadata /dev/null 1M
Formatting '/dev/null', fmt=qcow2 size=1048576 encryption=off cluster_size=0 preallocation='metadata'
$ echo $?
0
$ qemu-img create -f qcow2 -o preallocation=foobar /dev/null 1M
Formatting '/dev/null', fmt=qcow2 size=1048576 encryption=off cluster_size=0 preallocation='foobar'
Invalid preallocation mode: 'foobar'
qemu-img: Error while formatting
$ echo $?
1
However the first command segfaults on Fedora 14 (so near and yet so
far!) I'm going to file a bug about that.
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming blog: http://rwmj.wordpress.com
Fedora now supports 80 OCaml packages (the OPEN alternative to F#)
http://cocan.org/getting_started_with_ocaml_on_red_hat_and_fedora
More information about the libvir-list
mailing list