get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 1524517,
    "url": "http://patchwork.ozlabs.org/api/patches/1524517/",
    "web_url": "http://patchwork.ozlabs.org/project/ovn/patch/20210903192748.1408062-4-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-4-frode.nordahl@canonical.com>",
    "list_archive_url": null,
    "date": "2021-09-03T19:27:42",
    "name": "[ovs-dev,v4,3/9] controller: Make use of Port_Binding:requested_chassis",
    "commit_ref": null,
    "pull_url": null,
    "state": "changes-requested",
    "archived": false,
    "hash": "ccb1b377abeb8a7945b9612b333221aa03eb5f84",
    "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-4-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/1524517/comments/",
    "check": "fail",
    "checks": "http://patchwork.ozlabs.org/api/patches/1524517/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=fuJ71Ihx;\n\tdkim-atps=neutral",
            "ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org\n (client-ip=2605:bc80:3010::137; helo=smtp4.osuosl.org;\n envelope-from=ovs-dev-bounces@openvswitch.org; receiver=<UNKNOWN>)",
            "smtp2.osuosl.org (amavisd-new);\n dkim=pass (2048-bit key) header.d=canonical.com"
        ],
        "Received": [
            "from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::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 4H1SW35yKWz9sCD\n\tfor <incoming@patchwork.ozlabs.org>; Sat,  4 Sep 2021 05:27:59 +1000 (AEST)",
            "from localhost (localhost [127.0.0.1])\n\tby smtp4.osuosl.org (Postfix) with ESMTP id 2A928426E3;\n\tFri,  3 Sep 2021 19:27:57 +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 aP-h0pIYVUbV; Fri,  3 Sep 2021 19:27:56 +0000 (UTC)",
            "from lists.linuxfoundation.org (lf-lists.osuosl.org\n [IPv6:2605:bc80:3010:104::8cd3:938])\n\tby smtp4.osuosl.org (Postfix) with ESMTPS id 3E6AB426C7;\n\tFri,  3 Sep 2021 19:27:55 +0000 (UTC)",
            "from lf-lists.osuosl.org (localhost [127.0.0.1])\n\tby lists.linuxfoundation.org (Postfix) with ESMTP id 088D7C001C;\n\tFri,  3 Sep 2021 19:27:55 +0000 (UTC)",
            "from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133])\n by lists.linuxfoundation.org (Postfix) with ESMTP id C35F3C000E\n for <dev@openvswitch.org>; Fri,  3 Sep 2021 19:27:53 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n by smtp2.osuosl.org (Postfix) with ESMTP id 9A52A407BA\n for <dev@openvswitch.org>; Fri,  3 Sep 2021 19:27:53 +0000 (UTC)",
            "from smtp2.osuosl.org ([127.0.0.1])\n by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n with ESMTP id aYO0NT4z06Gf for <dev@openvswitch.org>;\n Fri,  3 Sep 2021 19:27:52 +0000 (UTC)",
            "from smtp-relay-canonical-1.canonical.com\n (smtp-relay-canonical-1.canonical.com [185.125.188.121])\n by smtp2.osuosl.org (Postfix) with ESMTPS id 7E2E64027D\n for <dev@openvswitch.org>; Fri,  3 Sep 2021 19:27:52 +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 0D352401A3;\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=cU0GgvAWqV+7UQxP1qgVM8KrLEP8knx9JoVoJ+2iPLU=;\n h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:\n MIME-Version;\n b=fuJ71IhxcdqnM6EMp0XTp8I2KZu7WGcpk1R+t2m8IZKaZkXfqU0haCfdRAJ0/sZlL\n HipVdVOqQOmGZXAPNOO5q4XGGyZgP1VQ8FL4mPnoLDvOGN4qgJskPzf+aMeEG5G9Rv\n /lk3KaC5dOCrcC3Ypv54l3EhM4++vlipAVgifsOEPq2CKdPhFXMluPHnFq4o9SxY0F\n 3GYRxpGZbWGgYDsHddWdy786lBijUmSoPYHUBOzHoE0jQxsKTph3AD6NzksA/x4NtT\n hwhBrq3M5B/QrVJ/jt5IchJIivtESJ+vFg1Pey4cKZi9nbGEuQAdwqhFio+fe9unA+\n XS2FRiqk4QWjg==",
        "From": "Frode Nordahl <frode.nordahl@canonical.com>",
        "To": "dev@openvswitch.org",
        "Date": "Fri,  3 Sep 2021 21:27:42 +0200",
        "Message-Id": "<20210903192748.1408062-4-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 3/9] controller: Make use of\n\tPort_Binding:requested_chassis",
        "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": "Improve the efficiency of the requested-chassis feature by using\nthe new Southbound Port_Binding:requested_chassis column instead\nof each chassis performing option processing and string comparison.\n\nSigned-off-by: Frode Nordahl <frode.nordahl@canonical.com>\n---\n controller/binding.c        | 29 ++++++++++++-----------------\n controller/ovn-controller.c |  3 +++\n controller/physical.c       |  7 ++-----\n 3 files changed, 17 insertions(+), 22 deletions(-)",
    "diff": "diff --git a/controller/binding.c b/controller/binding.c\nindex 34935bb9c..938e1d81d 100644\n--- a/controller/binding.c\n+++ b/controller/binding.c\n@@ -1051,11 +1051,10 @@ is_binding_lport_this_chassis(struct binding_lport *b_lport,\n \n static bool\n can_bind_on_this_chassis(const struct sbrec_chassis *chassis_rec,\n-                         const char *requested_chassis)\n+                         const struct sbrec_port_binding *pb)\n {\n-    return !requested_chassis || !requested_chassis[0]\n-           || !strcmp(requested_chassis, chassis_rec->name)\n-           || !strcmp(requested_chassis, chassis_rec->hostname);\n+    return !pb->requested_chassis\n+           || chassis_rec == pb->requested_chassis;\n }\n \n /* Returns 'true' if the 'lbinding' has binding lports of type LP_CONTAINER,\n@@ -1093,7 +1092,7 @@ release_binding_lport(const struct sbrec_chassis *chassis_rec,\n \n static bool\n consider_vif_lport_(const struct sbrec_port_binding *pb,\n-                    bool can_bind, const char *vif_chassis,\n+                    bool can_bind,\n                     struct binding_ctx_in *b_ctx_in,\n                     struct binding_ctx_out *b_ctx_out,\n                     struct binding_lport *b_lport,\n@@ -1134,7 +1133,8 @@ consider_vif_lport_(const struct sbrec_port_binding *pb,\n                              \"requested-chassis %s\",\n                              pb->logical_port,\n                              b_ctx_in->chassis_rec->name,\n-                             vif_chassis);\n+                             pb->requested_chassis ?\n+                                pb->requested_chassis->name : \"(none)\");\n         }\n     }\n \n@@ -1157,9 +1157,7 @@ consider_vif_lport(const struct sbrec_port_binding *pb,\n                    struct local_binding *lbinding,\n                    struct hmap *qos_map)\n {\n-    const char *vif_chassis = smap_get(&pb->options, \"requested-chassis\");\n-    bool can_bind = can_bind_on_this_chassis(b_ctx_in->chassis_rec,\n-                                             vif_chassis);\n+    bool can_bind = can_bind_on_this_chassis(b_ctx_in->chassis_rec, pb);\n \n     if (!lbinding) {\n         lbinding = local_binding_find(&b_ctx_out->lbinding_data->bindings,\n@@ -1189,8 +1187,8 @@ consider_vif_lport(const struct sbrec_port_binding *pb,\n         }\n     }\n \n-    return consider_vif_lport_(pb, can_bind, vif_chassis, b_ctx_in,\n-                               b_ctx_out, b_lport, qos_map);\n+    return consider_vif_lport_(pb, can_bind, b_ctx_in, b_ctx_out,\n+                               b_lport, qos_map);\n }\n \n static bool\n@@ -1274,12 +1272,9 @@ consider_container_lport(const struct sbrec_port_binding *pb,\n     }\n \n     ovs_assert(parent_b_lport && parent_b_lport->pb);\n-    const char *vif_chassis = smap_get(&parent_b_lport->pb->options,\n-                                       \"requested-chassis\");\n-    bool can_bind = can_bind_on_this_chassis(b_ctx_in->chassis_rec,\n-                                             vif_chassis);\n+    bool can_bind = can_bind_on_this_chassis(b_ctx_in->chassis_rec, pb);\n \n-    return consider_vif_lport_(pb, can_bind, vif_chassis, b_ctx_in, b_ctx_out,\n+    return consider_vif_lport_(pb, can_bind, b_ctx_in, b_ctx_out,\n                                container_b_lport, qos_map);\n }\n \n@@ -1328,7 +1323,7 @@ consider_virtual_lport(const struct sbrec_port_binding *pb,\n         }\n     }\n \n-    if (!consider_vif_lport_(pb, true, NULL, b_ctx_in, b_ctx_out,\n+    if (!consider_vif_lport_(pb, true, b_ctx_in, b_ctx_out,\n                              virtual_b_lport, qos_map)) {\n         return false;\n     }\ndiff --git a/controller/ovn-controller.c b/controller/ovn-controller.c\nindex 0031a1035..7387a177b 100644\n--- a/controller/ovn-controller.c\n+++ b/controller/ovn-controller.c\n@@ -232,6 +232,9 @@ update_sb_monitors(struct ovsdb_idl *ovnsb_idl,\n         sbrec_port_binding_add_clause_chassis(&pb, OVSDB_F_EQ,\n                                               &chassis->header_.uuid);\n \n+        sbrec_port_binding_add_clause_requested_chassis(\n+            &pb, OVSDB_F_EQ, &chassis->header_.uuid);\n+\n         /* Ensure that we find out about l2gateway and l3gateway ports that\n          * should be present on this chassis.  Otherwise, we might never find\n          * out about those ports, if their datapaths don't otherwise have a VIF\ndiff --git a/controller/physical.c b/controller/physical.c\nindex 6f2c1cea0..2f6bd0e91 100644\n--- a/controller/physical.c\n+++ b/controller/physical.c\n@@ -1066,11 +1066,8 @@ consider_port_binding(struct ovsdb_idl_index *sbrec_port_binding_by_name,\n     } else {\n         ofport = local_binding_get_lport_ofport(local_bindings,\n                                                 binding->logical_port);\n-        const char *requested_chassis = smap_get(&binding->options,\n-                                                 \"requested-chassis\");\n-        if (ofport && requested_chassis && requested_chassis[0] &&\n-            strcmp(requested_chassis, chassis->name) &&\n-            strcmp(requested_chassis, chassis->hostname)) {\n+        if (ofport && binding->requested_chassis\n+            && binding->requested_chassis != chassis) {\n             /* Even though there is an ofport for this port_binding, it is\n              * requested on a different chassis. So ignore this ofport.\n              */\n",
    "prefixes": [
        "ovs-dev",
        "v4",
        "3/9"
    ]
}