get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 1529002,
    "url": "http://patchwork.ozlabs.org/api/patches/1529002/",
    "web_url": "http://patchwork.ozlabs.org/project/ovn/patch/20210916173028.9527-1-odivlad@gmail.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": "<20210916173028.9527-1-odivlad@gmail.com>",
    "list_archive_url": null,
    "date": "2021-09-16T17:30:28",
    "name": "[ovs-dev] controller: configure only matching encaps between chassis",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "9e5218090cb44ac26447a9246c2f912210d221f9",
    "submitter": {
        "id": 80943,
        "url": "http://patchwork.ozlabs.org/api/people/80943/",
        "name": "Vladislav Odintsov",
        "email": "odivlad@gmail.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/ovn/patch/20210916173028.9527-1-odivlad@gmail.com/mbox/",
    "series": [
        {
            "id": 262679,
            "url": "http://patchwork.ozlabs.org/api/series/262679/",
            "web_url": "http://patchwork.ozlabs.org/project/ovn/list/?series=262679",
            "date": "2021-09-16T17:30:28",
            "name": "[ovs-dev] controller: configure only matching encaps between chassis",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/262679/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/1529002/comments/",
    "check": "fail",
    "checks": "http://patchwork.ozlabs.org/api/patches/1529002/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@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=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20210112 header.b=dIS7sB3z;\n\tdkim-atps=neutral",
            "ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org\n (client-ip=2605:bc80:3010::138; helo=smtp1.osuosl.org;\n envelope-from=ovs-dev-bounces@openvswitch.org; receiver=<UNKNOWN>)"
        ],
        "Received": [
            "from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138])\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 4H9PHl5nHCz9sXS\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 17 Sep 2021 03:30:43 +1000 (AEST)",
            "from localhost (localhost [127.0.0.1])\n\tby smtp1.osuosl.org (Postfix) with ESMTP id 56FD1835C8;\n\tThu, 16 Sep 2021 17:30:40 +0000 (UTC)",
            "from smtp1.osuosl.org ([127.0.0.1])\n\tby localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id MvRng0zoBvBx; Thu, 16 Sep 2021 17:30:39 +0000 (UTC)",
            "from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56])\n\tby smtp1.osuosl.org (Postfix) with ESMTPS id 733AB8341E;\n\tThu, 16 Sep 2021 17:30:38 +0000 (UTC)",
            "from lf-lists.osuosl.org (localhost [127.0.0.1])\n\tby lists.linuxfoundation.org (Postfix) with ESMTP id 2BB6BC0011;\n\tThu, 16 Sep 2021 17:30:38 +0000 (UTC)",
            "from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138])\n by lists.linuxfoundation.org (Postfix) with ESMTP id 3F671C000D\n for <dev@openvswitch.org>; Thu, 16 Sep 2021 17:30:37 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n by smtp1.osuosl.org (Postfix) with ESMTP id 26A158341E\n for <dev@openvswitch.org>; Thu, 16 Sep 2021 17:30:37 +0000 (UTC)",
            "from smtp1.osuosl.org ([127.0.0.1])\n by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n with ESMTP id lgTPLChqMrPz for <dev@openvswitch.org>;\n Thu, 16 Sep 2021 17:30:36 +0000 (UTC)",
            "from mail-lf1-x12a.google.com (mail-lf1-x12a.google.com\n [IPv6:2a00:1450:4864:20::12a])\n by smtp1.osuosl.org (Postfix) with ESMTPS id B88D783412\n for <dev@openvswitch.org>; Thu, 16 Sep 2021 17:30:35 +0000 (UTC)",
            "by mail-lf1-x12a.google.com with SMTP id b18so19934302lfb.1\n for <dev@openvswitch.org>; Thu, 16 Sep 2021 10:30:35 -0700 (PDT)",
            "from localhost.localdomain (109-252-131-59.dynamic.spd-mgts.ru.\n [109.252.131.59])\n by smtp.gmail.com with ESMTPSA id m29sm311460lfo.191.2021.09.16.10.30.29\n (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);\n Thu, 16 Sep 2021 10:30:29 -0700 (PDT)"
        ],
        "X-Virus-Scanned": [
            "amavisd-new at osuosl.org",
            "amavisd-new at osuosl.org"
        ],
        "X-Greylist": "whitelisted by SQLgrey-1.8.0",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;\n h=from:to:cc:subject:date:message-id:mime-version\n :content-transfer-encoding;\n bh=jJQ/SsCai4owLalCsBsrj8ey2DEm8CmI4OPZMovAd1s=;\n b=dIS7sB3zYIwkM0SLbO5unbIWdP2mVgyaRCkHz2TJ/0Eb0dQ5kCESRiJDzWJ/FyQjmb\n LxRQumHjDFtMLIQ9O/Nk+ollK+mRFEwVErlL+MgUlLqn8fitzA0t+FdHlfm58Hq4rAqt\n ltzm9hYO19qQUA35GmEdDFIXAeuS2kQrd8nazfkfjxF7BQ79aIC0EadF3kYm+3h704zX\n WrEFzWqHqWKyFWmXR+cZoF4FBPAmX4DzW0rc/2ajp04wdHXXghH+iaEHh+NXo4Fahd2G\n B3QVXW9kFIm97PI0jmwXZpf0qCNzHSzUDXYzjb0XRhgKIkoVkBvvlWjzFiqzFnYtK81y\n CwnA==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20210112;\n h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version\n :content-transfer-encoding;\n bh=jJQ/SsCai4owLalCsBsrj8ey2DEm8CmI4OPZMovAd1s=;\n b=jKeYbX9sxU7KymOZtROp5NZVeWTXLT8QIIecMT81zZ03XHfnJ4g5oIUstXK+iERtVl\n Lx2bqPAxi+ZoC0XpsQ6DRW4Ib0uMqSTQkmbUQQ3quQ8OwTDhvfS+w9VQU1ekofvPgGxj\n LYc4TWENiC5on+AVXRalyDF0gEmQGAPapo3YKXC+TzIx4fsJfbOyA/EGcYJzykPPraVv\n lOGjQxIBGFh7Yca3xkhE1+A/oqkrAztnMFcUsXsOQlRaEclLW2IKumsKZo9ESKXckaam\n VsmKwd/mM/1w7FWNf8MRyvq+gQZDMT/R0+cnOALgInN33ssZo1pjEGZDK5Wjo14GCkJk\n zTZA==",
        "X-Gm-Message-State": "AOAM533BmB+PHnZxPDWJriMygpNvNja6bLpywyLMevnRE/Z9RzTwnPDX\n pV8TqU6LCJbcxSYvNsmprRKjK0eYqpQ=",
        "X-Google-Smtp-Source": "\n ABdhPJx947IPZQTj8j27uPD+S72XQgPD3Il05FyAwcZ2tvZemRg8am6Y49qoCQVLqsjjnu0jaxoP6A==",
        "X-Received": "by 2002:a05:6512:3409:: with SMTP id\n i9mr4974585lfr.659.1631813430254;\n Thu, 16 Sep 2021 10:30:30 -0700 (PDT)",
        "From": "Vladislav Odintsov <odivlad@gmail.com>",
        "To": "dev@openvswitch.org",
        "Date": "Thu, 16 Sep 2021 20:30:28 +0300",
        "Message-Id": "<20210916173028.9527-1-odivlad@gmail.com>",
        "X-Mailer": "git-send-email 2.30.0",
        "MIME-Version": "1.0",
        "Cc": "Vladislav Odintsov <odivlad@gmail.com>",
        "Subject": "[ovs-dev] [PATCH ovn] controller: configure only matching encaps\n\tbetween 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": "Previously tunnels encap on a chassis was based on the remote chassis\n\"best\" encap type. Suppose we have 2 chassis: one with STT, another with\nGENEVE. In this case on chassis 1 there was configured STT tunnel, and\nGENEVE on another one. No traffic could be sent between these chassis.\n\nWith this approach it was impossible to change encap type\nfor chassis one-by-one, because different tunnel types were\nconfigured on different edges of the link.\nSuppose we have 2 chassis: one with STT and VXLAN configured encaps,\nanother with GENEVE and STT. In\nthis case on chassis 1 there was configured STT tunnel (best of VXLAN\nand STT) and GENEVE on another one (\"best\" of GENEVE and STT).\nNo traffic could be sent between these chassis. Though the common STT\ncould be used.\n\nNow we configure only matching encaps between nodes.\n\nSigned-off-by: Vladislav Odintsov <odivlad@gmail.com>\n---\n controller/encaps.c         | 23 ++++++++++++++++++-----\n controller/ovn-controller.h |  3 ++-\n tests/ovn-controller.at     | 14 +++++++++++---\n 3 files changed, 31 insertions(+), 9 deletions(-)",
    "diff": "diff --git a/controller/encaps.c b/controller/encaps.c\nindex fc93bf1ee..200b4405d 100644\n--- a/controller/encaps.c\n+++ b/controller/encaps.c\n@@ -248,15 +248,26 @@ exit:\n     smap_destroy(&options);\n }\n \n+static bool\n+chassis_has_type(const struct sbrec_chassis *chassis, uint32_t tun_type) {\n+    for (int i =0; i < chassis->n_encaps; i++) {\n+        if (get_tunnel_type(chassis->encaps[i]->type) == tun_type) {\n+            return true;\n+        }\n+    }\n+    return false;\n+}\n+\n struct sbrec_encap *\n-preferred_encap(const struct sbrec_chassis *chassis_rec)\n+preferred_encap(const struct sbrec_chassis *chassis_rec,\n+                const struct sbrec_chassis *this_chassis)\n {\n     struct sbrec_encap *best_encap = NULL;\n     uint32_t best_type = 0;\n \n     for (int i = 0; i < chassis_rec->n_encaps; i++) {\n         uint32_t tun_type = get_tunnel_type(chassis_rec->encaps[i]->type);\n-        if (tun_type > best_type) {\n+        if (tun_type > best_type && chassis_has_type(this_chassis, tun_type)) {\n             best_type = tun_type;\n             best_encap = chassis_rec->encaps[i];\n         }\n@@ -270,9 +281,11 @@ preferred_encap(const struct sbrec_chassis *chassis_rec)\n  * as there are VTEP of that type (differentiated by remote_ip) on that chassis.\n  */\n static int\n-chassis_tunnel_add(const struct sbrec_chassis *chassis_rec, const struct sbrec_sb_global *sbg, struct tunnel_ctx *tc)\n+chassis_tunnel_add(const struct sbrec_chassis *chassis_rec,\n+                   const struct sbrec_sb_global *sbg, struct tunnel_ctx *tc,\n+                   const struct sbrec_chassis *this_chassis)\n {\n-    struct sbrec_encap *encap = preferred_encap(chassis_rec);\n+    struct sbrec_encap *encap = preferred_encap(chassis_rec, this_chassis);\n     int tuncnt = 0;\n \n     if (!encap) {\n@@ -390,7 +403,7 @@ encaps_run(struct ovsdb_idl_txn *ovs_idl_txn,\n                 continue;\n             }\n \n-            if (chassis_tunnel_add(chassis_rec, sbg, &tc) == 0) {\n+            if (chassis_tunnel_add(chassis_rec, sbg, &tc, this_chassis) == 0) {\n                 VLOG_INFO(\"Creating encap for '%s' failed\", chassis_rec->name);\n                 continue;\n             }\ndiff --git a/controller/ovn-controller.h b/controller/ovn-controller.h\nindex 78a53312f..ea48a36cb 100644\n--- a/controller/ovn-controller.h\n+++ b/controller/ovn-controller.h\n@@ -43,7 +43,8 @@ struct ct_zone_pending_entry {\n const struct ovsrec_bridge *get_bridge(const struct ovsrec_bridge_table *,\n                                        const char *br_name);\n \n-struct sbrec_encap *preferred_encap(const struct sbrec_chassis *);\n+struct sbrec_encap *preferred_encap(const struct sbrec_chassis *,\n+                                    const struct sbrec_chassis *);\n \n uint32_t get_tunnel_type(const char *name);\n \ndiff --git a/tests/ovn-controller.at b/tests/ovn-controller.at\nindex 4ae218ed6..3d27ddd2f 100644\n--- a/tests/ovn-controller.at\n+++ b/tests/ovn-controller.at\n@@ -263,9 +263,8 @@ check_tunnel_property () {\n     test \"`ovs-vsctl get interface ovn-fakech-0 $1`\" = \"$2\"\n }\n \n-# Start off with a remote chassis supporting STT\n-ovn-sbctl chassis-add fakechassis stt 192.168.0.2\n-OVS_WAIT_UNTIL([check_tunnel_property type stt])\n+# create \"empty\" chassis. vxlan is used here as a stub\n+ovn-sbctl chassis-add fakechassis vxlan 192.168.0.2\n \n # See if we switch to Geneve as the first choice when it is available\n # With multi-VTEP support we support tunnels with different IPs to the\n@@ -278,6 +277,15 @@ OVS_WAIT_UNTIL([check_tunnel_property type stt])\n encap_uuid=$(ovn-sbctl add chassis fakechassis encaps @encap -- --id=@encap create encap type=geneve ip=\"192.168.0.2\")\n OVS_WAIT_UNTIL([check_tunnel_property type geneve])\n \n+# change geneve to stt and check that tun interface was deleted and there is\n+# no stt encap on the second chassis, only vxlan\n+ovn-sbctl set encap ${encap_uuid} type=stt\n+OVS_WAIT_WHILE([check_tunnel_property type stt])\n+OVS_WAIT_UNTIL([check_tunnel_property type vxlan])\n+\n+# change back to geneve\n+ovn-sbctl set encap ${encap_uuid} type=geneve\n+\n # Check that changes within an encap row are propagated\n ovn-sbctl set encap ${encap_uuid} ip=192.168.0.2\n OVS_WAIT_UNTIL([check_tunnel_property options:remote_ip \"\\\"192.168.0.2\\\"\"])\n",
    "prefixes": [
        "ovs-dev"
    ]
}