get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 813571,
    "url": "http://patchwork.ozlabs.org/api/patches/813571/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20170913181910.29688-17-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-17-mreitz@redhat.com>",
    "list_archive_url": null,
    "date": "2017-09-13T18:19:08",
    "name": "[16/18] block/mirror: Add copy mode QAPI interface",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "cad10bbcbb37222b0624dae000105133cffc1449",
    "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-17-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/813571/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/813571/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-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=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 3xsqzX2bgNz9s83\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 14 Sep 2017 04:33:12 +1000 (AEST)",
            "from localhost ([::1]:44065 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 1dsCTG-0002kX-EH\n\tfor incoming@patchwork.ozlabs.org; Wed, 13 Sep 2017 14:33:10 -0400",
            "from eggs.gnu.org ([2001:4830:134:3::10]:37893)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <mreitz@redhat.com>) id 1dsCIa-0001FP-E2\n\tfor qemu-devel@nongnu.org; Wed, 13 Sep 2017 14:22:09 -0400",
            "from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <mreitz@redhat.com>) id 1dsCIW-0006e5-8e\n\tfor qemu-devel@nongnu.org; Wed, 13 Sep 2017 14:22:08 -0400",
            "from mx1.redhat.com ([209.132.183.28]:46316)\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 1dsCIS-0006ar-O8; Wed, 13 Sep 2017 14:22:01 -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 D5273C0587ED;\n\tWed, 13 Sep 2017 18:21:59 +0000 (UTC)",
            "from localhost (ovpn-204-23.brq.redhat.com [10.40.204.23])\n\tby smtp.corp.redhat.com (Postfix) with ESMTPS id A43775D6AE;\n\tWed, 13 Sep 2017 18:21:53 +0000 (UTC)"
        ],
        "DMARC-Filter": "OpenDMARC Filter v1.3.2 mx1.redhat.com D5273C0587ED",
        "From": "Max Reitz <mreitz@redhat.com>",
        "To": "qemu-block@nongnu.org",
        "Date": "Wed, 13 Sep 2017 20:19:08 +0200",
        "Message-Id": "<20170913181910.29688-17-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.15",
        "X-Greylist": "Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.32]);\n\tWed, 13 Sep 2017 18:21:59 +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 16/18] block/mirror: Add copy mode QAPI\n\tinterface",
        "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": "This patch allows the user to specify whether to use active or only\npassive mode for mirror block jobs.  Currently, this setting will remain\nconstant for the duration of the entire block job.\n\nSigned-off-by: Max Reitz <mreitz@redhat.com>\n---\n qapi/block-core.json      | 11 +++++++++--\n include/block/block_int.h |  4 +++-\n block/mirror.c            | 11 ++++++-----\n blockdev.c                |  9 ++++++++-\n 4 files changed, 26 insertions(+), 9 deletions(-)",
    "diff": "diff --git a/qapi/block-core.json b/qapi/block-core.json\nindex e072cfa67c..40204d367a 100644\n--- a/qapi/block-core.json\n+++ b/qapi/block-core.json\n@@ -1578,6 +1578,9 @@\n #         written. Both will result in identical contents.\n #         Default is true. (Since 2.4)\n #\n+# @copy-mode: when to copy data to the destination; defaults to 'passive'\n+#             (Since: 2.11)\n+#\n # Since: 1.3\n ##\n { 'struct': 'DriveMirror',\n@@ -1587,7 +1590,7 @@\n             '*speed': 'int', '*granularity': 'uint32',\n             '*buf-size': 'int', '*on-source-error': 'BlockdevOnError',\n             '*on-target-error': 'BlockdevOnError',\n-            '*unmap': 'bool' } }\n+            '*unmap': 'bool', '*copy-mode': 'MirrorCopyMode' } }\n \n ##\n # @BlockDirtyBitmap:\n@@ -1766,6 +1769,9 @@\n #                    above @device. If this option is not given, a node name is\n #                    autogenerated. (Since: 2.9)\n #\n+# @copy-mode: when to copy data to the destination; defaults to 'passive'\n+#             (Since: 2.11)\n+#\n # Returns: nothing on success.\n #\n # Since: 2.6\n@@ -1786,7 +1792,8 @@\n             '*speed': 'int', '*granularity': 'uint32',\n             '*buf-size': 'int', '*on-source-error': 'BlockdevOnError',\n             '*on-target-error': 'BlockdevOnError',\n-            '*filter-node-name': 'str' } }\n+            '*filter-node-name': 'str',\n+            '*copy-mode': 'MirrorCopyMode' } }\n \n ##\n # @block_set_io_throttle:\ndiff --git a/include/block/block_int.h b/include/block/block_int.h\nindex fa8bbf1f8b..517b2680ce 100644\n--- a/include/block/block_int.h\n+++ b/include/block/block_int.h\n@@ -934,6 +934,7 @@ void commit_active_start(const char *job_id, BlockDriverState *bs,\n  * @filter_node_name: The node name that should be assigned to the filter\n  * driver that the mirror job inserts into the graph above @bs. NULL means that\n  * a node name should be autogenerated.\n+ * @copy_mode: When to trigger writes to the target.\n  * @errp: Error object.\n  *\n  * Start a mirroring operation on @bs.  Clusters that are allocated\n@@ -947,7 +948,8 @@ void mirror_start(const char *job_id, BlockDriverState *bs,\n                   MirrorSyncMode mode, BlockMirrorBackingMode backing_mode,\n                   BlockdevOnError on_source_error,\n                   BlockdevOnError on_target_error,\n-                  bool unmap, const char *filter_node_name, Error **errp);\n+                  bool unmap, const char *filter_node_name,\n+                  MirrorCopyMode copy_mode, Error **errp);\n \n /*\n  * backup_job_create:\ndiff --git a/block/mirror.c b/block/mirror.c\nindex c429aa77bb..8a67935cc4 100644\n--- a/block/mirror.c\n+++ b/block/mirror.c\n@@ -1464,7 +1464,7 @@ static void mirror_start_job(const char *job_id, BlockDriverState *bs,\n                              const BlockJobDriver *driver,\n                              bool is_none_mode, BlockDriverState *base,\n                              bool auto_complete, const char *filter_node_name,\n-                             bool is_mirror,\n+                             bool is_mirror, MirrorCopyMode copy_mode,\n                              Error **errp)\n {\n     MirrorBlockJob *s;\n@@ -1574,7 +1574,7 @@ static void mirror_start_job(const char *job_id, BlockDriverState *bs,\n     s->on_target_error = on_target_error;\n     s->is_none_mode = is_none_mode;\n     s->backing_mode = backing_mode;\n-    s->copy_mode = MIRROR_COPY_MODE_PASSIVE;\n+    s->copy_mode = copy_mode;\n     s->base = base;\n     s->granularity = granularity;\n     s->buf_size = ROUND_UP(buf_size, granularity);\n@@ -1643,7 +1643,8 @@ void mirror_start(const char *job_id, BlockDriverState *bs,\n                   MirrorSyncMode mode, BlockMirrorBackingMode backing_mode,\n                   BlockdevOnError on_source_error,\n                   BlockdevOnError on_target_error,\n-                  bool unmap, const char *filter_node_name, Error **errp)\n+                  bool unmap, const char *filter_node_name,\n+                  MirrorCopyMode copy_mode, Error **errp)\n {\n     bool is_none_mode;\n     BlockDriverState *base;\n@@ -1658,7 +1659,7 @@ void mirror_start(const char *job_id, BlockDriverState *bs,\n                      speed, granularity, buf_size, backing_mode,\n                      on_source_error, on_target_error, unmap, NULL, NULL,\n                      &mirror_job_driver, is_none_mode, base, false,\n-                     filter_node_name, true, errp);\n+                     filter_node_name, true, copy_mode, errp);\n }\n \n void commit_active_start(const char *job_id, BlockDriverState *bs,\n@@ -1681,7 +1682,7 @@ void commit_active_start(const char *job_id, BlockDriverState *bs,\n                      MIRROR_LEAVE_BACKING_CHAIN,\n                      on_error, on_error, true, cb, opaque,\n                      &commit_active_job_driver, false, base, auto_complete,\n-                     filter_node_name, false, &local_err);\n+                     filter_node_name, false, MIRROR_COPY_MODE_PASSIVE, &local_err);\n     if (local_err) {\n         error_propagate(errp, local_err);\n         goto error_restore_flags;\ndiff --git a/blockdev.c b/blockdev.c\nindex 56a6b24a0b..7f9c215e98 100644\n--- a/blockdev.c\n+++ b/blockdev.c\n@@ -3408,6 +3408,7 @@ static void blockdev_mirror_common(const char *job_id, BlockDriverState *bs,\n                                    bool has_unmap, bool unmap,\n                                    bool has_filter_node_name,\n                                    const char *filter_node_name,\n+                                   bool has_copy_mode, MirrorCopyMode copy_mode,\n                                    Error **errp)\n {\n \n@@ -3432,6 +3433,9 @@ static void blockdev_mirror_common(const char *job_id, BlockDriverState *bs,\n     if (!has_filter_node_name) {\n         filter_node_name = NULL;\n     }\n+    if (!has_copy_mode) {\n+        copy_mode = MIRROR_COPY_MODE_PASSIVE;\n+    }\n \n     if (granularity != 0 && (granularity < 512 || granularity > 1048576 * 64)) {\n         error_setg(errp, QERR_INVALID_PARAMETER_VALUE, \"granularity\",\n@@ -3462,7 +3466,7 @@ static void blockdev_mirror_common(const char *job_id, BlockDriverState *bs,\n                  has_replaces ? replaces : NULL,\n                  speed, granularity, buf_size, sync, backing_mode,\n                  on_source_error, on_target_error, unmap, filter_node_name,\n-                 errp);\n+                 copy_mode, errp);\n }\n \n void qmp_drive_mirror(DriveMirror *arg, Error **errp)\n@@ -3603,6 +3607,7 @@ void qmp_drive_mirror(DriveMirror *arg, Error **errp)\n                            arg->has_on_target_error, arg->on_target_error,\n                            arg->has_unmap, arg->unmap,\n                            false, NULL,\n+                           arg->has_copy_mode, arg->copy_mode,\n                            &local_err);\n     bdrv_unref(target_bs);\n     error_propagate(errp, local_err);\n@@ -3623,6 +3628,7 @@ void qmp_blockdev_mirror(bool has_job_id, const char *job_id,\n                          BlockdevOnError on_target_error,\n                          bool has_filter_node_name,\n                          const char *filter_node_name,\n+                         bool has_copy_mode, MirrorCopyMode copy_mode,\n                          Error **errp)\n {\n     BlockDriverState *bs;\n@@ -3655,6 +3661,7 @@ void qmp_blockdev_mirror(bool has_job_id, const char *job_id,\n                            has_on_target_error, on_target_error,\n                            true, true,\n                            has_filter_node_name, filter_node_name,\n+                           has_copy_mode, copy_mode,\n                            &local_err);\n     error_propagate(errp, local_err);\n \n",
    "prefixes": [
        "16/18"
    ]
}