Also remove the reset mechanism when DB is reconnected, because at DB
reconnection the data in IDL would not reset.

Signed-off-by: Han Zhou <hz...@ovn.org>
Acked-by: Dumitru Ceara <dce...@redhat.com>
Acked-by: Frode Nordahl <frode.nord...@canonical.com>
---
 controller/ovn-controller.c |  1 -
 controller/vif-plug.c       | 20 ++++++--------------
 controller/vif-plug.h       |  1 -
 tests/ovn.at                |  2 ++
 4 files changed, 8 insertions(+), 16 deletions(-)

diff --git a/controller/ovn-controller.c b/controller/ovn-controller.c
index 51e2b3c40..0b0ccc48a 100644
--- a/controller/ovn-controller.c
+++ b/controller/ovn-controller.c
@@ -3936,7 +3936,6 @@ main(int argc, char *argv[])
             if (!new_ovnsb_cond_seqno) {
                 VLOG_INFO("OVNSB IDL reconnected, force recompute.");
                 engine_set_force_recompute(true);
-                vif_plug_reset_idl_prime_counter();
             }
             ovnsb_cond_seqno = new_ovnsb_cond_seqno;
         }
diff --git a/controller/vif-plug.c b/controller/vif-plug.c
index c6fbe7e59..38348bf54 100644
--- a/controller/vif-plug.c
+++ b/controller/vif-plug.c
@@ -532,22 +532,14 @@ vif_plug_handle_iface(const struct ovsrec_interface 
*iface_rec,
  * completeness of the initial data downloading we need this counter so that we
  * do not erronously unplug ports because the data is just not loaded yet.
  */
-#define VIF_PLUG_PRIME_IDL_COUNT_SEEED 10
-static int vif_plug_prime_idl_count = VIF_PLUG_PRIME_IDL_COUNT_SEEED;
-
-void
-vif_plug_reset_idl_prime_counter(void)
-{
-    vif_plug_prime_idl_count = VIF_PLUG_PRIME_IDL_COUNT_SEEED;
-}
-
 void
 vif_plug_run(struct vif_plug_ctx_in *vif_plug_ctx_in,
              struct vif_plug_ctx_out *vif_plug_ctx_out)
 {
-    if (vif_plug_prime_idl_count && --vif_plug_prime_idl_count > 0) {
-        VLOG_DBG("vif_plug_run: vif_plug_prime_idl_count=%d, will not unplug "
-                 "ports in this iteration.", vif_plug_prime_idl_count);
+    bool delay_plug = daemon_started_recently();
+    if (delay_plug) {
+        VLOG_DBG("vif_plug_run: daemon started recently, will not unplug "
+                 "ports in this iteration.");
     }
 
     if (!vif_plug_ctx_in->chassis_rec) {
@@ -557,7 +549,7 @@ vif_plug_run(struct vif_plug_ctx_in *vif_plug_ctx_in,
     OVSREC_INTERFACE_TABLE_FOR_EACH (iface_rec,
                                      vif_plug_ctx_in->iface_table) {
         vif_plug_handle_iface(iface_rec, vif_plug_ctx_in, vif_plug_ctx_out,
-                              !vif_plug_prime_idl_count);
+                              !delay_plug);
     }
 
     struct sbrec_port_binding *target =
@@ -573,7 +565,7 @@ vif_plug_run(struct vif_plug_ctx_in *vif_plug_ctx_in,
         enum en_lport_type lport_type = get_lport_type(pb);
         if (lport_type == LP_VIF) {
             vif_plug_handle_lport_vif(pb, vif_plug_ctx_in, vif_plug_ctx_out,
-                                      !vif_plug_prime_idl_count);
+                                      !delay_plug);
         }
     }
     sbrec_port_binding_index_destroy_row(target);
diff --git a/controller/vif-plug.h b/controller/vif-plug.h
index 76063591b..7a1978e38 100644
--- a/controller/vif-plug.h
+++ b/controller/vif-plug.h
@@ -71,7 +71,6 @@ void vif_plug_clear_changed(struct shash *deleted_iface_ids);
 void vif_plug_finish_changed(struct shash *changed_iface_ids);
 void vif_plug_clear_deleted(struct shash *deleted_iface_ids);
 void vif_plug_finish_deleted(struct shash *changed_iface_ids);
-void vif_plug_reset_idl_prime_counter(void);
 
 #ifdef  __cplusplus
 }
diff --git a/tests/ovn.at b/tests/ovn.at
index bbad0f194..e811f82cc 100644
--- a/tests/ovn.at
+++ b/tests/ovn.at
@@ -31661,6 +31661,7 @@ OVS_WAIT_UNTIL([
     test x43 = x$(as hv1 ovs-vsctl get Interface ${iface1_uuid} mtu_request)
 ])
 
+as hv1 check ovn-appctl -t ovn-controller debug/ignore-startup-delay
 # Check that pointing requested-chassis somewhere else will unplug the port
 check ovn-nbctl --wait=hv set Logical_Switch_Port lsp1 \
     options:requested-chassis=non-existent-chassis
@@ -31668,6 +31669,7 @@ OVS_WAIT_UNTIL([
     ! as hv1 ovs-vsctl get Interface ${iface1_uuid} _uuid
 ])
 
+as hv2 check ovn-appctl -t ovn-controller debug/ignore-startup-delay
 # Check that removing an lport will unplug it
 AT_CHECK([test x${iface2_uuid} = x$(as hv2 ovs-vsctl get Interface 
${iface2_uuid} _uuid)], [0], [])
 check ovn-nbctl --wait=hv lsp-del ${lsp2_uuid}
-- 
2.30.2

_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to