On Mon, Mar 23, 2015 at 10:43:30PM +0000, Richard W.M. Jones wrote:
[. . .]
> This makes a copy of the whole disk image. It's also not a
consistent
> (point in time) copy.
Oh I see that you're copying the _snapshot_ that you created with
libvirt; it's not a whole disk copy. There's still not any point in
doing this, and what I said below stands.
> > At that point I mount it through libguestfs and inspect its content.
>
> As long as you use the 'readonly=1' flag (which is really *essential*,
> else you'll get disk corruption), you can just point libguestfs at the
> base image:
>
> g = guestfs.GuestFS (python_return_dict=True)
> g.add_drive_opts ("base_image.qcow2", format="qcow2",
readonly=1)
>
> That also doesn't get you a consistent snapshot, but it'll work most
> of the time, and give you a clear error in libguestfs when it doesn't
> (and won't corrupt your base disk or anything like that, provided
> you're using readonly=1).
>
> The effect of the readonly=1 flag is to create an external snapshot.
> It is roughly the equivalent of doing:
>
> qemu-img create -f qcow2 -b base_image snapshot.qcow2
> < point libguestfs at snapshot.qcow2 >
>
> If you want lightweight, consistent, point-in-time snapshots (which it
> sounds like you do), qemu has recently been adding this capability.
> See the 'drive-backup' monitor command. I've not tried using that
A small QMP test for 'drive-backup':
https://kashyapc.fedorapeople.org/virt/test-qmp-drive-backup.txt
> and I don't know if it is wired up through libvirt,
I don't see it wired up yet in libvirt current `git` master.
> but libguestfs should be able to consume it since it's just
an NBD
> source.
--
/kashyap