From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:56552) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S4ycy-0007SV-1X for qemu-devel@nongnu.org; Tue, 06 Mar 2012 12:57:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S4yca-00029l-U8 for qemu-devel@nongnu.org; Tue, 06 Mar 2012 12:56:47 -0500 Received: from mail-iy0-f173.google.com ([209.85.210.173]:50703) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S4yca-00029J-N1 for qemu-devel@nongnu.org; Tue, 06 Mar 2012 12:56:24 -0500 Received: by iafj26 with SMTP id j26so7948148iaf.4 for ; Tue, 06 Mar 2012 09:56:22 -0800 (PST) Sender: Paolo Bonzini From: Paolo Bonzini Date: Tue, 6 Mar 2012 18:55:53 +0100 Message-Id: <1331056563-7503-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PATCH v4 00/10] Mirrored block writes List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com, fsimonce@redhat.com, eblake@redhat.com, stefanha@linux.vnet.ibm.com, lcapitulino@redhat.com v4 includes Federico's drive-reopen (patch 10) command, fixes another small bug in Jeff's code (patch 2), and tweaks the union handling for older compilers. v3 tested with the following scenarios, v4 only d/e: a) mirror only 1) create base.qcow2 and starat QEMU with it 2) Execute the following QMP command { "execute": "qmp_capabilities" } { "execute": "transaction", "arguments": {'actions': [ { 'type': 'drive-mirror', 'data' : { 'device': 'ide0-hd0', 'target': '/home/pbonzini/mirror.qcow2' } } ] } } { "execute": "cont" } 3) hibernate the guest (this requires an IDE disk and -cpu kvm64,-kvmclock) 4) restart the guest with mirror.qcow2 b) Same as (a) with drive-mirror command. c) streaming to new image 1) start QEMU with an existing image test.img 2) execute the following HMP commands drive_mirror -s ide0-hd0 /home/pbonzini/mirror.qed qed block_stream ide0-hd0 3) shut down the guest (sorry, this took a looong time and I forgot to hibernate here) 4) move away the base image 5) restart the guest with mirror.qed d) atomic snapshot+mirror (QMP only): 1) start QEMU with an existing image test.img 2) Execute the following QMP command { "execute": "qmp_capabilities" } { "execute": "transaction", "arguments": {'actions': [ { 'type': 'blockdev-snapshot-sync', 'data' : { 'device': 'ide0-hd0', 'snapshot-file': '/home/pbonzini/base.qcow2' } }, { 'type': 'drive-mirror', 'data' : { 'device': 'ide0-hd0', 'target': '/home/pbonzini/mirror.qcow2' } } ] } } { "execute": "cont" } 3) hibernate the guest (this requires an IDE disk and -cpu kvm64,-kvmclock) 4) check that mirror.qcow2 has test.img as the base 5) restart the guest with base.qcow2 6) restart the guest with mirror.qcow2 e) simple snapshot with snapshot_blkdev and snapshot_blkdev -n. v3->v4: avoid literals with anonymous unions in them, add "void *data" to all unions (Mark Wu); add drive-reopen (Federico); new patch to fix use-after-free in group snapshots; patch splitting nits (Eric). v2->v3: replace reuse argument with NewImageMode enum and mode argument; renamed all commands and actions; implemented blockdev-snapshot-sync in terms of group snasphots; added new drive-mirror command and HMP equivalent. Federico Simoncelli (1): Add the drive-reopen command Marcelo Tosatti (1): Add blkmirror block driver Paolo Bonzini (8): use QSIMPLEQ_FOREACH_SAFE when freeing list elements fix format name for backing file qapi: complete implementation of unions rename blockdev-group-snapshot-sync add mode field to blockdev-snapshot-sync transaction item qmp: convert blockdev-snapshot-sync to a wrapper around transactions add mirroring to transaction add drive-mirror command and HMP equivalent Makefile.objs | 2 +- block/blkmirror.c | 239 +++++++++++++++++++++++++++++++++++++++++++++ blockdev.c | 202 +++++++++++++++++++++++++++----------- hmp-commands.hx | 47 ++++++++- hmp.c | 45 ++++++++- hmp.h | 2 + qapi-schema-test.json | 10 ++ qapi-schema.json | 143 +++++++++++++++++++++++---- qmp-commands.hx | 135 +++++++++++++++++++++----- scripts/qapi-types.py | 6 + scripts/qapi-visit.py | 31 ++++++- test-qmp-input-visitor.c | 18 ++++ test-qmp-output-visitor.c | 34 +++++++ 13 files changed, 804 insertions(+), 110 deletions(-) create mode 100644 block/blkmirror.c -- 1.7.7.6