qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-block] qemu-img: add seek option to dd


From: Richard W.M. Jones
Subject: Re: [Qemu-block] qemu-img: add seek option to dd
Date: Sat, 23 Feb 2019 10:13:16 +0000
User-agent: Mutt/1.5.21 (2010-09-15)

Max:

What I actually omitted from this email is why I want to do this.
I'm always complaining about other people doing that, sorry :-)

In nbdkit we have a thing called the "cow" [copy on write] filter.
You can place it above other plugins and it adds a temporary writable
overlay.  It's useful if the source plugin is read-only.  Or even if
it is writable but you don't want to actually modify the source, while
giving the impression to the NBD client that the disk is writable.
Currently the cow filter is entirely temporary.  It is thrown away
when nbdkit exits.

One thing that came out of discussions in FOSDEM is that it'd be a
good idea to optionally allow the cow layer to be saved off on exit.
It could be saved out as a qcow2 file.

Saying this is easy, but actually doing it is rather more complex.

The problem is that what is "under" the cow filter might not be a
plain file, it could be all kinds of things.  For example:

  nbdkit --filter=cow --filter=xz file disk.xz

Under the cow filter is another filter which transparently
xz-uncompresses the file.  There's no way to express this as a qcow2
backing file.  (Even if there is something I've missed, there will
definitely be cases where this is inexpressible in qemu/qcow2, for
example a custom plugin or a non-free plugin.)

So from there I thought we could create a qcow2 file backed by
‘null-co://’.  The qcow2 file would contain only the blocks that are
modified.  "Holes" in the qcow2 file would go through to the backing
file and read as zeroes.

Such a qcow2 file is not actually useful to be attached to a VM, but
there are two things a user might do with it: (1) They could unsafe-
rebase it (‘qemu-img rebase -u’) to change the backing file to a real
file.  (2) We could provide a way to reload the qcow2 file back into
the cow filter.

This led me to wonder how we could create such a qcow2 file using qemu
tools.  Creating the empty qcow2 is easy enough.  However writing the
blocks would require the qemu-img dd ‘seek’ operation.

Anyway, you may well disagree with all or part of this analysis, and
I'm really interested in what you think, negative or otherwise.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-top is 'top' for virtual machines.  Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://people.redhat.com/~rjones/virt-top



reply via email to

[Prev in Thread] Current Thread [Next in Thread]