Skip to content

Mirrored block writes

Paolo Bonzini qemu-devel 4 versions – Applied

Status from this message: Thanks, applied patches 1-6 for now. I'll review the mirroring part later.

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest10 patches 10 repliesApplied
  2. v38 patches 14 repliesSuperseded
  3. v26 patches 15 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v16 patches14 repliesSuperseded

Changes in v4 from the cover letter

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).

Patches in v4 Applied

#Subject and filesSizeRepliesApplied
1/10use QSIMPLEQ_FOREACH_SAFE when freeing list elementsblockdev.c+2 -20 replies
2/10fix format name for backing fileblockdev.c+2 -10 replies
3/10qapi: complete implementation of unionsqapi-schema-test.json scripts/qapi-types.py scripts/qapi-visit.py +2 more+98 -10 replies
4/10rename blockdev-group-snapshot-syncblockdev.c qapi-schema.json qmp-commands.hx+96 -760 replies
5/10add mode field to blockdev-snapshot-sync transaction itemblockdev.c qapi-schema.json qmp-commands.hx+44 -100 replies
6/10qmp: convert blockdev-snapshot-sync to a wrapper around transactionsblockdev.c hmp-commands.hx hmp.c +2 more+44 -730 replies
7/10Add blkmirror block driverMakefile.objs block/blkmirror.c+240 -10 replies
8/10add mirroring to transactionblockdev.c qapi-schema.json qmp-commands.hx+77 -140 replies
9/10add drive-mirror command and HMP equivalentblockdev.c hmp-commands.hx hmp.c +3 more+126 -00 replies
10/10Add the drive-reopen commandblockdev.c hmp-commands.hx hmp.c +3 more+143 -09 replies

Reviews trailers per patch

1 of 10 patches has a Reviewed-by or Acked-by.

PatchLuiz Capitulino
1/10
2/10
3/10R-b
4/10
5/10
6/10
7/10
8/10
9/10
10/10

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v4 thread

Cover letter [Qemu-devel] [PATCH v4 00/10] Mirrored block writes

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
Signature · 1 line
1.7.7.6