get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/813569/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 813569,
    "url": "http://patchwork.ozlabs.org/api/patches/813569/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20170913181910.29688-19-mreitz@redhat.com/",
    "project": {
        "id": 14,
        "url": "http://patchwork.ozlabs.org/api/projects/14/?format=api",
        "name": "QEMU Development",
        "link_name": "qemu-devel",
        "list_id": "qemu-devel.nongnu.org",
        "list_email": "qemu-devel@nongnu.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": "",
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20170913181910.29688-19-mreitz@redhat.com>",
    "list_archive_url": null,
    "date": "2017-09-13T18:19:10",
    "name": "[18/18] iotests: Add test for active mirroring",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "87a1eddb93850ec1cea0cd8f661092af81d73e53",
    "submitter": {
        "id": 36836,
        "url": "http://patchwork.ozlabs.org/api/people/36836/?format=api",
        "name": "Max Reitz",
        "email": "mreitz@redhat.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20170913181910.29688-19-mreitz@redhat.com/mbox/",
    "series": [
        {
            "id": 2960,
            "url": "http://patchwork.ozlabs.org/api/series/2960/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=2960",
            "date": "2017-09-13T18:18:52",
            "name": "block/mirror: Add active-sync mirroring",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/2960/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/813569/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/813569/checks/",
    "tags": {},
    "related": [],
    "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 3xsqz20VH4z9rxl\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 14 Sep 2017 04:32:46 +1000 (AEST)",
            "from localhost ([::1]:44060 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 1dsCSq-0002JE-49\n\tfor incoming@patchwork.ozlabs.org; Wed, 13 Sep 2017 14:32:44 -0400",
            "from eggs.gnu.org ([2001:4830:134:3::10]:38017)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <mreitz@redhat.com>) id 1dsCIm-0001T4-HX\n\tfor qemu-devel@nongnu.org; Wed, 13 Sep 2017 14:22:21 -0400",
            "from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <mreitz@redhat.com>) id 1dsCIl-0006rI-4K\n\tfor qemu-devel@nongnu.org; Wed, 13 Sep 2017 14:22:20 -0400",
            "from mx1.redhat.com ([209.132.183.28]:52766)\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 1dsCIe-0006lJ-Dt; Wed, 13 Sep 2017 14:22:12 -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 7E3A580F94;\n\tWed, 13 Sep 2017 18:22:11 +0000 (UTC)",
            "from localhost (ovpn-204-23.brq.redhat.com [10.40.204.23])\n\tby smtp.corp.redhat.com (Postfix) with ESMTPS id 74FC560600;\n\tWed, 13 Sep 2017 18:22:04 +0000 (UTC)"
        ],
        "DMARC-Filter": "OpenDMARC Filter v1.3.2 mx1.redhat.com 7E3A580F94",
        "From": "Max Reitz <mreitz@redhat.com>",
        "To": "qemu-block@nongnu.org",
        "Date": "Wed, 13 Sep 2017 20:19:10 +0200",
        "Message-Id": "<20170913181910.29688-19-mreitz@redhat.com>",
        "In-Reply-To": "<20170913181910.29688-1-mreitz@redhat.com>",
        "References": "<20170913181910.29688-1-mreitz@redhat.com>",
        "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.27]);\n\tWed, 13 Sep 2017 18:22:11 +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": "[Qemu-devel] [PATCH 18/18] iotests: Add test for active mirroring",
        "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>, Fam Zheng <famz@redhat.com>,\n\tqemu-devel@nongnu.org, Max Reitz <mreitz@redhat.com>,\n\tStefan Hajnoczi <stefanha@redhat.com>, John Snow <jsnow@redhat.com>",
        "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>"
    },
    "content": "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",
    "diff": "diff --git a/tests/qemu-iotests/151 b/tests/qemu-iotests/151\nnew file mode 100755\nindex 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+            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'])\ndiff --git a/tests/qemu-iotests/151.out b/tests/qemu-iotests/151.out\nnew file mode 100644\nindex 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\ndiff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group\nindex 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",
    "prefixes": [
        "18/18"
    ]
}