From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41767) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UnSOM-0006kw-EK for qemu-devel@nongnu.org; Fri, 14 Jun 2013 07:42:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UnSOL-00068g-CS for qemu-devel@nongnu.org; Fri, 14 Jun 2013 07:42:06 -0400 Received: from e23smtp07.au.ibm.com ([202.81.31.140]:47130) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UnSOC-0005lm-QD for qemu-devel@nongnu.org; Fri, 14 Jun 2013 07:42:05 -0400 Received: from /spool/local by e23smtp07.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 14 Jun 2013 21:30:29 +1000 Received: from d23relay04.au.ibm.com (d23relay04.au.ibm.com [9.190.234.120]) by d23dlp03.au.ibm.com (Postfix) with ESMTP id 37F373578053 for ; Fri, 14 Jun 2013 21:41:37 +1000 (EST) Received: from d23av04.au.ibm.com (d23av04.au.ibm.com [9.190.235.139]) by d23relay04.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r5EBR1iY42074274 for ; Fri, 14 Jun 2013 21:27:01 +1000 Received: from d23av04.au.ibm.com (loopback [127.0.0.1]) by d23av04.au.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r5EBfadH026229 for ; Fri, 14 Jun 2013 21:41:37 +1000 From: Wenchao Xia Date: Fri, 14 Jun 2013 19:39:47 +0800 Message-Id: <1371209999-15579-1-git-send-email-xiawenc@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH V2 00/12] add internal snapshot support at block device level List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com, phrdina@redhat.com, famz@redhat.com, Wenchao Xia , armbru@redhat.com, lcapitulino@redhat.com, stefanha@redhat.com, pbonzini@redhat.com, dietmar@proxmox.com This series brings internal snapshot support at block devices level, now we have two main methods to do snapshot: 1) backing chain and 2) internal one, and 3) Stefan's unmerged backing up approach. Compared with 1), internal snapshot is faster in R/W/Delete. Compared with 3), it complete faster, take less space in total, but take more space in local image. As a summary, When user want to take a local snapshot quickly, it is encouraged to use internal snapshot when possible for performance reason. If user want to duplicate or backup vm to another place, it is encouraged to use backing up approach. A full view may be: it can take snapshot by 1), 2), and the snapshot can be exported to 3rd place. it can also directly export/backup data by 3). export means transfering the data out of qemu/libvirt's scope, let 3rd party take over. host A backup server B vm ---------> | backup \|/ Data that can distinguish base/delta, disk/memory snapshot v0 export snapshot v1 ---------> Next steps to better full VM snapshot: Add support to export internal snapshot data lively, possible use qemu-img or qemu-nbd. Better vmstate saving. Note: I think in most case, saving vmstate in an standalone file is better than saving it inside qcow2, So suggest treat internal snapshot as block level methods and not encourage user to savevm in qcow2 any more. We can have "internal snapshot (or backing chain) + standing alone vmstate file" as replacement. Some details: To avoid trouble, this serial have hide ID in interfaces, this make sure no chaos of ID and name will be introduced by these interfaces. There is one patch may be common to Pavel's savvm transaction, patch 4/11, others are not quite related. Patch 4/11 will not set errp when no snapshot find, since patch 7/11 need to distinguish real error case. Thanks Kevin to give advisement about how add it in qmp_transaction, oldest version comes drom Dietmar Maurer. V2: Add test case for it. Address Kevin's comments: 04/12: use assert(id || name), instead of abort(). 05/12: better snapshot_name_wellformed(). 06/12: rename parameter *name to *id_or_name in find_snapshot_by_id_or_name(), add {} for old code, add a macro in qemu-common.h to avoid print NULL char*. Address Fam Zheng's comments: 06/12: better error message. 08/12: better document and spell fix. 10/12, 11/12: rename the command and related function to snapshot_blkdev_internal. Stefan Hajnoczi (3): 1 blockdev: drop redundant proto_drv check 2 blockdev: rename BlkTransactionStates to singular 3 blockdev: allow BdrvActionOps->commit() to be NULL Wenchao Xia (9): 4 snapshot: new function bdrv_snapshot_find_by_id_and_name() 5 snapshot: add paired functions for internal snapshot id and name 6 snapshot: distinguish id and name in snapshot delete 7 qmp: add internal snapshot support in qmp_transaction 8 qmp: add interface blockdev-snapshot-internal-sync 9 qmp: add interface blockdev-snapshot-delete-internal-sync 10 hmp: add interface hmp_snapshot_blkdev_internal 11 hmp: add interface hmp_snapshot_delete_blkdev_internal 12 qemu-iotests: add 055 internal snapshot for block device test case block/qcow2-snapshot.c | 67 ++++++++--- block/qcow2.h | 5 +- block/rbd.c | 19 +++- block/sheepdog.c | 5 +- block/snapshot.c | 130 ++++++++++++++++++++- blockdev.c | 278 +++++++++++++++++++++++++++++++++----------- hmp-commands.hx | 43 +++++++- hmp.c | 20 +++ hmp.h | 2 + include/block/block_int.h | 5 +- include/block/snapshot.h | 14 ++- include/qemu-common.h | 3 + qapi-schema.json | 58 +++++++++ qemu-img.c | 5 +- qmp-commands.hx | 93 ++++++++++++++- savevm.c | 10 ++- tests/qemu-iotests/055 | 157 +++++++++++++++++++++++++ tests/qemu-iotests/055.out | 5 + tests/qemu-iotests/group | 1 + 19 files changed, 815 insertions(+), 105 deletions(-) create mode 100755 tests/qemu-iotests/055 create mode 100644 tests/qemu-iotests/055.out