get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 1524521,
    "url": "http://patchwork.ozlabs.org/api/patches/1524521/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/ovn/patch/20210903192748.1408062-8-frode.nordahl@canonical.com/",
    "project": {
        "id": 68,
        "url": "http://patchwork.ozlabs.org/api/projects/68/?format=api",
        "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-8-frode.nordahl@canonical.com>",
    "list_archive_url": null,
    "date": "2021-09-03T19:27:46",
    "name": "[ovs-dev,v4,7/9] ovn-controller: Prepare plugging infrastructure.",
    "commit_ref": null,
    "pull_url": null,
    "state": "changes-requested",
    "archived": false,
    "hash": "f7f36b8d15294cd7b48c140d5c2d8c3dafb62d50",
    "submitter": {
        "id": 77851,
        "url": "http://patchwork.ozlabs.org/api/people/77851/?format=api",
        "name": "Frode Nordahl",
        "email": "frode.nordahl@canonical.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/ovn/patch/20210903192748.1408062-8-frode.nordahl@canonical.com/mbox/",
    "series": [
        {
            "id": 260950,
            "url": "http://patchwork.ozlabs.org/api/series/260950/?format=api",
            "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/1524521/comments/",
    "check": "success",
    "checks": "http://patchwork.ozlabs.org/api/patches/1524521/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=vrybp9eW;\n\tdkim-atps=neutral",
            "ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org\n (client-ip=140.211.166.133; helo=smtp2.osuosl.org;\n envelope-from=ovs-dev-bounces@openvswitch.org; receiver=<UNKNOWN>)",
            "smtp3.osuosl.org (amavisd-new);\n dkim=pass (2048-bit key) header.d=canonical.com"
        ],
        "Received": [
            "from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133])\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 4H1SWG4tNhz9sCD\n\tfor <incoming@patchwork.ozlabs.org>; Sat,  4 Sep 2021 05:28:10 +1000 (AEST)",
            "from localhost (localhost [127.0.0.1])\n\tby smtp2.osuosl.org (Postfix) with ESMTP id CCA6F40867;\n\tFri,  3 Sep 2021 19:28:07 +0000 (UTC)",
            "from smtp2.osuosl.org ([127.0.0.1])\n\tby localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id ZN-AdvsWDcoJ; Fri,  3 Sep 2021 19:28:05 +0000 (UTC)",
            "from lists.linuxfoundation.org (lf-lists.osuosl.org\n [IPv6:2605:bc80:3010:104::8cd3:938])\n\tby smtp2.osuosl.org (Postfix) with ESMTPS id 2DC4840813;\n\tFri,  3 Sep 2021 19:28:04 +0000 (UTC)",
            "from lf-lists.osuosl.org (localhost [127.0.0.1])\n\tby lists.linuxfoundation.org (Postfix) with ESMTP id BBB5FC0035;\n\tFri,  3 Sep 2021 19:27:59 +0000 (UTC)",
            "from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136])\n by lists.linuxfoundation.org (Postfix) with ESMTP id 8A23EC001A\n for <dev@openvswitch.org>; Fri,  3 Sep 2021 19:27:55 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n by smtp3.osuosl.org (Postfix) with ESMTP id AEB8E6158D\n for <dev@openvswitch.org>; Fri,  3 Sep 2021 19:27:54 +0000 (UTC)",
            "from smtp3.osuosl.org ([127.0.0.1])\n by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n with ESMTP id Qi4tFYDL_hyj 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 smtp3.osuosl.org (Postfix) with ESMTPS id ED1DF6157B\n for <dev@openvswitch.org>; Fri,  3 Sep 2021 19:27:53 +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 639AD409FB;\n Fri,  3 Sep 2021 19:27:51 +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=1630697271;\n bh=9+JG7EYfi+onJczxe6EY3T9ZDBdanPONqR5yvyKh8Eg=;\n h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:\n MIME-Version;\n b=vrybp9eWx87FGsK9JncBOB3dX8yCPOEkQezTX66Q9aGDaLdOAuKfluJA0loa/kr5I\n zDLRj+jJd/DjyQx+w+UmXlEf764cf1kt/Bpn6eEkQCbyaF4ldkiUXHKY+M+GSDjFEC\n KfRrpiUs2mLndHe0Gp+5Xyk+WfRXZ+GKPM8+hcjw9mYm4cjGU5lglsiCK8hRljIbZD\n KPaWa/R93xcsmsQbIHrWuq6mtRX5oM9WLoKJZBkSYbIf77qo/jxcQCwDCyylFQn17/\n O0qfi8L+wkq5P024GrWDRuCQuXeNITS6oZiBvrAbJuvqn3oM1DMXnCZdSRlIa5k7Xn\n lsUcGIsG9UsHg==",
        "From": "Frode Nordahl <frode.nordahl@canonical.com>",
        "To": "dev@openvswitch.org",
        "Date": "Fri,  3 Sep 2021 21:27:46 +0200",
        "Message-Id": "<20210903192748.1408062-8-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 7/9] ovn-controller: Prepare plugging\n\tinfrastructure.",
        "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": "Add port by interfaces index - To be able to effectively remove\nports previously plugged by us we need to look up ports by\ninterface records.\n\nAdd `enable-dummy-plug` option - To enable testing of the plugging\ninfrastructure without building OVN with an external plugging\nlibrary we include a dummy implementation which can be enabled\nusing this command line option.\n\nAlso adds a ENGINE_NODE_NO_DATA macro which is useful for when\nlookup data is located elsewhere and not passed around as part of\nthe incremental processsing engine.\n\nSigned-off-by: Frode Nordahl <frode.nordahl@canonical.com>\n---\n controller/binding.h        |  1 +\n controller/ovn-controller.c | 26 ++++++++++++++++++++++++++\n lib/inc-proc-eng.h          |  7 +++++++\n 3 files changed, 34 insertions(+)",
    "diff": "diff --git a/controller/binding.h b/controller/binding.h\nindex f1abc4b9c..8f4521806 100644\n--- a/controller/binding.h\n+++ b/controller/binding.h\n@@ -46,6 +46,7 @@ struct binding_ctx_in {\n     struct ovsdb_idl_index *sbrec_datapath_binding_by_key;\n     struct ovsdb_idl_index *sbrec_port_binding_by_datapath;\n     struct ovsdb_idl_index *sbrec_port_binding_by_name;\n+    struct ovsdb_idl_index *ovsrec_port_by_interfaces;\n     const struct ovsrec_port_table *port_table;\n     const struct ovsrec_qos_table *qos_table;\n     const struct sbrec_port_binding_table *port_binding_table;\ndiff --git a/controller/ovn-controller.c b/controller/ovn-controller.c\nindex 7387a177b..1b808e39f 100644\n--- a/controller/ovn-controller.c\n+++ b/controller/ovn-controller.c\n@@ -55,7 +55,9 @@\n #include \"lib/mcast-group-index.h\"\n #include \"lib/ovn-sb-idl.h\"\n #include \"lib/ovn-util.h\"\n+#include \"lib/plug-dummy.h\"\n #include \"patch.h\"\n+#include \"plug.h\"\n #include \"physical.h\"\n #include \"pinctrl.h\"\n #include \"openvswitch/poll-loop.h\"\n@@ -1242,6 +1244,11 @@ init_binding_ctx(struct engine_node *node,\n                 engine_get_input(\"SB_port_binding\", node),\n                 \"datapath\");\n \n+    struct ovsdb_idl_index *ovsrec_port_by_interfaces =\n+        engine_ovsdb_node_get_index(\n+                engine_get_input(\"OVS_port\", node),\n+                \"interfaces\");\n+\n     struct controller_engine_ctx *ctrl_ctx = engine_get_context()->client_ctx;\n \n     b_ctx_in->ovnsb_idl_txn = engine_get_context()->ovnsb_idl_txn;\n@@ -1249,6 +1256,7 @@ init_binding_ctx(struct engine_node *node,\n     b_ctx_in->sbrec_datapath_binding_by_key = sbrec_datapath_binding_by_key;\n     b_ctx_in->sbrec_port_binding_by_datapath = sbrec_port_binding_by_datapath;\n     b_ctx_in->sbrec_port_binding_by_name = sbrec_port_binding_by_name;\n+    b_ctx_in->ovsrec_port_by_interfaces = ovsrec_port_by_interfaces;\n     b_ctx_in->port_table = port_table;\n     b_ctx_in->iface_table = iface_table;\n     b_ctx_in->qos_table = qos_table;\n@@ -3102,11 +3110,17 @@ main(int argc, char *argv[])\n     patch_init();\n     pinctrl_init();\n     lflow_init();\n+    plug_initialize();\n \n     /* Connect to OVS OVSDB instance. */\n     struct ovsdb_idl_loop ovs_idl_loop = OVSDB_IDL_LOOP_INITIALIZER(\n         ovsdb_idl_create(ovs_remote, &ovsrec_idl_class, false, true));\n     ctrl_register_ovs_idl(ovs_idl_loop.idl);\n+\n+    struct ovsdb_idl_index *ovsrec_port_by_interfaces\n+        = ovsdb_idl_index_create1(ovs_idl_loop.idl,\n+                                  &ovsrec_port_col_interfaces);\n+\n     ovsdb_idl_get_initial_snapshot(ovs_idl_loop.idl);\n \n     /* Configure OVN SB database. */\n@@ -3226,6 +3240,7 @@ main(int argc, char *argv[])\n     ENGINE_NODE(flow_output, \"flow_output\");\n     ENGINE_NODE(addr_sets, \"addr_sets\");\n     ENGINE_NODE_WITH_CLEAR_TRACK_DATA(port_groups, \"port_groups\");\n+    ENGINE_NODE_NO_DATA(plug_provider, \"plug_provider\");\n \n #define SB_NODE(NAME, NAME_STR) ENGINE_NODE_SB(NAME, NAME_STR);\n     SB_NODES\n@@ -3320,6 +3335,8 @@ main(int argc, char *argv[])\n     engine_add_input(&en_ct_zones, &en_runtime_data,\n                      ct_zones_runtime_data_handler);\n \n+    engine_add_input(&en_runtime_data, &en_plug_provider, NULL);\n+\n     engine_add_input(&en_runtime_data, &en_ofctrl_is_connected, NULL);\n \n     engine_add_input(&en_runtime_data, &en_ovs_open_vswitch, NULL);\n@@ -3370,6 +3387,8 @@ main(int argc, char *argv[])\n                                 sbrec_port_binding_by_datapath);\n     engine_ovsdb_node_add_index(&en_sb_datapath_binding, \"key\",\n                                 sbrec_datapath_binding_by_key);\n+    engine_ovsdb_node_add_index(&en_ovs_port, \"interfaces\",\n+                                ovsrec_port_by_interfaces);\n \n     struct ed_type_lflow_output *lflow_output_data =\n         engine_get_internal_data(&en_lflow_output);\n@@ -3897,6 +3916,7 @@ loop_done:\n     pinctrl_destroy();\n     patch_destroy();\n     if_status_mgr_destroy(if_mgr);\n+    plug_destroy_all();\n \n     ovsdb_idl_loop_destroy(&ovs_idl_loop);\n     ovsdb_idl_loop_destroy(&ovnsb_idl_loop);\n@@ -3916,6 +3936,7 @@ parse_options(int argc, char *argv[])\n         VLOG_OPTION_ENUMS,\n         OVN_DAEMON_OPTION_ENUMS,\n         SSL_OPTION_ENUMS,\n+        OPT_ENABLE_DUMMY_PLUG,\n     };\n \n     static struct option long_options[] = {\n@@ -3926,6 +3947,7 @@ parse_options(int argc, char *argv[])\n         STREAM_SSL_LONG_OPTIONS,\n         {\"peer-ca-cert\", required_argument, NULL, OPT_PEER_CA_CERT},\n         {\"bootstrap-ca-cert\", required_argument, NULL, OPT_BOOTSTRAP_CA_CERT},\n+        {\"enable-dummy-plug\", no_argument, NULL, OPT_ENABLE_DUMMY_PLUG},\n         {NULL, 0, NULL, 0}\n     };\n     char *short_options = ovs_cmdl_long_options_to_short_options(long_options);\n@@ -3971,6 +3993,10 @@ parse_options(int argc, char *argv[])\n             stream_ssl_set_ca_cert_file(optarg, true);\n             break;\n \n+        case OPT_ENABLE_DUMMY_PLUG:\n+            plug_dummy_enable();\n+            break;\n+\n         case '?':\n             exit(EXIT_FAILURE);\n \ndiff --git a/lib/inc-proc-eng.h b/lib/inc-proc-eng.h\nindex 859b30a71..00e799512 100644\n--- a/lib/inc-proc-eng.h\n+++ b/lib/inc-proc-eng.h\n@@ -306,6 +306,13 @@ void engine_ovsdb_node_add_index(struct engine_node *, const char *name,\n     ENGINE_NODE_CUSTOM_DATA(NAME, NAME_STR) \\\n     en_##NAME.clear_tracked_data = en_##NAME##_clear_tracked_data;\n \n+#define ENGINE_NODE_NO_DATA(NAME, NAME_STR) \\\n+    static void * (*en_##NAME##_init)(struct engine_node *, \\\n+                                      struct engine_arg *) = NULL; \\\n+    static void (*en_##NAME##_cleanup)(void *) = NULL; \\\n+    static bool (*en_##NAME##_is_valid)(struct engine_node *node) = NULL; \\\n+    ENGINE_NODE_DEF(NAME, NAME_STR)\n+\n #define ENGINE_NODE(NAME, NAME_STR) \\\n     static bool (*en_##NAME##_is_valid)(struct engine_node *node) = NULL; \\\n     ENGINE_NODE_DEF(NAME, NAME_STR)\n",
    "prefixes": [
        "ovs-dev",
        "v4",
        "7/9"
    ]
}