get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 2215817,
    "url": "http://patchwork.ozlabs.org/api/patches/2215817/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260325111140.347421-2-f.ebner@proxmox.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": "<20260325111140.347421-2-f.ebner@proxmox.com>",
    "list_archive_url": null,
    "date": "2026-03-25T11:11:03",
    "name": "[v3,1/2] iotests/041: add test for mirror with throttled NBD export as target",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "c49319d8b431f0d43533ed2bbdbeef539d6f79b6",
    "submitter": {
        "id": 82206,
        "url": "http://patchwork.ozlabs.org/api/people/82206/?format=api",
        "name": "Fiona Ebner",
        "email": "f.ebner@proxmox.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260325111140.347421-2-f.ebner@proxmox.com/mbox/",
    "series": [
        {
            "id": 497423,
            "url": "http://patchwork.ozlabs.org/api/series/497423/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=497423",
            "date": "2026-03-25T11:11:02",
            "name": "block/mirror: fix assertion failure upon duplicate complete for job using 'replaces'",
            "version": 3,
            "mbox": "http://patchwork.ozlabs.org/series/497423/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2215817/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2215817/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@legolas.ozlabs.org",
        "Authentication-Results": "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org\n (client-ip=209.51.188.17; helo=lists.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)",
        "Received": [
            "from lists.gnu.org (lists.gnu.org [209.51.188.17])\n\t(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fgkll0DNQz1xy3\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 25 Mar 2026 22:12:51 +1100 (AEDT)",
            "from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1w5M9j-0002RQ-4y; Wed, 25 Mar 2026 07:12:11 -0400",
            "from eggs.gnu.org ([2001:470:142:3::10])\n by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <f.ebner@proxmox.com>)\n id 1w5M9R-0002Mg-VI; Wed, 25 Mar 2026 07:11:54 -0400",
            "from proxmox-new.maurer-it.com ([94.136.29.106])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <f.ebner@proxmox.com>)\n id 1w5M9O-0003Ob-UM; Wed, 25 Mar 2026 07:11:53 -0400",
            "from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1])\n by proxmox-new.maurer-it.com (Proxmox) with ESMTP id CCD7F49019;\n Wed, 25 Mar 2026 12:11:48 +0100 (CET)"
        ],
        "From": "Fiona Ebner <f.ebner@proxmox.com>",
        "To": "qemu-devel@nongnu.org",
        "Cc": "qemu-block@nongnu.org,\n\threitz@redhat.com,\n\tkwolf@redhat.com",
        "Subject": "[PATCH v3 1/2] iotests/041: add test for mirror with throttled NBD\n export as target",
        "Date": "Wed, 25 Mar 2026 12:11:03 +0100",
        "Message-ID": "<20260325111140.347421-2-f.ebner@proxmox.com>",
        "X-Mailer": "git-send-email 2.47.3",
        "In-Reply-To": "<20260325111140.347421-1-f.ebner@proxmox.com>",
        "References": "<20260325111140.347421-1-f.ebner@proxmox.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "X-Bm-Milter-Handled": "55990f41-d878-4baa-be0a-ee34c49e34d2",
        "X-Bm-Transport-Timestamp": "1774437060106",
        "Received-SPF": "pass client-ip=94.136.29.106; envelope-from=f.ebner@proxmox.com;\n helo=proxmox-new.maurer-it.com",
        "X-Spam_score_int": "-18",
        "X-Spam_score": "-1.9",
        "X-Spam_bar": "-",
        "X-Spam_report": "(-1.9 / 5.0 requ) BAYES_00=-1.9,\n RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001,\n SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no",
        "X-Spam_action": "no action",
        "X-BeenThere": "qemu-devel@nongnu.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "qemu development <qemu-devel.nongnu.org>",
        "List-Unsubscribe": "<https://lists.nongnu.org/mailman/options/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>",
        "List-Archive": "<https://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 <mailto:qemu-devel-request@nongnu.org?subject=subscribe>",
        "Errors-To": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org",
        "Sender": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org"
    },
    "content": "Mostly in preparation for commit \"iotests/041: add test for duplicate\njob-complete with throttled target\".\n\nUse a second VM instance for providing the NBD export rather than\nqemu-storage-daemon, because the latter does not support qtest for\nstepping the clock.\n\nUse copy_mode='write-blocking' for easy checking how many bytes were\nwritten in a given time. In the job's offset, the numbers are\ninflated, since a 1 KiB write will mean copying a full cluster of\n64 KiB.\n\nSigned-off-by: Fiona Ebner <f.ebner@proxmox.com>\n---\n\nChanges in v3:\n* In the first test, avoid testing that all requests complete in a\n  given time. This is prone to flakiness. Instead, complete the job\n  under throttle.\n\n tests/qemu-iotests/041     | 146 +++++++++++++++++++++++++++++++++++++\n tests/qemu-iotests/041.out |   4 +-\n 2 files changed, 148 insertions(+), 2 deletions(-)",
    "diff": "diff --git a/tests/qemu-iotests/041 b/tests/qemu-iotests/041\nindex 8452845f44..976a12a6f2 100755\n--- a/tests/qemu-iotests/041\n+++ b/tests/qemu-iotests/041\n@@ -1373,6 +1373,152 @@ class TestFilters(iotests.QMPTestCase):\n \n         self.complete_and_wait('mirror')\n \n+# Tests for mirror where the target is a throttled NBD export.\n+class TestThrottledNBDTarget(iotests.QMPTestCase):\n+    image_len = 32 * 1024 * 1024\n+    reqs = 20\n+    req_len = 1024\n+\n+    def setUp(self):\n+        iotests.create_image(backing_img, self.image_len)\n+        iotests.create_image(target_backing_img, self.image_len)\n+        qemu_img('create', '-f', iotests.imgfmt,\n+                 '-o', f'backing_file={backing_img}', '-F', 'raw', test_img)\n+        qemu_img('create', '-f', iotests.imgfmt,\n+                 '-o', f'backing_file={target_backing_img}', '-F', 'raw',\n+                 target_img)\n+        qemu_io('-c', f'write -P 23 0 {self.image_len}', test_img)\n+\n+        self.target_vm = iotests.VM()\n+        self.target_vm.launch()\n+\n+        self.target_vm.cmd('nbd-server-start', {\n+            'addr': {\n+                'type': 'unix',\n+                'data': {\n+                    'path': nbd_sock_path\n+                }\n+            }\n+        })\n+\n+        self.target_vm.cmd('object-add', {\n+            'qom-type': 'throttle-group',\n+            'id': 'thrgr-target',\n+            'limits': {} # limits are set by the individual tests\n+        })\n+\n+        self.target_vm.cmd('blockdev-add', {\n+            'node-name': 'target',\n+            'driver': 'throttle',\n+            'throttle-group': 'thrgr-target',\n+            'file': {\n+                'driver': iotests.imgfmt,\n+                'file': {\n+                    'driver': 'file',\n+                    'filename': target_img\n+                }\n+            }\n+        })\n+\n+        self.target_vm.cmd('block-export-add', {\n+            'id': 'exp0',\n+            'type': 'nbd',\n+            'node-name': 'target',\n+            'writable': True\n+        })\n+\n+        self.vm = iotests.VM().add_device('virtio-scsi,id=vio-scsi')\n+        self.vm.launch()\n+\n+        self.vm.cmd('blockdev-add',{\n+            'node-name': 'source',\n+            'driver': iotests.imgfmt,\n+            'file': {\n+                'driver': 'file',\n+                'filename': test_img\n+            },\n+            'backing': {\n+                'node-name': 'backing',\n+                'driver': 'raw',\n+                'file': {\n+                    'driver': 'file',\n+                    'filename': backing_img\n+                }\n+            }\n+        })\n+\n+        self.vm.cmd('device_add',\n+                    driver='scsi-hd',\n+                    id='virtio',\n+                    bus='vio-scsi.0',\n+                    drive='source')\n+\n+        self.vm.cmd('blockdev-add', {\n+            'node-name': 'target',\n+            'driver': 'nbd',\n+            'export': 'target',\n+            'server': {\n+                'type': 'unix',\n+                'path': nbd_sock_path\n+            }\n+        })\n+\n+        self.drive_qdev = '/machine/peripheral/virtio'\n+\n+    def set_throttle_limits(self, limits):\n+        self.target_vm.cmd('qom-set', {\n+            'path': 'thrgr-target',\n+            'property': 'limits',\n+            'value': limits\n+        })\n+\n+    def disable_throttling(self):\n+        if self.target_vm.is_running():\n+            self.set_throttle_limits({})\n+            for i in range(0, self.reqs):\n+                self.target_vm.qtest(f'clock_step {1 * 1000 * 1000 * 1000}')\n+\n+    def tearDown(self):\n+        if self.target_vm.is_running():\n+            self.disable_throttling()\n+            self.target_vm.shutdown()\n+        self.vm.shutdown()\n+        os.remove(test_img)\n+        os.remove(target_img)\n+        os.remove(backing_img)\n+        os.remove(target_backing_img)\n+\n+    def test_throttled(self):\n+        self.vm.cmd('blockdev-mirror',\n+                    job_id='mirror',\n+                    device='source',\n+                    target='target',\n+                    sync='full',\n+                    copy_mode='write-blocking')\n+\n+        self.wait_ready('mirror')\n+\n+        self.set_throttle_limits({'iops-write': 1})\n+\n+        # Issue requests that will be throttled.\n+        for i in range(0, self.reqs):\n+            req = f'aio_write -P 7 {i}M {self.req_len}'\n+            self.vm.hmp_qemu_io(self.drive_qdev, req, qdev=True)\n+\n+        # Check that requests do not complete faster than 1 per second. They\n+        # might complete in batches, so do not check for exactly 1 per second.\n+        for i in range(0, self.reqs):\n+            result = self.vm.cmd('query-blockstats')\n+            assert result[0]['stats']['wr_bytes'] <= (i + 1) * self.req_len\n+\n+            self.target_vm.qtest(f'clock_step {1 * 1000 * 1000 * 1000}')\n+            time.sleep(0.1)\n+\n+        self.complete_and_wait('mirror', wait_ready=False)\n+        self.target_vm.shutdown()\n+        self.vm.shutdown()\n+        self.assertTrue(iotests.compare_images(test_img, target_img),\n+                        'target image does not match source after mirroring')\n \n if __name__ == '__main__':\n     iotests.main(supported_fmts=['qcow2', 'qed'],\ndiff --git a/tests/qemu-iotests/041.out b/tests/qemu-iotests/041.out\nindex 46651953e8..5273ce86c3 100644\n--- a/tests/qemu-iotests/041.out\n+++ b/tests/qemu-iotests/041.out\n@@ -1,5 +1,5 @@\n-...........................................................................................................\n+............................................................................................................\n ----------------------------------------------------------------------\n-Ran 107 tests\n+Ran 108 tests\n \n OK\n",
    "prefixes": [
        "v3",
        "1/2"
    ]
}