From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36837) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1adbQc-0004W8-4L for qemu-devel@nongnu.org; Wed, 09 Mar 2016 05:33:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1adbQb-0005jQ-4n for qemu-devel@nongnu.org; Wed, 09 Mar 2016 05:33:18 -0500 Message-ID: <56DFFC55.6050802@cn.fujitsu.com> Date: Wed, 9 Mar 2016 18:35:01 +0800 From: Changlong Xie MIME-Version: 1.0 References: <1454645888-28826-1-git-send-email-xiecl.fnst@cn.fujitsu.com> <1454645888-28826-9-git-send-email-xiecl.fnst@cn.fujitsu.com> <20160304175339.GG9130@stefanha-x1.localdomain> In-Reply-To: <20160304175339.GG9130@stefanha-x1.localdomain> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v15 8/9] Implement new driver for block replication List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: Kevin Wolf , Fam Zheng , zhanghailiang , qemu block , Jiang Yunhong , Dong Eddie , qemu devel , "Michael R. Hines" , Max Reitz , Gonglei , Stefan Hajnoczi , Paolo Bonzini , "Dr. David Alan Gilbert" On 03/05/2016 01:53 AM, Stefan Hajnoczi wrote: > On Fri, Feb 05, 2016 at 12:18:07PM +0800, Changlong Xie wrote: >> +static void secondary_do_checkpoint(BDRVReplicationState *s, Error **errp) >> +{ >> + Error *local_err = NULL; >> + int ret; >> + >> + if (!s->secondary_disk->bs->job) { >> + error_setg(errp, "Backup job was cancelled unexpectedly"); >> + return; >> + } > > Do you have test cases for the replication driver? > > This error code path seems like something that should be exercised to > make sure it works. > > Basic start/checkpoint/stop and checks that the active/secondary/hidden > disks contain the expected data are also important. > > Probably the easiest way to do this would be a file called > tests/test-replication.c that calls start/checkpoint/stop and read/write > functions directly instead of running a guest. > Hi Stefan I'm working on the testcase now, and encount some issues. Replication is different from other block drivers, we just use it for COLO live migration what means "primary" and "secondary" *MUST* co-work with each other. (1) There are two test "prototype": 1 "COLO prototype": simulate COLO environment, run two guests at the same time and setup nbd on both 'primary'/'secondary' side. 2 "Separate prototype" test relevant APIs in separate 'primary'/'secondary' mode, so we don't need run two guests and setup nbd on both side I prefer *"Separate prototype"*. Which one do you prefer? (2) Since we have replication_(start/stop/do_checkpoint/get_error)_all APIs, i know how to test start/checkpoint/stop/get_error callbacks. But I'm confused about how to test read/write of replication, are there some ready-made APIs for qemu test system? I know, for interpreted languages, we can use: $QEMU_IO -s -c "read 0 $size" "$TEST_IMG" $QEMU_IO -s -c "write -P 0xa 0 $size" "$TEST_IMG" Also are some APIs to check disks contents(we need check active/secondary/hidden disk contents)? Thanks -Xie