get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 2216548,
    "url": "http://patchwork.ozlabs.org/api/patches/2216548/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/ovn/patch/20260326174334.2003280-1-jtanenba@redhat.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": "<20260326174334.2003280-1-jtanenba@redhat.com>",
    "list_archive_url": null,
    "date": "2026-03-26T17:43:34",
    "name": "[ovs-dev,v3] ovn-controller: Port up/ovn-installed reported too early.",
    "commit_ref": null,
    "pull_url": null,
    "state": "changes-requested",
    "archived": false,
    "hash": "b3bdccf3979296fbe42f552896bad23e3dcb5522",
    "submitter": {
        "id": 88238,
        "url": "http://patchwork.ozlabs.org/api/people/88238/?format=api",
        "name": "Jacob Tanenbaum",
        "email": "jtanenba@redhat.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/ovn/patch/20260326174334.2003280-1-jtanenba@redhat.com/mbox/",
    "series": [
        {
            "id": 497634,
            "url": "http://patchwork.ozlabs.org/api/series/497634/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/ovn/list/?series=497634",
            "date": "2026-03-26T17:43:34",
            "name": "[ovs-dev,v3] ovn-controller: Port up/ovn-installed reported too early.",
            "version": 3,
            "mbox": "http://patchwork.ozlabs.org/series/497634/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2216548/comments/",
    "check": "success",
    "checks": "http://patchwork.ozlabs.org/api/patches/2216548/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@legolas.ozlabs.org",
            "ovs-dev@lists.linuxfoundation.org"
        ],
        "Authentication-Results": [
            "legolas.ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=TlkyqtPS;\n\tdkim-atps=neutral",
            "legolas.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=patchwork.ozlabs.org)",
            "smtp4.osuosl.org;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key)\n header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=TlkyqtPS",
            "smtp3.osuosl.org; dmarc=pass (p=quarantine dis=none)\n header.from=redhat.com",
            "smtp3.osuosl.org;\n dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com\n header.a=rsa-sha256 header.s=mimecast20190719 header.b=TlkyqtPS"
        ],
        "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 ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fhWNT5K0sz1y1G\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 27 Mar 2026 04:43:53 +1100 (AEDT)",
            "from localhost (localhost [127.0.0.1])\n\tby smtp4.osuosl.org (Postfix) with ESMTP id E4DD8409A2;\n\tThu, 26 Mar 2026 17:43:50 +0000 (UTC)",
            "from smtp4.osuosl.org ([127.0.0.1])\n by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP\n id lUgaH1VvICgj; Thu, 26 Mar 2026 17:43:49 +0000 (UTC)",
            "from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56])\n\tby smtp4.osuosl.org (Postfix) with ESMTPS id EA3C8409BB;\n\tThu, 26 Mar 2026 17:43:48 +0000 (UTC)",
            "from lf-lists.osuosl.org (localhost [127.0.0.1])\n\tby lists.linuxfoundation.org (Postfix) with ESMTP id B70D6C04E8;\n\tThu, 26 Mar 2026 17:43:48 +0000 (UTC)",
            "from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136])\n by lists.linuxfoundation.org (Postfix) with ESMTP id 21263C04E7\n for <dev@openvswitch.org>; Thu, 26 Mar 2026 17:43:47 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n by smtp3.osuosl.org (Postfix) with ESMTP id 0164060BBB\n for <dev@openvswitch.org>; Thu, 26 Mar 2026 17:43:47 +0000 (UTC)",
            "from smtp3.osuosl.org ([127.0.0.1])\n by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP\n id mf2_tpz0LIsw for <dev@openvswitch.org>;\n Thu, 26 Mar 2026 17:43:46 +0000 (UTC)",
            "from us-smtp-delivery-124.mimecast.com\n (us-smtp-delivery-124.mimecast.com [170.10.133.124])\n by smtp3.osuosl.org (Postfix) with ESMTPS id BFD3860B1B\n for <dev@openvswitch.org>; Thu, 26 Mar 2026 17:43:45 +0000 (UTC)",
            "from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com\n (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by\n relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3,\n cipher=TLS_AES_256_GCM_SHA384) id us-mta-478-G4eFThypN6CxIf62jJpmLQ-1; Thu,\n 26 Mar 2026 13:43:42 -0400",
            "from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com\n (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17])\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 mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS\n id 2F0BE1800345\n for <dev@openvswitch.org>; Thu, 26 Mar 2026 17:43:41 +0000 (UTC)",
            "from jtanenba-thinkpadp16vgen1.boston.csb (unknown [10.22.81.162])\n by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP\n id 3CDBA1955D84; Thu, 26 Mar 2026 17:43:39 +0000 (UTC)"
        ],
        "X-Virus-Scanned": [
            "amavis at osuosl.org",
            "amavis at osuosl.org"
        ],
        "X-Comment": "SPF check N/A for local connections - client-ip=140.211.9.56;\n helo=lists.linuxfoundation.org;\n envelope-from=ovs-dev-bounces@openvswitch.org; receiver=<UNKNOWN> ",
        "DKIM-Filter": [
            "OpenDKIM Filter v2.11.0 smtp4.osuosl.org EA3C8409BB",
            "OpenDKIM Filter v2.11.0 smtp3.osuosl.org BFD3860B1B"
        ],
        "Received-SPF": "Pass (mailfrom) identity=mailfrom; client-ip=170.10.133.124;\n helo=us-smtp-delivery-124.mimecast.com; envelope-from=jtanenba@redhat.com;\n receiver=<UNKNOWN>",
        "DMARC-Filter": "OpenDMARC Filter v1.4.2 smtp3.osuosl.org BFD3860B1B",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1774547023;\n h=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n to:to:cc:cc:mime-version:mime-version:content-type:content-type:\n content-transfer-encoding:content-transfer-encoding;\n bh=EanlVxNvpQE25il19hazXSHrIg8ogPE8HkINedOMkhU=;\n b=TlkyqtPSa+ZQdVp/2DmnfumwA/1kzxcPAHM68WZHwJbzeaKa8M5Md6V+eQhIugBUTDjbGc\n qUaZe4BC+8vs7ms9s7zyA4hEEaJ7oAvMVN8A2RohwrpLFv6i4zURKS+gTr7rhWNovGv++y\n R2xpzVGo/fMG25FZfxTKMTjVzJLX0Xo=",
        "X-MC-Unique": "G4eFThypN6CxIf62jJpmLQ-1",
        "X-Mimecast-MFC-AGG-ID": "G4eFThypN6CxIf62jJpmLQ_1774547021",
        "To": "dev@openvswitch.org",
        "Date": "Thu, 26 Mar 2026 13:43:34 -0400",
        "Message-ID": "<20260326174334.2003280-1-jtanenba@redhat.com>",
        "MIME-Version": "1.0",
        "X-Scanned-By": "MIMEDefang 3.0 on 10.30.177.17",
        "X-Mimecast-Spam-Score": "0",
        "X-Mimecast-MFC-PROC-ID": "QdLGv7mLcFmLRg99G0XlqfJu-j8lhdAzOS3__vYlZqE_1774547021",
        "X-Mimecast-Originator": "redhat.com",
        "Subject": "[ovs-dev] [Patch ovn v3] ovn-controller: Port up/ovn-installed\n reported too early.",
        "X-BeenThere": "ovs-dev@openvswitch.org",
        "X-Mailman-Version": "2.1.30",
        "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>",
        "From": "Jacob Tanenbaum via dev <ovs-dev@openvswitch.org>",
        "Reply-To": "Jacob Tanenbaum <jtanenba@redhat.com>",
        "Cc": "dceara@redhat.com",
        "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": "when ovn-monitor-all is set to false the ovn-controller sets\novn-installed on OVS interfaces too early. ovn-controller needs to wait\nfor the response from the southbound database with the updates to the\nnewly monitored southbound fields and after that wait for flows to be\ninstalled in OVS before labeling as installed.\n\nReported-at: https://redhat.atlassian.net/browse/FDP-2887\nSigned-off-by: Jacob Tanenbaum <jtanenba@redhat.com>\n---\nv2->v3\n* adding the ld->monitor_updated required the additiona of checking for\n  monitor_all in update_sb_monitors. I didn't account for being able to\n  toggle on monitor_all\n\nv1->v2\n* if_status_mgr_run() will run everytime the conditional seqno is\n  changed so it should be safe to only skip when the expected_seqno and\n  seqno returned from ovn are strictly not equal, that way we do not\n  have to deal with overflow in the seqno. Additionally add a boolean to\n  the local_datapath in the event that the seqno wraps around at the\n  same time the datapath would go back into the state OIF_INSTALL_FLOWS.\n* remove setting the state to itself for OIF_INSTALL_FLOWS in\n  if_status_mgr_update()\n* added assert(pb) in if_status_mgr_run()\n* removed a manual loop looking for the local_datapath and replaced with\n  get_local_datapath() in if_status_mgr_run\n* remove a few nit spelling errors in the test case",
    "diff": "diff --git a/controller/if-status.c b/controller/if-status.c\nindex ee9337e63..2114305d1 100644\n--- a/controller/if-status.c\n+++ b/controller/if-status.c\n@@ -18,6 +18,7 @@\n #include \"binding.h\"\n #include \"if-status.h\"\n #include \"lib/ofctrl-seqno.h\"\n+#include \"local_data.h\"\n #include \"ovsport.h\"\n #include \"simap.h\"\n \n@@ -590,12 +591,17 @@ if_status_mgr_update(struct if_status_mgr *mgr,\n         }\n     }\n \n+    bool update_seqno = false;\n     /* Update pb->chassis in case it's not set (previous update still in fly\n      * or pb->chassis was overwitten by another chassis.\n      */\n     if (!sb_readonly) {\n         HMAPX_FOR_EACH_SAFE (node, &mgr->ifaces_per_state[OIF_INSTALL_FLOWS]) {\n             struct ovs_iface *iface = node->data;\n+            if (iface->is_vif) {\n+                iface->install_seqno = mgr->iface_seqno + 1;\n+                update_seqno = true;\n+            }\n             if (!local_bindings_pb_chassis_is_set(bindings, iface->id,\n                 chassis_rec)) {\n                 long long int now = time_msec();\n@@ -614,7 +620,6 @@ if_status_mgr_update(struct if_status_mgr *mgr,\n \n     /* Move newly claimed interfaces from OIF_CLAIMED to OIF_INSTALL_FLOWS.\n      */\n-    bool new_ifaces = false;\n     if (!sb_readonly) {\n         HMAPX_FOR_EACH_SAFE (node, &mgr->ifaces_per_state[OIF_CLAIMED]) {\n             struct ovs_iface *iface = node->data;\n@@ -624,7 +629,7 @@ if_status_mgr_update(struct if_status_mgr *mgr,\n             if (iface->is_vif) {\n                 ovs_iface_set_state(mgr, iface, OIF_INSTALL_FLOWS);\n                 iface->install_seqno = mgr->iface_seqno + 1;\n-                new_ifaces = true;\n+                update_seqno = true;\n             } else {\n                 ovs_iface_set_state(mgr, iface, OIF_MARK_UP);\n             }\n@@ -659,7 +664,7 @@ if_status_mgr_update(struct if_status_mgr *mgr,\n      * Request a seqno update when the flows for new interfaces have been\n      * installed in OVS.\n      */\n-    if (new_ifaces) {\n+    if (update_seqno) {\n         mgr->iface_seqno++;\n         ofctrl_seqno_update_create(mgr->iface_seq_type_pb_cfg,\n                                    mgr->iface_seqno);\n@@ -694,6 +699,8 @@ if_status_mgr_run(struct if_status_mgr *mgr,\n                   const struct sbrec_chassis *chassis_rec,\n                   const struct ovsrec_interface_table *iface_table,\n                   const struct sbrec_port_binding_table *pb_table,\n+                  const struct hmap *local_datapaths,\n+                  unsigned int ovnsb_cond_seqno,\n                   bool sb_readonly, bool ovs_readonly)\n {\n     struct ofctrl_acked_seqnos *acked_seqnos =\n@@ -703,10 +710,27 @@ if_status_mgr_run(struct if_status_mgr *mgr,\n     /* Move interfaces from state OIF_INSTALL_FLOWS to OIF_MARK_UP if a\n      * notification has been received aabout their flows being installed\n      * in OVS.\n+     *\n+     * In the ovn-monitor-all=false case it is possible that we have not\n+     * received the update that the southbound database is monitoring a new\n+     *  datapath. Check for the update before continuing.\n      */\n     HMAPX_FOR_EACH_SAFE (node, &mgr->ifaces_per_state[OIF_INSTALL_FLOWS]) {\n         struct ovs_iface *iface = node->data;\n \n+        if (local_datapaths) {\n+            const struct sbrec_port_binding *pb =\n+                sbrec_port_binding_table_get_for_uuid(pb_table,\n+                                                      &iface->pb_uuid);\n+            ovs_assert(pb);\n+            struct local_datapath *ld =\n+                get_local_datapath(local_datapaths, pb->datapath->tunnel_key);\n+            if (!ld->monitor_updated &&\n+                ld->expected_cond_seqno != ovnsb_cond_seqno) {\n+                continue;\n+            }\n+            ld->monitor_updated = true;\n+        }\n         if (!ofctrl_acked_seqnos_contains(acked_seqnos,\n                                           iface->install_seqno)) {\n             continue;\ndiff --git a/controller/if-status.h b/controller/if-status.h\nindex d15ca3008..a877ebe2b 100644\n--- a/controller/if-status.h\n+++ b/controller/if-status.h\n@@ -49,6 +49,8 @@ void if_status_mgr_run(struct if_status_mgr *mgr, struct local_binding_data *,\n                        const struct sbrec_chassis *,\n                        const struct ovsrec_interface_table *iface_table,\n                        const struct sbrec_port_binding_table *pb_table,\n+                       const struct hmap *local_datapaths,\n+                       const unsigned int ovnsb_cond_seqno,\n                        bool sb_readonly, bool ovs_readonly);\n void if_status_mgr_get_memory_usage(struct if_status_mgr *mgr,\n                                     struct simap *usage);\ndiff --git a/controller/local_data.h b/controller/local_data.h\nindex 948c1a935..51dcca416 100644\n--- a/controller/local_data.h\n+++ b/controller/local_data.h\n@@ -65,6 +65,11 @@ struct local_datapath {\n \n     struct shash external_ports;\n     struct shash multichassis_ports;\n+\n+    /* the expected seqno from the sb to be fully udpated for this datapath */\n+    unsigned int expected_cond_seqno;\n+    /* If the monitor has been updated for this datapath */\n+    bool monitor_updated;\n };\n \n struct local_datapath *local_datapath_alloc(\ndiff --git a/controller/ovn-controller.c b/controller/ovn-controller.c\nindex 4161fe2b3..6a65d50d9 100644\n--- a/controller/ovn-controller.c\n+++ b/controller/ovn-controller.c\n@@ -443,6 +443,18 @@ out:;\n         expected_cond_seqno = MAX(expected_cond_seqno, cond_seqnos[i]);\n     }\n \n+    if (local_datapaths) {\n+        struct local_datapath *ld;\n+        HMAP_FOR_EACH (ld, hmap_node, local_datapaths) {\n+            if (monitor_all) {\n+                ld->monitor_updated = true;\n+            }\n+            if (!ld->monitor_updated) {\n+                ld->expected_cond_seqno = expected_cond_seqno;\n+            }\n+        }\n+    }\n+\n     ovsdb_idl_condition_destroy(&pb);\n     ovsdb_idl_condition_destroy(&lf);\n     ovsdb_idl_condition_destroy(&ldpg);\n@@ -7903,6 +7915,10 @@ main(int argc, char *argv[])\n                                                   ovs_idl_loop.idl),\n                                       sbrec_port_binding_table_get(\n                                                  ovnsb_idl_loop.idl),\n+                                      runtime_data ?\n+                                            &runtime_data->local_datapaths\n+                                            : NULL,\n+                                      ovnsb_cond_seqno,\n                                       !ovnsb_idl_txn, !ovs_idl_txn);\n                     stopwatch_stop(IF_STATUS_MGR_RUN_STOPWATCH_NAME,\n                                    time_msec());\ndiff --git a/tests/ovn-controller.at b/tests/ovn-controller.at\nindex c98de9bc4..1d0c02290 100644\n--- a/tests/ovn-controller.at\n+++ b/tests/ovn-controller.at\n@@ -3944,3 +3944,67 @@ OVN_CLEANUP([hv1], [hv2\n /already has encap ip.*cannot duplicate on/d])\n AT_CLEANUP\n ])\n+\n+OVN_FOR_EACH_NORTHD([\n+AT_SETUP([ovn-installed])\n+ovn_start\n+\n+net_add n1\n+sim_add hv1\n+\n+as hv1\n+ovs-vsctl add-br br-phys\n+ovn_attach n1 br-phys 192.168.0.1\n+ovn-appctl vlog/set dbg\n+ovs-vsctl add-port br-int vif1 -- \\\n+    set Interface vif1 external-ids:iface-id=lsp1\n+\n+check ovn-nbctl ls-add ls1\n+sleep_controller hv1\n+check ovn-nbctl --wait=sb lsp-add ls1 lsp1 -- \\\n+                          lsp-set-addresses lsp1 \"f0:00:00:00:00:01 10.0.0.1\"\n+\n+sleep_sb\n+wake_up_controller hv1\n+\n+# Wait for pflow for lsp1\n+OVS_WAIT_UNTIL([\n+    ofport=$(as hv1 ovs-vsctl --bare --columns ofport find Interface name=vif1)\n+    echo \"vif1 port=$ofport\"\n+    test -n \"$ofport\" && test 1 -le $(as hv1 ovs-ofctl dump-flows br-int | grep -c in_port=$ofport)\n+])\n+\n+# if ovn-installed in ovs, all flows should be installed.\n+# In that case, there should be at least one flow with lsp1 address.\n+OVS_WAIT_UNTIL([\n+    ovn_installed=$(as hv1 ovs-vsctl get Interface vif1 external_ids:ovn-installed)\n+    flow_count=$(as hv1 ovs-ofctl dump-flows br-int | grep -Fc \"10.0.0.1\")\n+    # for the monitor-all=true case the flow gets installed because ovn-controller is monitoring all\n+    # tables in OVN_SOUTHBOUND.\n+    if test -n \"$ovn_installed\"; then\n+        as hv1 ovs-ofctl dump-flows br-int > output\n+        test $flow_count -ge 1\n+    else\n+        true\n+    fi\n+])\n+\n+wake_up_sb\n+# after the southbound db has woken up and can send the update to the ovn-controller not monitoring all\n+# tables in the southbound db it should be able to install the interface.\n+OVS_WAIT_UNTIL([\n+    ovn_installed=$(as hv1 ovs-vsctl get Interface vif1 external_ids:ovn-installed)\n+    flow_count=$(as hv1 ovs-ofctl dump-flows br-int | grep -Fc \"10.0.0.1\")\n+    echo \"installed=$ovn_installed, count=$flow_count\"\n+    if test -n \"$ovn_installed\"; then\n+        as hv1 ovs-ofctl dump-flows br-int > output\n+        test $flow_count -ge 1\n+    else\n+        false\n+    fi\n+])\n+wait_for_ports_up\n+\n+OVN_CLEANUP([hv1])\n+AT_CLEANUP\n+])\n",
    "prefixes": [
        "ovs-dev",
        "v3"
    ]
}