get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 812336,
    "url": "http://patchwork.ozlabs.org/api/patches/812336/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20170911110623.24981-39-marcandre.lureau@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": "<20170911110623.24981-39-marcandre.lureau@redhat.com>",
    "list_archive_url": null,
    "date": "2017-09-11T11:06:11",
    "name": "[v3,38/50] qapi: add conditions to REPLICATION type/commands on the schema",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "302fd2c42814f842f1e7137b6b42884034c05933",
    "submitter": {
        "id": 66774,
        "url": "http://patchwork.ozlabs.org/api/people/66774/?format=api",
        "name": "Marc-André Lureau",
        "email": "marcandre.lureau@redhat.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20170911110623.24981-39-marcandre.lureau@redhat.com/mbox/",
    "series": [
        {
            "id": 2480,
            "url": "http://patchwork.ozlabs.org/api/series/2480/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=2480",
            "date": "2017-09-11T11:05:33",
            "name": "Hi,",
            "version": 3,
            "mbox": "http://patchwork.ozlabs.org/series/2480/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/812336/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/812336/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-mx10.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com",
            "ext-mx10.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=marcandre.lureau@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 3xrQY83CYXz9sBd\n\tfor <incoming@patchwork.ozlabs.org>;\n\tMon, 11 Sep 2017 21:23:56 +1000 (AEST)",
            "from localhost ([::1]:56812 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 1drMok-0002cL-Ep\n\tfor incoming@patchwork.ozlabs.org; Mon, 11 Sep 2017 07:23:54 -0400",
            "from eggs.gnu.org ([2001:4830:134:3::10]:43602)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <marcandre.lureau@redhat.com>) id 1drMZe-0006U1-7b\n\tfor qemu-devel@nongnu.org; Mon, 11 Sep 2017 07:08:20 -0400",
            "from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <marcandre.lureau@redhat.com>) id 1drMZY-00077G-55\n\tfor qemu-devel@nongnu.org; Mon, 11 Sep 2017 07:08:18 -0400",
            "from mx1.redhat.com ([209.132.183.28]:38460)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <marcandre.lureau@redhat.com>)\n\tid 1drMZX-00076v-TN\n\tfor qemu-devel@nongnu.org; Mon, 11 Sep 2017 07:08:12 -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 F25E4166378;\n\tMon, 11 Sep 2017 11:08:10 +0000 (UTC)",
            "from localhost (ovpn-112-47.ams2.redhat.com [10.36.112.47])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id 4D5B76B264;\n\tMon, 11 Sep 2017 11:08:10 +0000 (UTC)"
        ],
        "DMARC-Filter": "OpenDMARC Filter v1.3.2 mx1.redhat.com F25E4166378",
        "From": "=?utf-8?q?Marc-Andr=C3=A9_Lureau?= <marcandre.lureau@redhat.com>",
        "To": "qemu-devel@nongnu.org",
        "Date": "Mon, 11 Sep 2017 13:06:11 +0200",
        "Message-Id": "<20170911110623.24981-39-marcandre.lureau@redhat.com>",
        "In-Reply-To": "<20170911110623.24981-1-marcandre.lureau@redhat.com>",
        "References": "<20170911110623.24981-1-marcandre.lureau@redhat.com>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=UTF-8",
        "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.39]);\n\tMon, 11 Sep 2017 11:08:11 +0000 (UTC)",
        "Content-Transfer-Encoding": "quoted-printable",
        "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 v3 38/50] qapi: add conditions to REPLICATION\n\ttype/commands on the schema",
        "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": "zhanghailiang <zhang.zhanghailiang@huawei.com>, Juan Quintela\n\t<quintela@redhat.com>, armbru@redhat.com, \"Dr. David Alan Gilbert\"\n\t<dgilbert@redhat.com>, =?utf-8?q?Marc-Andr=C3=A9_Lureau?=\n\t<marcandre.lureau@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": "Add #if defined(CONFIG_REPLICATION) in generated code, and adjust the\ncode accordingly.\n\nMade conditional:\n\n* xen-set-replication, query-xen-replication-status,\n  xen-colo-do-checkpoint\n\n  Before the patch, we first register the commands unconditionally in\n  generated code (requires a stub), then conditionally unregister in\n  qmp_unregister_commands_hack().\n\n  Afterwards, we register only when CONFIG_REPLICATION.  The command\n  fails exactly the same, with CommandNotFound.\n\n  Improvement, because now query-qmp-schema is accurate, and we're one\n  step close to killing qmp_unregister_commands_hack().\n\n* enum BlockdevDriver value \"replication\" in command blockdev-add\n\nAs well as enum BlockdevDriver value @replication BlockdevOptions\nvariant @replication, BlockdevOptionsReplication,\nBlockdevOptionsReplicationMode.\n\nSigned-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>\n---\n qapi/block-core.json | 15 ++++++++++-----\n qapi/migration.json  | 12 ++++++++----\n migration/colo.c     | 16 ++++------------\n monitor.c            |  5 -----\n 4 files changed, 22 insertions(+), 26 deletions(-)",
    "diff": "diff --git a/qapi/block-core.json b/qapi/block-core.json\nindex bb11815608..6f897cf157 100644\n--- a/qapi/block-core.json\n+++ b/qapi/block-core.json\n@@ -2232,8 +2232,10 @@\n             'dmg', 'file', 'ftp', 'ftps', 'gluster', 'host_cdrom',\n             'host_device', 'http', 'https', 'iscsi', 'luks', 'nbd', 'nfs',\n             'null-aio', 'null-co', 'parallels', 'qcow', 'qcow2', 'qed',\n-            'quorum', 'raw', 'rbd', 'replication', 'sheepdog', 'ssh',\n-            'throttle', 'vdi', 'vhdx', 'vmdk', 'vpc', 'vvfat', 'vxhs' ] }\n+            'quorum', 'raw', 'rbd',\n+            { 'name': 'replication', 'if': 'defined(CONFIG_REPLICATION)' },\n+            'sheepdog', 'ssh', 'throttle',\n+            'vdi', 'vhdx', 'vmdk', 'vpc', 'vvfat', 'vxhs' ] }\n \n ##\n # @BlockdevOptionsFile:\n@@ -2855,7 +2857,8 @@\n #\n # Since: 2.9\n ##\n-{ 'enum' : 'ReplicationMode', 'data' : [ 'primary', 'secondary' ] }\n+{ 'enum' : 'ReplicationMode', 'data' : [ 'primary', 'secondary' ],\n+  'if': 'defined(CONFIG_REPLICATION)' }\n \n ##\n # @BlockdevOptionsReplication:\n@@ -2873,7 +2876,8 @@\n { 'struct': 'BlockdevOptionsReplication',\n   'base': 'BlockdevOptionsGenericFormat',\n   'data': { 'mode': 'ReplicationMode',\n-            '*top-id': 'str' } }\n+            '*top-id': 'str' },\n+  'if': 'defined(CONFIG_REPLICATION)' }\n \n ##\n # @NFSTransport:\n@@ -3168,7 +3172,8 @@\n       'quorum':     'BlockdevOptionsQuorum',\n       'raw':        'BlockdevOptionsRaw',\n       'rbd':        'BlockdevOptionsRbd',\n-      'replication':'BlockdevOptionsReplication',\n+      'replication': { 'type': 'BlockdevOptionsReplication',\n+                       'if': 'defined(CONFIG_REPLICATION)' },\n       'sheepdog':   'BlockdevOptionsSheepdog',\n       'ssh':        'BlockdevOptionsSsh',\n       'throttle':   'BlockdevOptionsThrottle',\ndiff --git a/qapi/migration.json b/qapi/migration.json\nindex ee2b3b8733..44d2ef9c94 100644\n--- a/qapi/migration.json\n+++ b/qapi/migration.json\n@@ -1034,7 +1034,8 @@\n # Since: 2.9\n ##\n { 'command': 'xen-set-replication',\n-  'data': { 'enable': 'bool', 'primary': 'bool', '*failover' : 'bool' } }\n+  'data': { 'enable': 'bool', 'primary': 'bool', '*failover' : 'bool' },\n+  'if': 'defined(CONFIG_REPLICATION)' }\n \n ##\n # @ReplicationStatus:\n@@ -1049,7 +1050,8 @@\n # Since: 2.9\n ##\n { 'struct': 'ReplicationStatus',\n-  'data': { 'error': 'bool', '*desc': 'str' } }\n+  'data': { 'error': 'bool', '*desc': 'str' },\n+  'if': 'defined(CONFIG_REPLICATION)' }\n \n ##\n # @query-xen-replication-status:\n@@ -1066,7 +1068,8 @@\n # Since: 2.9\n ##\n { 'command': 'query-xen-replication-status',\n-  'returns': 'ReplicationStatus' }\n+  'returns': 'ReplicationStatus',\n+  'if': 'defined(CONFIG_REPLICATION)' }\n \n ##\n # @xen-colo-do-checkpoint:\n@@ -1082,4 +1085,5 @@\n #\n # Since: 2.9\n ##\n-{ 'command': 'xen-colo-do-checkpoint' }\n+{ 'command': 'xen-colo-do-checkpoint',\n+  'if': 'defined(CONFIG_REPLICATION)' }\ndiff --git a/migration/colo.c b/migration/colo.c\nindex dee3aa8bf7..010c9e02e8 100644\n--- a/migration/colo.c\n+++ b/migration/colo.c\n@@ -22,7 +22,9 @@\n #include \"trace.h\"\n #include \"qemu/error-report.h\"\n #include \"migration/failover.h\"\n+#ifdef CONFIG_REPLICATION\n #include \"replication.h\"\n+#endif\n #include \"qmp-commands.h\"\n \n static bool vmstate_loading;\n@@ -147,11 +149,11 @@ void colo_do_failover(MigrationState *s)\n     }\n }\n \n+#ifdef CONFIG_REPLICATION\n void qmp_xen_set_replication(bool enable, bool primary,\n                              bool has_failover, bool failover,\n                              Error **errp)\n {\n-#ifdef CONFIG_REPLICATION\n     ReplicationMode mode = primary ?\n                            REPLICATION_MODE_PRIMARY :\n                            REPLICATION_MODE_SECONDARY;\n@@ -170,14 +172,10 @@ void qmp_xen_set_replication(bool enable, bool primary,\n         }\n         replication_stop_all(failover, failover ? NULL : errp);\n     }\n-#else\n-    abort();\n-#endif\n }\n \n ReplicationStatus *qmp_query_xen_replication_status(Error **errp)\n {\n-#ifdef CONFIG_REPLICATION\n     Error *err = NULL;\n     ReplicationStatus *s = g_new0(ReplicationStatus, 1);\n \n@@ -192,19 +190,13 @@ ReplicationStatus *qmp_query_xen_replication_status(Error **errp)\n \n     error_free(err);\n     return s;\n-#else\n-    abort();\n-#endif\n }\n \n void qmp_xen_colo_do_checkpoint(Error **errp)\n {\n-#ifdef CONFIG_REPLICATION\n     replication_do_checkpoint_all(errp);\n-#else\n-    abort();\n-#endif\n }\n+#endif\n \n static void colo_send_message(QEMUFile *f, COLOMessage msg,\n                               Error **errp)\ndiff --git a/monitor.c b/monitor.c\nindex 135a1e0821..b5ddcf8c67 100644\n--- a/monitor.c\n+++ b/monitor.c\n@@ -970,11 +970,6 @@ static void qmp_query_qmp_schema(QDict *qdict, QObject **ret_data,\n  */\n static void qmp_unregister_commands_hack(void)\n {\n-#ifndef CONFIG_REPLICATION\n-    qmp_unregister_command(&qmp_commands, \"xen-set-replication\");\n-    qmp_unregister_command(&qmp_commands, \"query-xen-replication-status\");\n-    qmp_unregister_command(&qmp_commands, \"xen-colo-do-checkpoint\");\n-#endif\n #ifndef TARGET_I386\n     qmp_unregister_command(&qmp_commands, \"rtc-reset-reinjection\");\n #endif\n",
    "prefixes": [
        "v3",
        "38/50"
    ]
}