Richard W.M. Jones
2015-Nov-03 16:33 UTC
[Libguestfs] Thoughts on virt-builder --output-alloc sparse|preallocated
I had a good go at implementing $subject, but it's not as easy as it
seems. There was a customer request for this, although I don't think
they ended up filing a BZ for it. Anyway, these are my random
thoughts in no particular order.
It would be nice to use `-oa sparse' etc for compatibility with
virt-v2v, but that possibly closes off future options for replacing
the horrible OCaml Arg module with GNU getopt_long (-oa == -o + -a).
I initially tried to implement `--output-alloc sparse|preallocated'
using the Planner. I added an extra planner flag
[`Alloc, ("sparse"|"preallocated")]. I added extra
transitions
such as `Copy_sparse_never ("cp --sparse=never"). The problem is that
some output locations don't support sparse output, eg. writing to a
block device. If the user did:
virt-builder --output-alloc sparse --output /dev/sdX
then the planner stage would actually fail because it couldn't find a
satisfactory plan. (Even worse because `--output-alloc sparse' is the
default!)
So then I tried to add `--output-alloc prefer-sparse' as the default.
The problem with that is the planner could choose to use a
preallocating transition (eg. "cp --sparse=never" or
"qemu-img ... -o preallocation=full"), when ideally we'd always
want
it to choose sparseness if possible. It may be possible to use the
planner weights to avoid this, but I'm not convinced the way we handle
weights is very robust (in particular, plans with lower total weight
but more steps are ignored).
Adding some kind of "best effort" goal to the planner might be
possible, but our planner is very naive and doesn't support that at
the moment. (All current goals must be "must" or "must
not".)
Anyhow, there you go.
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
Fedora Windows cross-compiler. Compile Windows programs, test, and
build Windows installers. Over 100 libraries supported.
http://fedoraproject.org/wiki/MinGW
Possibly Parallel Threads
- Re: Can I specify qcow2 preallocation method with virt-builder?
- [PATCH 1/2] disk-create: Allow preallocation off/metadata/full.
- Re: Can I specify qcow2 preallocation method with virt-builder?
- Re: Can I specify qcow2 preallocation method with virt-builder?
- Re: Can I specify qcow2 preallocation method with virt-builder?
