Monday, September 26, 2011

qemu and backing images.




Cows cows cows

I always wondered but never really looked up how backing files can be used with qemu. I came back to this when stumbling across  the curl backend which brings http and ftp support to qemu and landed in fedora recently.
The idea is basically to use some master image accessed via http, e.g. residing in some object store, as a backing file for the actual image. This is a quite flexible setup. No need for iscsi or so.
Oh yes, the thing about a backing file is that all reads are happening on the backing file, until a block is written (also know as cow [copy on write]).

It turned out that the magic is happening while creating an image, not when running it:

$ qemu-img create -f qed -o backing_file=http://..../amaster.iso instance.qed 20G
$ sudo qemu-kvm -hda instance.qed

Sadly we can't test this on stock Fedora, as curl is enabled but currently broken in qemu. Maybe this ain't a bug at all or the bug is already fixed upstream (there are some fresh changes to curl), so this can be tested at some near point in the future.
It is also to note, that backing files also integrates well with libvirt.

No comments:

Post a Comment