[{"id":1769893,"web_url":"http://patchwork.ozlabs.org/comment/1769893/","msgid":"<20170918064515.GF15551@lemon.lan>","list_archive_url":null,"date":"2017-09-18T06:45:15","subject":"Re: [Qemu-devel] [PATCH 18/18] iotests: Add test for active\n\tmirroring","submitter":{"id":24872,"url":"http://patchwork.ozlabs.org/api/people/24872/","name":"Fam Zheng","email":"famz@redhat.com"},"content":"On Wed, 09/13 20:19, Max Reitz wrote:\n> Signed-off-by: Max Reitz <mreitz@redhat.com>\n> ---\n>  tests/qemu-iotests/151     | 111 +++++++++++++++++++++++++++++++++++++++++++++\n>  tests/qemu-iotests/151.out |   5 ++\n>  tests/qemu-iotests/group   |   1 +\n>  3 files changed, 117 insertions(+)\n>  create mode 100755 tests/qemu-iotests/151\n>  create mode 100644 tests/qemu-iotests/151.out\n> \n> diff --git a/tests/qemu-iotests/151 b/tests/qemu-iotests/151\n> new file mode 100755\n> index 0000000000..49a60773f9\n> --- /dev/null\n> +++ b/tests/qemu-iotests/151\n> @@ -0,0 +1,111 @@\n> +#!/usr/bin/env python\n> +#\n> +# Tests for active mirroring\n> +#\n> +# Copyright (C) 2017 Red Hat, Inc.\n> +#\n> +# This program is free software; you can redistribute it and/or modify\n> +# it under the terms of the GNU General Public License as published by\n> +# the Free Software Foundation; either version 2 of the License, or\n> +# (at your option) any later version.\n> +#\n> +# This program is distributed in the hope that it will be useful,\n> +# but WITHOUT ANY WARRANTY; without even the implied warranty of\n> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n> +# GNU General Public License for more details.\n> +#\n> +# You should have received a copy of the GNU General Public License\n> +# along with this program.  If not, see <http://www.gnu.org/licenses/>.\n> +#\n> +\n> +import os\n> +import iotests\n> +from iotests import qemu_img\n> +\n> +source_img = os.path.join(iotests.test_dir, 'source.' + iotests.imgfmt)\n> +target_img = os.path.join(iotests.test_dir, 'target.' + iotests.imgfmt)\n> +\n> +class TestActiveMirror(iotests.QMPTestCase):\n> +    image_len = 128 * 1024 * 1024 # MB\n> +    potential_writes_in_flight = True\n> +\n> +    def setUp(self):\n> +        qemu_img('create', '-f', iotests.imgfmt, source_img, '128M')\n> +        qemu_img('create', '-f', iotests.imgfmt, target_img, '128M')\n> +\n> +        blk_source = {'node-name': 'source',\n> +                      'driver': iotests.imgfmt,\n> +                      'file': {'driver': 'file',\n> +                               'filename': source_img}}\n> +\n> +        blk_target = {'node-name': 'target',\n> +                      'driver': iotests.imgfmt,\n> +                      'file': {'driver': 'file',\n> +                               'filename': target_img}}\n> +\n> +        self.vm = iotests.VM()\n> +        self.vm.add_blockdev(self.qmp_to_opts(blk_source))\n> +        self.vm.add_blockdev(self.qmp_to_opts(blk_target))\n> +        self.vm.launch()\n> +\n> +    def tearDown(self):\n> +        self.vm.shutdown()\n> +\n> +        if not self.potential_writes_in_flight:\n> +            self.assertTrue(iotests.compare_images(source_img, target_img),\n> +                            'mirror target does not match source')\n> +\n> +        os.remove(source_img)\n> +        os.remove(target_img)\n> +\n> +    def doActiveIO(self, sync_source_and_target):\n> +        # Fill the source image\n> +        self.vm.hmp_qemu_io('source',\n> +                            'write -P 1 0 %i' % self.image_len);\n> +\n> +        # Start some background requests\n> +        for offset in range(0, self.image_len, 1024 * 1024):\n> +            self.vm.hmp_qemu_io('source', 'write -B -P 2 %i 1M' % offset)\n> +\n> +        # Start the block job\n> +        result = self.vm.qmp('blockdev-mirror',\n> +                             job_id='mirror',\n> +                             filter_node_name='mirror-node',\n> +                             device='source',\n> +                             target='target',\n> +                             sync='full',\n> +                             copy_mode='active-write')\n> +        self.assert_qmp(result, 'return', {})\n> +\n> +        # Start some more requests\n> +        for offset in range(0, self.image_len, 1024 * 1024):\n> +            self.vm.hmp_qemu_io('mirror-node', 'write -B -P 3 %i 1M' % offset)\n> +\n> +        # Wait for the READY event\n> +        self.wait_ready(drive='mirror')\n> +\n> +        # Now start some final requests; all of these (which land on\n> +        # the source) should be settled using the active mechanism.\n> +        # The mirror code itself asserts that the source BDS's dirty\n> +        # bitmap will stay clean between READY and COMPLETED.\n> +        for offset in range(0, self.image_len, 1024 * 1024):\n> +            self.vm.hmp_qemu_io('mirror-node', 'write -B -P 4 %i 1M' % offset)\n> +\n> +        if sync_source_and_target:\n> +            # If source and target should be in sync after the mirror,\n> +            # we have to flush before completion\n\nNot sure I understand this requirements, does it apply to libvirt and user too?\nI.e. it's a part of the interface ? Why cannot mirror_complete do it\nautomatically?\n\nFam\n\n> +            self.vm.hmp_qemu_io('mirror-node', 'flush')\n> +            self.potential_writes_in_flight = False\n> +\n> +        self.complete_and_wait(drive='mirror', wait_ready=False)\n> +\n> +    def testActiveIO(self):\n> +        self.doActiveIO(False)\n> +\n> +    def testActiveIOFlushed(self):\n> +        self.doActiveIO(True)\n> +\n> +\n> +\n> +if __name__ == '__main__':\n> +    iotests.main(supported_fmts=['qcow2', 'raw'])\n> diff --git a/tests/qemu-iotests/151.out b/tests/qemu-iotests/151.out\n> new file mode 100644\n> index 0000000000..fbc63e62f8\n> --- /dev/null\n> +++ b/tests/qemu-iotests/151.out\n> @@ -0,0 +1,5 @@\n> +..\n> +----------------------------------------------------------------------\n> +Ran 2 tests\n> +\n> +OK\n> diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group\n> index 94e764865a..c64adbe5bf 100644\n> --- a/tests/qemu-iotests/group\n> +++ b/tests/qemu-iotests/group\n> @@ -156,6 +156,7 @@\n>  148 rw auto quick\n>  149 rw auto sudo\n>  150 rw auto quick\n> +151 rw auto\n>  152 rw auto quick\n>  153 rw auto quick\n>  154 rw auto backing quick\n> -- \n> 2.13.5\n>","headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","ext-mx08.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com","ext-mx08.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=famz@redhat.com"],"Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xwc3J1RxJz9s4s\n\tfor <incoming@patchwork.ozlabs.org>;\n\tMon, 18 Sep 2017 16:46:04 +1000 (AEST)","from localhost ([::1]:34948 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1dtpog-0003Zt-9z\n\tfor incoming@patchwork.ozlabs.org; Mon, 18 Sep 2017 02:46:02 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:47790)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <famz@redhat.com>) id 1dtpoA-0003YH-Jl\n\tfor qemu-devel@nongnu.org; Mon, 18 Sep 2017 02:45:32 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <famz@redhat.com>) id 1dtpo9-0003jh-54\n\tfor qemu-devel@nongnu.org; Mon, 18 Sep 2017 02:45:30 -0400","from mx1.redhat.com ([209.132.183.28]:50340)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <famz@redhat.com>)\n\tid 1dtpo2-0003hc-6U; Mon, 18 Sep 2017 02:45:22 -0400","from smtp.corp.redhat.com\n\t(int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id 36FC4C0587D4;\n\tMon, 18 Sep 2017 06:45:21 +0000 (UTC)","from localhost (ovpn-12-141.pek2.redhat.com [10.72.12.141])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id E171B60BEC;\n\tMon, 18 Sep 2017 06:45:16 +0000 (UTC)"],"DMARC-Filter":"OpenDMARC Filter v1.3.2 mx1.redhat.com 36FC4C0587D4","Date":"Mon, 18 Sep 2017 14:45:15 +0800","From":"Fam Zheng <famz@redhat.com>","To":"Max Reitz <mreitz@redhat.com>","Message-ID":"<20170918064515.GF15551@lemon.lan>","References":"<20170913181910.29688-1-mreitz@redhat.com>\n\t<20170913181910.29688-19-mreitz@redhat.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<20170913181910.29688-19-mreitz@redhat.com>","User-Agent":"Mutt/1.8.3 (2017-05-23)","X-Scanned-By":"MIMEDefang 2.79 on 10.5.11.13","X-Greylist":"Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.32]);\n\tMon, 18 Sep 2017 06:45:21 +0000 (UTC)","X-detected-operating-system":"by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]\n\t[fuzzy]","X-Received-From":"209.132.183.28","Subject":"Re: [Qemu-devel] [PATCH 18/18] iotests: Add test for active\n\tmirroring","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"Kevin Wolf <kwolf@redhat.com>, John Snow <jsnow@redhat.com>,\n\tStefan Hajnoczi <stefanha@redhat.com>, qemu-devel@nongnu.org,\n\tqemu-block@nongnu.org","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"}},{"id":1770318,"web_url":"http://patchwork.ozlabs.org/comment/1770318/","msgid":"<ea1f7b60-4b95-f40a-2dc9-e368a74b3de5@redhat.com>","list_archive_url":null,"date":"2017-09-18T16:53:51","subject":"Re: [Qemu-devel] [PATCH 18/18] iotests: Add test for active\n\tmirroring","submitter":{"id":36836,"url":"http://patchwork.ozlabs.org/api/people/36836/","name":"Max Reitz","email":"mreitz@redhat.com"},"content":"On 2017-09-18 08:45, Fam Zheng wrote:\n> On Wed, 09/13 20:19, Max Reitz wrote:\n>> Signed-off-by: Max Reitz <mreitz@redhat.com>\n>> ---\n>>  tests/qemu-iotests/151     | 111 +++++++++++++++++++++++++++++++++++++++++++++\n>>  tests/qemu-iotests/151.out |   5 ++\n>>  tests/qemu-iotests/group   |   1 +\n>>  3 files changed, 117 insertions(+)\n>>  create mode 100755 tests/qemu-iotests/151\n>>  create mode 100644 tests/qemu-iotests/151.out\n>>\n>> diff --git a/tests/qemu-iotests/151 b/tests/qemu-iotests/151\n>> new file mode 100755\n>> index 0000000000..49a60773f9\n>> --- /dev/null\n>> +++ b/tests/qemu-iotests/151\n>> @@ -0,0 +1,111 @@\n>> +#!/usr/bin/env python\n>> +#\n>> +# Tests for active mirroring\n>> +#\n>> +# Copyright (C) 2017 Red Hat, Inc.\n>> +#\n>> +# This program is free software; you can redistribute it and/or modify\n>> +# it under the terms of the GNU General Public License as published by\n>> +# the Free Software Foundation; either version 2 of the License, or\n>> +# (at your option) any later version.\n>> +#\n>> +# This program is distributed in the hope that it will be useful,\n>> +# but WITHOUT ANY WARRANTY; without even the implied warranty of\n>> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n>> +# GNU General Public License for more details.\n>> +#\n>> +# You should have received a copy of the GNU General Public License\n>> +# along with this program.  If not, see <http://www.gnu.org/licenses/>.\n>> +#\n>> +\n>> +import os\n>> +import iotests\n>> +from iotests import qemu_img\n>> +\n>> +source_img = os.path.join(iotests.test_dir, 'source.' + iotests.imgfmt)\n>> +target_img = os.path.join(iotests.test_dir, 'target.' + iotests.imgfmt)\n>> +\n>> +class TestActiveMirror(iotests.QMPTestCase):\n>> +    image_len = 128 * 1024 * 1024 # MB\n>> +    potential_writes_in_flight = True\n>> +\n>> +    def setUp(self):\n>> +        qemu_img('create', '-f', iotests.imgfmt, source_img, '128M')\n>> +        qemu_img('create', '-f', iotests.imgfmt, target_img, '128M')\n>> +\n>> +        blk_source = {'node-name': 'source',\n>> +                      'driver': iotests.imgfmt,\n>> +                      'file': {'driver': 'file',\n>> +                               'filename': source_img}}\n>> +\n>> +        blk_target = {'node-name': 'target',\n>> +                      'driver': iotests.imgfmt,\n>> +                      'file': {'driver': 'file',\n>> +                               'filename': target_img}}\n>> +\n>> +        self.vm = iotests.VM()\n>> +        self.vm.add_blockdev(self.qmp_to_opts(blk_source))\n>> +        self.vm.add_blockdev(self.qmp_to_opts(blk_target))\n>> +        self.vm.launch()\n>> +\n>> +    def tearDown(self):\n>> +        self.vm.shutdown()\n>> +\n>> +        if not self.potential_writes_in_flight:\n>> +            self.assertTrue(iotests.compare_images(source_img, target_img),\n>> +                            'mirror target does not match source')\n>> +\n>> +        os.remove(source_img)\n>> +        os.remove(target_img)\n>> +\n>> +    def doActiveIO(self, sync_source_and_target):\n>> +        # Fill the source image\n>> +        self.vm.hmp_qemu_io('source',\n>> +                            'write -P 1 0 %i' % self.image_len);\n>> +\n>> +        # Start some background requests\n>> +        for offset in range(0, self.image_len, 1024 * 1024):\n>> +            self.vm.hmp_qemu_io('source', 'write -B -P 2 %i 1M' % offset)\n>> +\n>> +        # Start the block job\n>> +        result = self.vm.qmp('blockdev-mirror',\n>> +                             job_id='mirror',\n>> +                             filter_node_name='mirror-node',\n>> +                             device='source',\n>> +                             target='target',\n>> +                             sync='full',\n>> +                             copy_mode='active-write')\n>> +        self.assert_qmp(result, 'return', {})\n>> +\n>> +        # Start some more requests\n>> +        for offset in range(0, self.image_len, 1024 * 1024):\n>> +            self.vm.hmp_qemu_io('mirror-node', 'write -B -P 3 %i 1M' % offset)\n>> +\n>> +        # Wait for the READY event\n>> +        self.wait_ready(drive='mirror')\n>> +\n>> +        # Now start some final requests; all of these (which land on\n>> +        # the source) should be settled using the active mechanism.\n>> +        # The mirror code itself asserts that the source BDS's dirty\n>> +        # bitmap will stay clean between READY and COMPLETED.\n>> +        for offset in range(0, self.image_len, 1024 * 1024):\n>> +            self.vm.hmp_qemu_io('mirror-node', 'write -B -P 4 %i 1M' % offset)\n>> +\n>> +        if sync_source_and_target:\n>> +            # If source and target should be in sync after the mirror,\n>> +            # we have to flush before completion\n> \n> Not sure I understand this requirements, does it apply to libvirt and user too?\n> I.e. it's a part of the interface ? Why cannot mirror_complete do it\n> automatically?\n\nWell, it seems to pass without this flush, but the original intention\nwas this: When mirror is completed, the source node is replaced by the\ntarget.  All further writes are then only executed on the (former)\ntarget node.  So what might happen (or at least I think it could) is\nthat qemu-io submits some writes, but before they are actually\nperformed, the mirror block job is completed and the source is replaced\nby the target.  Then, the write operations are performed on the target\nbut no longer on the source, so source and target are then out of sync.\n\nFor the mirror block job, that is fine -- at the point of completion,\nsource and target were in sync.  The job doesn't care that they get out\nof sync after completion.  But here, we have to care or we can't compare\nsource and target.\n\nThe reason for why it always seems to pass without a flush is that every\nsubmitted write is actually sent to the mirror node before it yields for\nthe first time.  But I wouldn't bet on that, so I think it's better to\nkeep the flush before completing the block job.\n\nMax\n\n> \n> Fam\n> \n>> +            self.vm.hmp_qemu_io('mirror-node', 'flush')\n>> +            self.potential_writes_in_flight = False\n>> +\n>> +        self.complete_and_wait(drive='mirror', wait_ready=False)\n>> +\n>> +    def testActiveIO(self):\n>> +        self.doActiveIO(False)\n>> +\n>> +    def testActiveIOFlushed(self):\n>> +        self.doActiveIO(True)\n>> +\n>> +\n>> +\n>> +if __name__ == '__main__':\n>> +    iotests.main(supported_fmts=['qcow2', 'raw'])\n>> diff --git a/tests/qemu-iotests/151.out b/tests/qemu-iotests/151.out\n>> new file mode 100644\n>> index 0000000000..fbc63e62f8\n>> --- /dev/null\n>> +++ b/tests/qemu-iotests/151.out\n>> @@ -0,0 +1,5 @@\n>> +..\n>> +----------------------------------------------------------------------\n>> +Ran 2 tests\n>> +\n>> +OK\n>> diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group\n>> index 94e764865a..c64adbe5bf 100644\n>> --- a/tests/qemu-iotests/group\n>> +++ b/tests/qemu-iotests/group\n>> @@ -156,6 +156,7 @@\n>>  148 rw auto quick\n>>  149 rw auto sudo\n>>  150 rw auto quick\n>> +151 rw auto\n>>  152 rw auto quick\n>>  153 rw auto quick\n>>  154 rw auto backing quick\n>> -- \n>> 2.13.5\n>>","headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","ext-mx03.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com","ext-mx03.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=mreitz@redhat.com"],"Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xwsYf0VDZz9s7g\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue, 19 Sep 2017 02:54:46 +1000 (AEST)","from localhost ([::1]:37891 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1dtzJk-0003xD-3l\n\tfor incoming@patchwork.ozlabs.org; Mon, 18 Sep 2017 12:54:44 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:59361)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <mreitz@redhat.com>) id 1dtzJF-0003vC-0g\n\tfor qemu-devel@nongnu.org; Mon, 18 Sep 2017 12:54:14 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <mreitz@redhat.com>) id 1dtzJD-0000Kk-J3\n\tfor qemu-devel@nongnu.org; Mon, 18 Sep 2017 12:54:13 -0400","from mx1.redhat.com ([209.132.183.28]:38212)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <mreitz@redhat.com>)\n\tid 1dtzJ8-0000Df-5E; Mon, 18 Sep 2017 12:54:06 -0400","from smtp.corp.redhat.com\n\t(int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id 2AEE67E43E;\n\tMon, 18 Sep 2017 16:54:05 +0000 (UTC)","from dresden.str.redhat.com (unknown [10.40.205.73])\n\tby smtp.corp.redhat.com (Postfix) with ESMTPS id A09DF5D6A6;\n\tMon, 18 Sep 2017 16:53:53 +0000 (UTC)"],"DMARC-Filter":"OpenDMARC Filter v1.3.2 mx1.redhat.com 2AEE67E43E","To":"Fam Zheng <famz@redhat.com>","References":"<20170913181910.29688-1-mreitz@redhat.com>\n\t<20170913181910.29688-19-mreitz@redhat.com>\n\t<20170918064515.GF15551@lemon.lan>","From":"Max Reitz <mreitz@redhat.com>","Message-ID":"<ea1f7b60-4b95-f40a-2dc9-e368a74b3de5@redhat.com>","Date":"Mon, 18 Sep 2017 18:53:51 +0200","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101\n\tThunderbird/52.3.0","MIME-Version":"1.0","In-Reply-To":"<20170918064515.GF15551@lemon.lan>","Content-Type":"multipart/signed; micalg=pgp-sha256;\n\tprotocol=\"application/pgp-signature\";\n\tboundary=\"ec0Eb59FBegLR1hsCuIHq0tOgDkigexvW\"","X-Scanned-By":"MIMEDefang 2.79 on 10.5.11.15","X-Greylist":"Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.27]);\n\tMon, 18 Sep 2017 16:54:05 +0000 (UTC)","X-detected-operating-system":"by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]\n\t[fuzzy]","X-Received-From":"209.132.183.28","X-Content-Filtered-By":"Mailman/MimeDel 2.1.21","Subject":"Re: [Qemu-devel] [PATCH 18/18] iotests: Add test for active\n\tmirroring","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"Kevin Wolf <kwolf@redhat.com>, John Snow <jsnow@redhat.com>,\n\tStefan Hajnoczi <stefanha@redhat.com>, qemu-devel@nongnu.org,\n\tqemu-block@nongnu.org","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"}},{"id":1770732,"web_url":"http://patchwork.ozlabs.org/comment/1770732/","msgid":"<20170919080858.GD11534@lemon.lan>","list_archive_url":null,"date":"2017-09-19T08:08:58","subject":"Re: [Qemu-devel] [PATCH 18/18] iotests: Add test for active\n\tmirroring","submitter":{"id":24872,"url":"http://patchwork.ozlabs.org/api/people/24872/","name":"Fam Zheng","email":"famz@redhat.com"},"content":"On Mon, 09/18 18:53, Max Reitz wrote:\n> >> +\n> >> +        if sync_source_and_target:\n> >> +            # If source and target should be in sync after the mirror,\n> >> +            # we have to flush before completion\n> > \n> > Not sure I understand this requirements, does it apply to libvirt and user too?\n> > I.e. it's a part of the interface ? Why cannot mirror_complete do it\n> > automatically?\n> \n> Well, it seems to pass without this flush, but the original intention\n> was this: When mirror is completed, the source node is replaced by the\n> target.  All further writes are then only executed on the (former)\n> target node.  So what might happen (or at least I think it could) is\n> that qemu-io submits some writes, but before they are actually\n> performed, the mirror block job is completed and the source is replaced\n> by the target.  Then, the write operations are performed on the target\n> but no longer on the source, so source and target are then out of sync.\n> For the mirror block job, that is fine -- at the point of completion,\n> source and target were in sync.  The job doesn't care that they get out\n> of sync after completion.  But here, we have to care or we can't compare\n> source and target.\n> \n> The reason for why it always seems to pass without a flush is that every\n> submitted write is actually sent to the mirror node before it yields for\n> the first time.  But I wouldn't bet on that, so I think it's better to\n> keep the flush before completing the block job.\n\nOK, that makes sense. Thanks.\n\nFam","headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","ext-mx01.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com","ext-mx01.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=famz@redhat.com"],"Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xxFsH542kz9s7M\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue, 19 Sep 2017 18:09:39 +1000 (AEST)","from localhost ([::1]:40698 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1duDb7-0006xi-R2\n\tfor incoming@patchwork.ozlabs.org; Tue, 19 Sep 2017 04:09:37 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:57418)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <famz@redhat.com>) id 1duDaj-0006t9-23\n\tfor qemu-devel@nongnu.org; Tue, 19 Sep 2017 04:09:19 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <famz@redhat.com>) id 1duDai-0004Tj-4T\n\tfor qemu-devel@nongnu.org; Tue, 19 Sep 2017 04:09:13 -0400","from mx1.redhat.com ([209.132.183.28]:44106)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <famz@redhat.com>)\n\tid 1duDab-0004Qt-5b; Tue, 19 Sep 2017 04:09:05 -0400","from smtp.corp.redhat.com\n\t(int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id 288C681DE6;\n\tTue, 19 Sep 2017 08:09:04 +0000 (UTC)","from localhost (ovpn-12-162.pek2.redhat.com [10.72.12.162])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id 970B55C891;\n\tTue, 19 Sep 2017 08:08:59 +0000 (UTC)"],"DMARC-Filter":"OpenDMARC Filter v1.3.2 mx1.redhat.com 288C681DE6","Date":"Tue, 19 Sep 2017 16:08:58 +0800","From":"Fam Zheng <famz@redhat.com>","To":"Max Reitz <mreitz@redhat.com>","Message-ID":"<20170919080858.GD11534@lemon.lan>","References":"<20170913181910.29688-1-mreitz@redhat.com>\n\t<20170913181910.29688-19-mreitz@redhat.com>\n\t<20170918064515.GF15551@lemon.lan>\n\t<ea1f7b60-4b95-f40a-2dc9-e368a74b3de5@redhat.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<ea1f7b60-4b95-f40a-2dc9-e368a74b3de5@redhat.com>","User-Agent":"Mutt/1.8.3 (2017-05-23)","X-Scanned-By":"MIMEDefang 2.79 on 10.5.11.16","X-Greylist":"Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.25]);\n\tTue, 19 Sep 2017 08:09:04 +0000 (UTC)","X-detected-operating-system":"by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]\n\t[fuzzy]","X-Received-From":"209.132.183.28","Subject":"Re: [Qemu-devel] [PATCH 18/18] iotests: Add test for active\n\tmirroring","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"Kevin Wolf <kwolf@redhat.com>, John Snow <jsnow@redhat.com>,\n\tStefan Hajnoczi <stefanha@redhat.com>, qemu-devel@nongnu.org,\n\tqemu-block@nongnu.org","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"}}]