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:
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!
--
Best regards,
Fam Zheng
--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
Fedora Windows cross-compiler. Compile Windows programs, test, and
build Windows installers. Over 100 libraries supported.
http://fedoraproject.org/wiki/MinGW