[Libguestfs] Point-in-time snapshots (was: Re: Inspection of disk snapshots)
Richard W.M. Jones
rjones at redhat.com
Wed Mar 25 19:41:23 UTC 2015
On Wed, Mar 25, 2015 at 07:38:03PM +0100, Kashyap Chamarthy wrote:
> 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
That's interesting, but even more interesting would be to see
drive-backup writing to NBD.
>From what I gather, drive-backup would take a nbd:... target, meaning
that it is the *client* (not the server). What's interesting is what
you're supposed to connect to the server. (Maybe I'm wrong about this
however)
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
More information about the Libguestfs
mailing list