get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 1524520,
    "url": "http://patchwork.ozlabs.org/api/patches/1524520/",
    "web_url": "http://patchwork.ozlabs.org/project/ovn/patch/20210903192748.1408062-6-frode.nordahl@canonical.com/",
    "project": {
        "id": 68,
        "url": "http://patchwork.ozlabs.org/api/projects/68/",
        "name": "Open Virtual Network development",
        "link_name": "ovn",
        "list_id": "ovs-dev.openvswitch.org",
        "list_email": "ovs-dev@openvswitch.org",
        "web_url": "http://openvswitch.org/",
        "scm_url": "",
        "webscm_url": "",
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20210903192748.1408062-6-frode.nordahl@canonical.com>",
    "list_archive_url": null,
    "date": "2021-09-03T19:27:44",
    "name": "[ovs-dev,v4,5/9] patch: Consume ovsport functions.",
    "commit_ref": null,
    "pull_url": null,
    "state": "changes-requested",
    "archived": false,
    "hash": "6c58d0f949439daf9f7e6e127743a2cb65ebcd58",
    "submitter": {
        "id": 77851,
        "url": "http://patchwork.ozlabs.org/api/people/77851/",
        "name": "Frode Nordahl",
        "email": "frode.nordahl@canonical.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/ovn/patch/20210903192748.1408062-6-frode.nordahl@canonical.com/mbox/",
    "series": [
        {
            "id": 260950,
            "url": "http://patchwork.ozlabs.org/api/series/260950/",
            "web_url": "http://patchwork.ozlabs.org/project/ovn/list/?series=260950",
            "date": "2021-09-03T19:27:42",
            "name": "Introduce infrastructure for plugging providers",
            "version": 4,
            "mbox": "http://patchwork.ozlabs.org/series/260950/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/1524520/comments/",
    "check": "fail",
    "checks": "http://patchwork.ozlabs.org/api/patches/1524520/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<ovs-dev-bounces@openvswitch.org>",
        "X-Original-To": [
            "incoming@patchwork.ozlabs.org",
            "dev@openvswitch.org"
        ],
        "Delivered-To": [
            "patchwork-incoming@bilbo.ozlabs.org",
            "ovs-dev@lists.linuxfoundation.org"
        ],
        "Authentication-Results": [
            "ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n unprotected) header.d=canonical.com header.i=@canonical.com\n header.a=rsa-sha256 header.s=20210705 header.b=kcABahL5;\n\tdkim-atps=neutral",
            "ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org\n (client-ip=140.211.166.137; helo=smtp4.osuosl.org;\n envelope-from=ovs-dev-bounces@openvswitch.org; receiver=<UNKNOWN>)"
        ],
        "Received": [
            "from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest\n SHA256)\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 4H1SWB5VZgz9sCD\n\tfor <incoming@patchwork.ozlabs.org>; Sat,  4 Sep 2021 05:28:06 +1000 (AEST)",
            "from localhost (localhost [127.0.0.1])\n\tby smtp4.osuosl.org (Postfix) with ESMTP id D0A7442715;\n\tFri,  3 Sep 2021 19:28:02 +0000 (UTC)",
            "from smtp4.osuosl.org ([127.0.0.1])\n\tby localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id Xg4fvkDcWmdU; Fri,  3 Sep 2021 19:28:02 +0000 (UTC)",
            "from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56])\n\tby smtp4.osuosl.org (Postfix) with ESMTPS id DFC7242700;\n\tFri,  3 Sep 2021 19:28:00 +0000 (UTC)",
            "from lf-lists.osuosl.org (localhost [127.0.0.1])\n\tby lists.linuxfoundation.org (Postfix) with ESMTP id 561BAC002F;\n\tFri,  3 Sep 2021 19:27:58 +0000 (UTC)",
            "from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137])\n by lists.linuxfoundation.org (Postfix) with ESMTP id EAFE4C000E\n for <dev@openvswitch.org>; Fri,  3 Sep 2021 19:27:54 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n by smtp4.osuosl.org (Postfix) with ESMTP id C805B426C7\n for <dev@openvswitch.org>; Fri,  3 Sep 2021 19:27:54 +0000 (UTC)",
            "from smtp4.osuosl.org ([127.0.0.1])\n by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n with ESMTP id jVbk_y1bJiGK for <dev@openvswitch.org>;\n Fri,  3 Sep 2021 19:27:54 +0000 (UTC)",
            "from smtp-relay-canonical-1.canonical.com\n (smtp-relay-canonical-1.canonical.com [185.125.188.121])\n by smtp4.osuosl.org (Postfix) with ESMTPS id 29B1F426C4\n for <dev@openvswitch.org>; Fri,  3 Sep 2021 19:27:54 +0000 (UTC)",
            "from frode-threadripper.. (1.general.frode.uk.vpn [10.172.193.250])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest\n SHA256)\n (No client certificate requested)\n by smtp-relay-canonical-1.canonical.com (Postfix) with ESMTPSA id AD9124032E;\n Fri,  3 Sep 2021 19:27:50 +0000 (UTC)"
        ],
        "X-Virus-Scanned": [
            "amavisd-new at osuosl.org",
            "amavisd-new at osuosl.org"
        ],
        "X-Greylist": "domain auto-whitelisted by SQLgrey-1.8.0",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com;\n s=20210705; t=1630697270;\n bh=wfhStxVbg/X5SMKKSdhAa+c99+UoZWKNxffSDVizhvk=;\n h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:\n MIME-Version;\n b=kcABahL52iI2ykYUQqBHXP0XPjAB3B3sV+sqglTWfB0kBBYie05igJPcg6/GAS3qb\n n/CRaU9XsN/vzonEHSceG6eIcEbofqVZYcJ3LOVV8e1371n3efIEiHZhHA624+0KB5\n B4w5lRFpCwcMaMB81xdVuyAKteOPx8OwGfaMgAn/HzxjQdtr//1dssoS0y5Z0oQAtv\n 621EdBg7NJicyjcrXntqkfQlfcxl5oUct6A21wZ2ief1P/cIg63A+3wi79KIC/5+cz\n 1TVGY1+PQEmlVHri4xigqApLSEI0rpC48Xji4Smsq7luTq+KiPdKWXE7nbGjVIPv0X\n sS08rUQNnAK0w==",
        "From": "Frode Nordahl <frode.nordahl@canonical.com>",
        "To": "dev@openvswitch.org",
        "Date": "Fri,  3 Sep 2021 21:27:44 +0200",
        "Message-Id": "<20210903192748.1408062-6-frode.nordahl@canonical.com>",
        "X-Mailer": "git-send-email 2.32.0",
        "In-Reply-To": "<20210903192748.1408062-1-frode.nordahl@canonical.com>",
        "References": "<20210903192748.1408062-1-frode.nordahl@canonical.com>",
        "MIME-Version": "1.0",
        "Subject": "[ovs-dev] [PATCH ovn v4 5/9] patch: Consume ovsport functions.",
        "X-BeenThere": "ovs-dev@openvswitch.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "<ovs-dev.openvswitch.org>",
        "List-Unsubscribe": "<https://mail.openvswitch.org/mailman/options/ovs-dev>,\n <mailto:ovs-dev-request@openvswitch.org?subject=unsubscribe>",
        "List-Archive": "<http://mail.openvswitch.org/pipermail/ovs-dev/>",
        "List-Post": "<mailto:ovs-dev@openvswitch.org>",
        "List-Help": "<mailto:ovs-dev-request@openvswitch.org?subject=help>",
        "List-Subscribe": "<https://mail.openvswitch.org/mailman/listinfo/ovs-dev>,\n <mailto:ovs-dev-request@openvswitch.org?subject=subscribe>",
        "Content-Type": "text/plain; charset=\"us-ascii\"",
        "Content-Transfer-Encoding": "7bit",
        "Errors-To": "ovs-dev-bounces@openvswitch.org",
        "Sender": "\"dev\" <ovs-dev-bounces@openvswitch.org>"
    },
    "content": "Make use of the common functions for maintaining OVS ports.\n\nSigned-off-by: Frode Nordahl <frode.nordahl@canonical.com>\n---\n controller/patch.c | 39 ++++++---------------------------------\n 1 file changed, 6 insertions(+), 33 deletions(-)",
    "diff": "diff --git a/controller/patch.c b/controller/patch.c\nindex a661025da..0d0d53894 100644\n--- a/controller/patch.c\n+++ b/controller/patch.c\n@@ -16,6 +16,7 @@\n #include <config.h>\n \n #include \"patch.h\"\n+#include \"ovsport.h\"\n \n #include \"hash.h\"\n #include \"lflow.h\"\n@@ -91,28 +92,10 @@ create_patch_port(struct ovsdb_idl_txn *ovs_idl_txn,\n             \"ovn-controller: creating patch port '%s' from '%s' to '%s'\",\n             src_name, src->name, dst->name);\n \n-    struct ovsrec_interface *iface;\n-    iface = ovsrec_interface_insert(ovs_idl_txn);\n-    ovsrec_interface_set_name(iface, src_name);\n-    ovsrec_interface_set_type(iface, \"patch\");\n-    const struct smap options = SMAP_CONST1(&options, \"peer\", dst_name);\n-    ovsrec_interface_set_options(iface, &options);\n-\n-    struct ovsrec_port *port;\n-    port = ovsrec_port_insert(ovs_idl_txn);\n-    ovsrec_port_set_name(port, src_name);\n-    ovsrec_port_set_interfaces(port, &iface, 1);\n-    const struct smap ids = SMAP_CONST1(&ids, key, value);\n-    ovsrec_port_set_external_ids(port, &ids);\n-\n-    struct ovsrec_port **ports;\n-    ports = xmalloc(sizeof *ports * (src->n_ports + 1));\n-    memcpy(ports, src->ports, sizeof *ports * src->n_ports);\n-    ports[src->n_ports] = port;\n-    ovsrec_bridge_verify_ports(src);\n-    ovsrec_bridge_set_ports(src, ports, src->n_ports + 1);\n-\n-    free(ports);\n+    const struct smap if_options = SMAP_CONST1(&if_options, \"peer\", dst_name);\n+    const struct smap port_ids = SMAP_CONST1(&port_ids, key, value);\n+    ovsport_create(ovs_idl_txn, src, src_name, \"patch\", &port_ids, NULL,\n+                   &if_options, 0);\n }\n \n static void\n@@ -130,17 +113,7 @@ remove_port(const struct ovsrec_bridge_table *bridge_table,\n             if (bridge->ports[i] != port) {\n                 continue;\n             }\n-            struct ovsrec_port **new_ports;\n-            new_ports = xmemdup(bridge->ports,\n-                    sizeof *new_ports * (bridge->n_ports - 1));\n-            if (i != bridge->n_ports - 1) {\n-                /* Removed port was not last */\n-                new_ports[i] = bridge->ports[bridge->n_ports - 1];\n-            }\n-            ovsrec_bridge_verify_ports(bridge);\n-            ovsrec_bridge_set_ports(bridge, new_ports, bridge->n_ports - 1);\n-            free(new_ports);\n-            ovsrec_port_delete(port);\n+            ovsport_remove(bridge, port);\n             return;\n         }\n     }\n",
    "prefixes": [
        "ovs-dev",
        "v4",
        "5/9"
    ]
}