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

Re: [libvirt] [RFC] Image Fleecing for Libvirt (BZ 955734, 905125)

[Sorry for the odd quoting.  I forwarded the original message from Fam
Zheng so this feature could be discussed in public.  This is my reply.]

On Mon, Jul 15, 2013 at 05:57:12PM +0800, Fam Zheng wrote:
> Hi all,
> QEMU-KVM BZ 955734, and libvirt BZ 905125 are about feature "Read-only
> point-in-time throwaway snapshot". The development is ongoing on
> upstream, which implements the core functionality by QMP command
> drive-backup. I want to demonstrate the HMP/QMP commands here for image
> fleecing tasks (again) and make sure this interface looks ready and
> satisfying from Libvirt point of view.
> We get cheap point-in-time snapshot, and export it through built in NBD
> server, by commands described below:
>  1. qemu-img create -f qcow2 -o backing_file=RUNNING-VM.img BACKUP.qcow2
>     (although the backing_file option is not honoured in the next step
>     because we *override* backing file with an existing
>     BlockDriverState, giving it here does no harm and also makes sure
>     the created image is of right size.)
>  2. (HMP) drive_add backing=ide0-hd0,file=BACKUP.qcow2,id=target0,if=none
>     (where ide0-hd0 is the running BlockDriverState name for
>     RUNNING-VM.img)
>  3. (QMP) drive-backup device=ide0-hd0 mode=drive sync=none target=target0
>     (NewImageMode 'drive' means target is looked up as a device id, sync
>     mode 'none' means don't copy any data except copy-on-write the
>     point in time snapshot data)
>  4. (QMP) nbd-server-add device=target0
> When image fleecing done:

If you want to test image inspection, an easy way is:

     export LIBGUESTFS_BACKEND=direct
     virt-inspector -a nbd://localhost:port [-v]
or:  virt-inspector -a 'nbd://?socket=/sockpath' [-v]

Use -v for extra debug.

Note this requires libguestfs >= 1.22
(that usually means Fedora >= 19, RHEL >= 7, Debian >= unstable).

>  1. (QMP) block-job-complete device=ide0-hd0
>  2. (HMP) drive_del target0
>  3. rm BACKUP.qcow2
> Note: HMP drive_add/drive_del has no counterpart in QMP now but a new
> command blockdev-add to do similar things is WIP, which can be an
> alternative in QMP flavor.
> Any comments are welcome!

Do you have a qemu git repo with a working version of all of this
(ie. including the non-upstream-yet bits)?


Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
libguestfs lets you edit virtual machines.  Supports shell scripting,
bindings from many languages.  http://libguestfs.org

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