From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60218) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bzDUO-0002r0-Vm for qemu-devel@nongnu.org; Tue, 25 Oct 2016 21:58:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bzDUN-0002hD-Tp for qemu-devel@nongnu.org; Tue, 25 Oct 2016 21:58:49 -0400 Message-ID: <58100FA9.4090109@cn.fujitsu.com> Date: Wed, 26 Oct 2016 10:06:33 +0800 From: Changlong Xie MIME-Version: 1.0 References: <1476971860-20860-1-git-send-email-zhang.zhanghailiang@huawei.com> In-Reply-To: <1476971860-20860-1-git-send-email-zhang.zhanghailiang@huawei.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH RFC 0/7] COLO block replication supports shared disk case List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: zhanghailiang , qemu-devel@nongnu.org, qemu-block@nongnu.org Cc: stefanha@redhat.com, kwolf@redhat.com, mreitz@redhat.com, pbonzini@redhat.com, wency@cn.fujitsu.com, Juan Quintela , Amit Shah , "Dr . David Alan Gilbert" I did't review p5/p6, I think you can merge p5/p6 into a single one. Also don't forget update qapi/block-core.json with p3. Thanks -Xie On 10/20/2016 09:57 PM, zhanghailiang wrote: > COLO block replication doesn't support the shared disk case, > Here we try to implement it. > > Just as the scenario of non-shared disk block replication, > we are going to implement block replication from many basic > blocks that are already in QEMU. > The architecture is: > > virtio-blk || .---------- > / || | Secondary > / || '---------- > / || virtio-blk > / || | > | || replication(5) > | NBD --------> NBD (2) | > | client || server ---> hidden disk <-- active disk(4) > | ^ || | > | replication(1) || | > | | || | > | +-----------------' || | > (3) |drive-backup sync=none || | > --------. | +-----------------+ || | > Primary | | | || backing | > --------' | | || | > V | | > +-------------------------------------------+ | > | shared disk | <----------+ > +-------------------------------------------+ > 1) Primary writes will read original data and forward it to Secondary > QEMU. > 2) The hidden-disk will buffers the original content that is modified > by the primary VM. It should also be an empty disk, and > the driver supports bdrv_make_empty() and backing file. > 3) Primary write requests will be written to Shared disk. > 4) Secondary write requests will be buffered in the active disk and it > will overwrite the existing sector content in the buffe > > For more details, please refer to patch 1. > > The complete codes can be found from the link: > https://github.com/coloft/qemu/tree/colo-v5.1-developing-COLO-frame-v21-with-shared-disk > > Test steps: > 1. Secondary: > # x86_64-softmmu/qemu-system-x86_64 -boot c -m 2048 -smp 2 -qmp stdio -vnc :9 -name secondary -enable-kvm -cpu qemu64,+kvmclock -device piix3-usb-uhci -drive if=none,driver=qcow2,file.filename=/mnt/ramfs/hidden_disk.img,id=hidden_disk0,backing.driver=raw,backing.file.filename=/work/kvm/suse11_sp3_64 -drive if=virtio,id=active-disk0,driver=replication,mode=secondary,file.driver=qcow2,top-id=active-disk0,file.file.filename=/mnt/ramfs/active_disk.img,file.backing=hidden_disk0,shared-disk=on -incoming tcp:0:9999 > > Issue qmp commands: > {'execute':'qmp_capabilities'} > {'execute': 'nbd-server-start', 'arguments': {'addr': {'type': 'inet', 'data': {'host': '0', 'port': '9998'} } } } > {'execute': 'nbd-server-add', 'arguments': {'device': 'hidden_disk0', 'writable': true } } > > 2.Primary: > # x86_64-softmmu/qemu-system-x86_64 -enable-kvm -m 2048 -smp 2 -qmp stdio -vnc :9 -name primary -cpu qemu64,+kvmclock -device piix3-usb-uhci -drive if=virtio,id=primary_disk0,file.filename=/work/kvm/suse11_sp3_64,driver=raw -S > > Issue qmp commands: > {'execute':'qmp_capabilities'} > {'execute': 'human-monitor-command', 'arguments': {'command-line': 'drive_add -n buddy driver=replication,mode=primary,file.driver=nbd,file.host=9.42.3.17,file.port=9998,file.export=hidden_disk0,shared-disk-id=primary_disk0,shared-disk=on,node-name=rep'}} > {'execute': 'migrate-set-capabilities', 'arguments': {'capabilities': [ {'capability': 'x-colo', 'state': true } ] } } > {'execute': 'migrate', 'arguments': {'uri': 'tcp:9.42.3.17:9999' } } > > 3. Failover > Secondary side: > Issue qmp commands: > { 'execute': 'nbd-server-stop' } > { "execute": "x-colo-lost-heartbeat" } > > Please review and any commits are welcomed. > > Cc: Juan Quintela > Cc: Amit Shah > Cc: Dr. David Alan Gilbert (git) > > zhanghailiang (7): > docs/block-replication: Add description for shared-disk case > block-backend: Introduce blk_root() helper > replication: add shared-disk and shared-disk-id options > replication: Split out backup_do_checkpoint() from > secondary_do_checkpoint() > replication: fix code logic with the new shared_disk option > replication: Implement block replication for shared disk case > nbd/replication: implement .bdrv_get_info() for nbd and replication > driver > > block/block-backend.c | 5 ++ > block/nbd.c | 12 ++++ > block/replication.c | 146 +++++++++++++++++++++++++++++++---------- > docs/block-replication.txt | 131 ++++++++++++++++++++++++++++++++++-- > include/sysemu/block-backend.h | 1 + > 5 files changed, 258 insertions(+), 37 deletions(-) >