get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 787928,
    "url": "http://patchwork.ozlabs.org/api/patches/787928/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/openvswitch/patch/1499965361-32021-8-git-send-email-majopela@redhat.com/",
    "project": {
        "id": 47,
        "url": "http://patchwork.ozlabs.org/api/projects/47/?format=api",
        "name": "Open vSwitch",
        "link_name": "openvswitch",
        "list_id": "ovs-dev.openvswitch.org",
        "list_email": "ovs-dev@openvswitch.org",
        "web_url": "http://openvswitch.org/",
        "scm_url": "git@github.com:openvswitch/ovs.git",
        "webscm_url": "https://github.com/openvswitch/ovs",
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<1499965361-32021-8-git-send-email-majopela@redhat.com>",
    "list_archive_url": null,
    "date": "2017-07-13T17:02:41",
    "name": "[ovs-dev,v5,8/8] ovn: l3ha ensure no master bouncing when ovn-controller is restarted",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "9b3da8bd35c5ef48df179966e740573e5331732c",
    "submitter": {
        "id": 67170,
        "url": "http://patchwork.ozlabs.org/api/people/67170/?format=api",
        "name": "Miguel Angel Ajo",
        "email": "majopela@redhat.com"
    },
    "delegate": {
        "id": 55721,
        "url": "http://patchwork.ozlabs.org/api/users/55721/?format=api",
        "username": "russellb",
        "first_name": "Russell",
        "last_name": "Bryant",
        "email": "rbryant@redhat.com"
    },
    "mbox": "http://patchwork.ozlabs.org/project/openvswitch/patch/1499965361-32021-8-git-send-email-majopela@redhat.com/mbox/",
    "series": [],
    "comments": "http://patchwork.ozlabs.org/api/patches/787928/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/787928/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@mail.linuxfoundation.org"
        ],
        "Received": [
            "from mail.linuxfoundation.org (mail.linuxfoundation.org\n\t[140.211.169.12])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3x7j1v3BTVz9t2S\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 14 Jul 2017 03:08:03 +1000 (AEST)",
            "from mail.linux-foundation.org (localhost [127.0.0.1])\n\tby mail.linuxfoundation.org (Postfix) with ESMTP id 1FB83BC9;\n\tThu, 13 Jul 2017 17:03:05 +0000 (UTC)",
            "from smtp1.linuxfoundation.org (smtp1.linux-foundation.org\n\t[172.17.192.35])\n\tby mail.linuxfoundation.org (Postfix) with ESMTPS id 4C7AEB92\n\tfor <dev@openvswitch.org>; Thu, 13 Jul 2017 17:03:04 +0000 (UTC)",
            "from mail-wm0-f43.google.com (mail-wm0-f43.google.com\n\t[74.125.82.43])\n\tby smtp1.linuxfoundation.org (Postfix) with ESMTPS id 860D6CD\n\tfor <dev@openvswitch.org>; Thu, 13 Jul 2017 17:03:03 +0000 (UTC)",
            "by mail-wm0-f43.google.com with SMTP id w126so29521019wme.0\n\tfor <dev@openvswitch.org>; Thu, 13 Jul 2017 10:03:03 -0700 (PDT)",
            "from ctl.localdomain (111.148.134.37.dynamic.jazztel.es.\n\t[37.134.148.111]) by smtp.gmail.com with ESMTPSA id\n\t46sm7134176wrz.8.2017.07.13.10.02.59\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tThu, 13 Jul 2017 10:02:59 -0700 (PDT)"
        ],
        "X-Greylist": "whitelisted by SQLgrey-1.7.6",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references;\n\tbh=nJXHmW4w+1cZUvSbNZvzCUMDSMTesR4o5puuSHG1WN4=;\n\tb=MkWQvtF1iVpnkbCCCb0KigesvBb8UU9ABZL7AArV49b/xqPg5929Hv2AsIfTAJA2wB\n\tEZVMtxlY+nSDtePohQjxYx3mp9inXk7UjT/PSuURG2EWx7sqbk3OnQLZ48O2p8w7v/ej\n\trogcvODK8nnkcPB+jQeHKjQoCo6k/JqqNMKLMVCjBvM5rbx1pedkcS5darAt2jEh0Atn\n\tosyUXI1rN2hVDngWY+fYcVaZgVGRxN1LDARula72Rh/bU/z1fyJPSnds9zRLHG30iE+4\n\tDDu28oCrAhyMkcDv5vYKlPCcGKguSjuCOi/WkbYq2QEp+tyHw11nypJoY6fGTtNxwD2n\n\tGeMQ==",
        "X-Gm-Message-State": "AIVw110aq2zUnLvjM0o/F6dUnrtrzB+APJ/6G7wKo44lXmT41hoyrPdF\n\tpbuuZKVM336QUteRyfCrXw==",
        "X-Received": "by 10.28.137.199 with SMTP id l190mr2839424wmd.117.1499965381787;\n\tThu, 13 Jul 2017 10:03:01 -0700 (PDT)",
        "From": "Miguel Angel Ajo <majopela@redhat.com>",
        "To": "dev@openvswitch.org",
        "Date": "Thu, 13 Jul 2017 17:02:41 +0000",
        "Message-Id": "<1499965361-32021-8-git-send-email-majopela@redhat.com>",
        "X-Mailer": "git-send-email 1.8.3.1",
        "In-Reply-To": "<1499965361-32021-1-git-send-email-majopela@redhat.com>",
        "References": "<1496930708-15441-1-git-send-email-majopela@redhat.com>\n\t<1499965361-32021-1-git-send-email-majopela@redhat.com>",
        "X-Spam-Status": "No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE\n\tautolearn=ham version=3.3.1",
        "X-Spam-Checker-Version": "SpamAssassin 3.3.1 (2010-03-16) on\n\tsmtp1.linux-foundation.org",
        "Cc": "Miguel Angel Ajo <majopela@redhat.com>",
        "Subject": "[ovs-dev] [PATCH v5 8/8] ovn: l3ha ensure no master bouncing when\n\tovn-controller is restarted",
        "X-BeenThere": "ovs-dev@openvswitch.org",
        "X-Mailman-Version": "2.1.12",
        "Precedence": "list",
        "List-Id": "<ovs-dev.openvswitch.org>",
        "List-Unsubscribe": "<https://mail.openvswitch.org/mailman/options/ovs-dev>,\n\t<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\t<mailto:ovs-dev-request@openvswitch.org?subject=subscribe>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=\"us-ascii\"",
        "Content-Transfer-Encoding": "7bit",
        "Sender": "ovs-dev-bounces@openvswitch.org",
        "Errors-To": "ovs-dev-bounces@openvswitch.org"
    },
    "content": "When ovn-controller is restarted, ovn-controller removes the old\nChassis entry from the SBDB and a new one is inserted.\n\nThis cleared the Gateway_Chassis chassis column in the SBDB and then\novn-northd removed the empty-column Gateway_Chassis entry.\nSuch event made the other (non-restarted and master gateway chassis)\nbelieve that he was a single (non-HA) gateway, turning off BFD and\nreleasing the port for a tiny time frame causing unnecesary downtime.\n\nSigned-off-by: Miguel Angel Ajo <majopela@redhat.com>\n---\n ovn/northd/ovn-northd.c | 34 +++++++++++---------\n tests/ovn.at            | 82 +++++++++++++++++++++++++++++++++++++++++++++++++\n 2 files changed, 102 insertions(+), 14 deletions(-)",
    "diff": "diff --git a/ovn/northd/ovn-northd.c b/ovn/northd/ovn-northd.c\nindex 9a1e6c1..62a73f3 100644\n--- a/ovn/northd/ovn-northd.c\n+++ b/ovn/northd/ovn-northd.c\n@@ -1684,11 +1684,22 @@ gateway_chassis_equal(const struct nbrec_gateway_chassis *nb_gwc,\n                       const struct sbrec_chassis *nb_gwc_c,\n                       const struct sbrec_gateway_chassis *sb_gwc)\n {\n-    return !strcmp(nb_gwc->name, sb_gwc->name)\n-           && !strcmp(nb_gwc_c->name, sb_gwc->chassis->name)\n-           && nb_gwc->priority == sb_gwc->priority\n-           && smap_equal(&nb_gwc->options, &sb_gwc->options)\n-           && smap_equal(&nb_gwc->external_ids, &sb_gwc->external_ids);\n+    bool equal = !strcmp(nb_gwc->name, sb_gwc->name)\n+                 && nb_gwc->priority == sb_gwc->priority\n+                 && smap_equal(&nb_gwc->options, &sb_gwc->options)\n+                 && smap_equal(&nb_gwc->external_ids, &sb_gwc->external_ids);\n+\n+    if (!equal) {\n+        return false;\n+    }\n+\n+    /* If everything else matched and we were unable to find the SBDB\n+     * Chassis entry at this time, assume a match and return true.\n+     * This happens when an ovn-controller is restarting and the Chassis\n+     * entry is gone away momentarily */\n+    return !nb_gwc_c\n+           || (sb_gwc->chassis && !strcmp(nb_gwc_c->name,\n+                                          sb_gwc->chassis->name));\n }\n \n static bool\n@@ -1723,11 +1734,10 @@ sbpb_gw_chassis_needs_update(\n             chassis_lookup_by_name(chassis_index,\n                                    lrp->gateway_chassis[n]->chassis_name);\n \n-        if (chassis) {\n-            lrp_gwc_c[lrp_n_gateway_chassis] = chassis;\n-            lrp_gwc[lrp_n_gateway_chassis] = lrp->gateway_chassis[n];\n-            lrp_n_gateway_chassis++;\n-        } else {\n+        lrp_gwc_c[lrp_n_gateway_chassis] = chassis;\n+        lrp_gwc[lrp_n_gateway_chassis] = lrp->gateway_chassis[n];\n+        lrp_n_gateway_chassis++;\n+        if (!chassis) {\n             static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 1);\n             VLOG_WARN_RL(\n                 &rl, \"Chassis name %s referenced in NBDB via Gateway_Chassis \"\n@@ -1807,10 +1817,6 @@ copy_gw_chassis_from_nbrp_to_sbpb(\n         const struct sbrec_chassis *chassis =\n             chassis_lookup_by_name(chassis_index, lrp_gwc->chassis_name);\n \n-        if (!chassis) {\n-            continue;\n-        }\n-\n         gw_chassis = xrealloc(gw_chassis, (n_gwc + 1) * sizeof *gw_chassis);\n \n         struct sbrec_gateway_chassis *pb_gwc =\ndiff --git a/tests/ovn.at b/tests/ovn.at\nindex 5a0b761..07b822d 100644\n--- a/tests/ovn.at\n+++ b/tests/ovn.at\n@@ -8080,3 +8080,85 @@ AT_CHECK([grep $garp hv2_br_phys_tx | sort], [0], [])\n OVN_CLEANUP([hv1],[hv2],[hv3])\n \n AT_CLEANUP\n+\n+AT_SETUP([ovn -- ensure one gw controller restart in HA doesn't bounce the master])\n+AT_SKIP_IF([test $HAVE_PYTHON = no])\n+ovn_start\n+\n+net_add n1\n+\n+# create two gateways with external network connectivity\n+for i in 1 2; do\n+    sim_add gw$i\n+    as gw$i\n+    ovs-vsctl add-br br-phys\n+    ovn_attach n1 br-phys 192.168.0.$i\n+    ovs-vsctl set open . external-ids:ovn-bridge-mappings=phys:br-phys\n+done\n+\n+ovn-nbctl ls-add inside\n+ovn-nbctl ls-add outside\n+\n+# create one hypervisors with a vif port the internal network\n+sim_add hv1\n+as hv1\n+ovs-vsctl add-br br-phys\n+ovn_attach n1 br-phys 192.168.0.11\n+ovs-vsctl -- add-port br-int hv1-vif1 -- \\\n+    set interface hv1-vif1 external-ids:iface-id=inside1 \\\n+    options:tx_pcap=hv1/vif1-tx.pcap \\\n+    options:rxq_pcap=hv1/vif1-rx.pcap \\\n+    ofport-request=1\n+\n+ovn-nbctl lsp-add inside inside1 \\\n+        -- lsp-set-addresses inside1 \"f0:00:00:01:22:01 192.168.1.101\"\n+\n+\n+ovn_populate_arp\n+\n+ovn-nbctl create Logical_Router name=R1\n+\n+# Connect inside to R1\n+ovn-nbctl lrp-add R1 inside 00:00:01:01:02:03 192.168.1.1/24\n+ovn-nbctl lsp-add inside rp-inside -- set Logical_Switch_Port rp-inside \\\n+    type=router options:router-port=inside \\\n+    -- lsp-set-addresses rp-inside router\n+\n+# Connect outside to R1 as distributed router gateway port on gw1+gw2\n+ovn-nbctl lrp-add R1 outside 00:00:02:01:02:04 192.168.0.101/24\n+\n+ovn-nbctl --id=@gc0 create Gateway_Chassis \\\n+                    name=outside_gw1 chassis_name=gw1 priority=20 -- \\\n+          --id=@gc1 create Gateway_Chassis \\\n+                    name=outside_gw2 chassis_name=gw2 priority=10 -- \\\n+          set Logical_Router_Port outside 'gateway_chassis=[@gc0,@gc1]'\n+\n+ovn-nbctl lsp-add outside rp-outside -- set Logical_Switch_Port rp-outside \\\n+    type=router options:router-port=outside \\\n+    -- lsp-set-addresses rp-outside router\n+\n+# Create localnet port in outside\n+ovn-nbctl lsp-add outside ln-outside\n+ovn-nbctl lsp-set-addresses ln-outside unknown\n+ovn-nbctl lsp-set-type ln-outside localnet\n+ovn-nbctl lsp-set-options ln-outside network_name=phys\n+\n+# Allow some time for ovn-northd and ovn-controller to catch up.\n+ovn-nbctl --wait=hv sync\n+\n+# currently when ovn-controller is restarted, the old entry is deleted\n+# and a new one is created, which leaves the Gateway_Chassis with\n+# an empty chassis for a while. NOTE: restarting ovn-controller in tests\n+# doesn't have the same effect because \"name\" is conserved, and the\n+# Chassis entry is not replaced.\n+\n+gw2_chassis=$(ovn-sbctl --bare --columns=_uuid find Chassis name=gw2)\n+ovn-sbctl destroy Chassis $gw2_chassis\n+\n+sleep 2\n+\n+AT_CHECK([grep \"Releasing lport\" gw1/ovn-controller.log], [1], [])\n+\n+OVN_CLEANUP([gw1],[gw2],[hv1])\n+\n+AT_CLEANUP\n",
    "prefixes": [
        "ovs-dev",
        "v5",
        "8/8"
    ]
}