Block replication is a very important feature which is used for continuous checkpoints(for example: COLO).
Usage: Primary: -drive if=xxx,driver=quorum,read-pattern=first,\ children.0.file.filename=1.raw,\ children.0.driver=raw,\ children.1.file.driver=nbd+colo,\ children.1.file.host=xxx,\ children.1.file.port=xxx,\ children.1.file.export=xxx,\ children.1.driver=raw Note: 1. NBD Client should not be the first child of quorum. 2. There should be only one NBD Client. 3. host is the secondary physical machine's hostname or IP 4. Each disk must have its own export name. Secondary: -drive if=xxx,driver=blkcolo,export=xxx,\ backing.file.filename=1.raw,\ backing.driver=raw Then run qmp command: nbd_server_start host:port Note: 1. The export name for the same disk must be the same in primary and secondary QEMU command line 2. The qmp command nbd_server_start must be run before running the qmp command migrate on primary QEMU 3. Don't use nbd_server_start's other options You can get the patch here: https://github.com/wencongyang/qemu-colo/commits/block-replication-v1 Wen Congyang (14): docs: block replication's description quorom: add a new read pattern quorum: ignore 0-length child Add new block driver interfaces to control disk replication quorom: implement block driver interfaces for block replication NBD client: connect to nbd server later NBD client: implement block driver interfaces for block replication block: add a new API to create a hidden BlockBackend block: give backing image its own BlockBackend allow the backing image access the origin BlockDriverState allow writing to the backing file Add disk buffer for block replication COW: move cow interfaces to a seperate file COLO: implement a new block driver Makefile.objs | 2 +- block.c | 53 +++++- block/Makefile.objs | 1 + block/backup.c | 52 +----- block/blkcolo-buffer.c | 324 ++++++++++++++++++++++++++++++++ block/blkcolo.c | 409 +++++++++++++++++++++++++++++++++++++++++ block/blkcolo.h | 35 ++++ block/block-backend.c | 29 ++- block/nbd.c | 155 ++++++++++++++-- block/quorum.c | 79 +++++++- blockcow.c | 52 ++++++ docs/block-replication.txt | 129 +++++++++++++ include/block/block.h | 27 +++ include/block/block_int.h | 14 ++ include/sysemu/block-backend.h | 2 + qapi/block-core.json | 4 +- 16 files changed, 1295 insertions(+), 72 deletions(-) create mode 100644 block/blkcolo-buffer.c create mode 100644 block/blkcolo.c create mode 100644 block/blkcolo.h create mode 100644 blockcow.c create mode 100644 docs/block-replication.txt -- 2.1.0