From patchwork Fri Aug 11 12:24:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dumitru Ceara X-Patchwork-Id: 1820269 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::133; helo=smtp2.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=ReaSlUpL; dkim-atps=neutral Received: from smtp2.osuosl.org (smtp2.osuosl.org [IPv6:2605:bc80:3010::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RMjg82vmqz1yf6 for ; Fri, 11 Aug 2023 22:25:24 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 5D05640C10; Fri, 11 Aug 2023 12:25:22 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 5D05640C10 Authentication-Results: smtp2.osuosl.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=ReaSlUpL X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 118zfJLV1VS7; Fri, 11 Aug 2023 12:25:21 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp2.osuosl.org (Postfix) with ESMTPS id 68D5F40B64; Fri, 11 Aug 2023 12:25:20 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 68D5F40B64 Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 43930C0071; Fri, 11 Aug 2023 12:25:20 +0000 (UTC) X-Original-To: ovs-dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by lists.linuxfoundation.org (Postfix) with ESMTP id 25071C0032 for ; Fri, 11 Aug 2023 12:25:19 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id E373441E55 for ; Fri, 11 Aug 2023 12:25:07 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org E373441E55 Authentication-Results: smtp4.osuosl.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=ReaSlUpL X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id R6b0y7rrGSW0 for ; Fri, 11 Aug 2023 12:25:06 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by smtp4.osuosl.org (Postfix) with ESMTPS id 5FB5E41E61 for ; Fri, 11 Aug 2023 12:25:06 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 5FB5E41E61 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1691756705; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Ao94QwqmDV+V/rjntUyR4ICqRyIuUOyWYb3vZI77Bo8=; b=ReaSlUpL4ZWI5OBRIJ6OXXGXWldcBCYXZ7cicfAFttlxnnfByxepy25FGKEQ1ANyx5JpMe xPkk+QTvITNc3MKD8NKOyr4DbibP6ai835j3KmAPEW6OhBTDZLPlkJhBSJG5vsc47hTGbo cHIaA53rsk8QGjKjugCKbae94KJo5Bc= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-396-06Tzc4kLP6GIQJz9U102gA-1; Fri, 11 Aug 2023 08:25:02 -0400 X-MC-Unique: 06Tzc4kLP6GIQJz9U102gA-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D83F383394C; Fri, 11 Aug 2023 12:25:01 +0000 (UTC) Received: from dceara.remote.csb (unknown [10.39.192.231]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3172A40D2839; Fri, 11 Aug 2023 12:25:01 +0000 (UTC) From: Dumitru Ceara To: ovs-dev@openvswitch.org Date: Fri, 11 Aug 2023 14:24:59 +0200 Message-Id: <169175669719.2569966.3097273058540951682.stgit@dceara.remote.csb> In-Reply-To: <169175667681.2569966.2197367072768243047.stgit@dceara.remote.csb> References: <169175667681.2569966.2197367072768243047.stgit@dceara.remote.csb> User-Agent: StGit/0.23 MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Cc: odivlad@gmail.com Subject: [ovs-dev] [PATCH ovn 2/2] ovn-controller: Assume well-known tables are in the SB schema. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" It's safe to assume that tables that existed in the previous LTS branch first release (currently 22.03.0) can be monitored directly. Do so and only "optionally" monitor the ones that have been added since. This way we avoid the need for the IDL to expose an API to change the default condition for monitored tables. It also avoids complex code in ovn-controller because we'd otherwise have to explicitly re-initialize conditions to a non-default (false) value after every SB reconnect. NOTE: In order to make sure that pre-existing L3 and L2 gateways are not initially considered "non-local" we explicitly request for all port bindings of this type to be monitored in the startup stage (before we got the initial contents of the database and our chassis record). Reported-at: https://mail.openvswitch.org/pipermail/ovs-dev/2023-July/406201.html Reported-by: Vladislav Odintsov CC: Ales Musil CC: Han Zhou Signed-off-by: Dumitru Ceara Acked-by: Han Zhou Acked-by: Ales Musil --- controller/ovn-controller.c | 40 ++++++++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/controller/ovn-controller.c b/controller/ovn-controller.c index 1bba7715d7..0c975dc5ec 100644 --- a/controller/ovn-controller.c +++ b/controller/ovn-controller.c @@ -190,11 +190,15 @@ static char *get_file_system_id(void) /* Only set monitor conditions on tables that are available in the * server schema. */ -#define sb_table_set_monitor_condition(idl, table, cond) \ - (sbrec_server_has_##table##_table(idl) \ - ? sbrec_##table##_set_condition(idl, cond) \ +#define sb_table_set_opt_mon_condition(idl, table, cond) \ + (sbrec_server_has_##table##_table(idl) \ + ? sbrec_##table##_set_condition(idl, cond) \ : 0) +/* Assume the table exists in the server schema and set its condition. */ +#define sb_table_set_req_mon_condition(idl, table, cond) \ + sbrec_##table##_set_condition(idl, cond) + static unsigned int update_sb_monitors(struct ovsdb_idl *ovnsb_idl, const struct sbrec_chassis *chassis, @@ -294,6 +298,14 @@ update_sb_monitors(struct ovsdb_idl *ovnsb_idl, /* During initialization, we monitor all records in Chassis_Private so * that we don't try to recreate existing ones. */ ovsdb_idl_condition_add_clause_true(&chprv); + /* Also, to avoid traffic disruption (e.g., conntrack flushing for + * zones that are used by OVN but not yet known due to the SB initial + * contents not being available), monitor all port bindings + * connected to gateways; they might be claimed as soon as the + * chassis is available. + */ + sbrec_port_binding_add_clause_type(&pb, OVSDB_F_EQ, "l2gateway"); + sbrec_port_binding_add_clause_type(&pb, OVSDB_F_EQ, "l3gateway"); } if (local_ifaces) { @@ -342,17 +354,17 @@ update_sb_monitors(struct ovsdb_idl *ovnsb_idl, out:; unsigned int cond_seqnos[] = { - sb_table_set_monitor_condition(ovnsb_idl, port_binding, &pb), - sb_table_set_monitor_condition(ovnsb_idl, logical_flow, &lf), - sb_table_set_monitor_condition(ovnsb_idl, logical_dp_group, &ldpg), - sb_table_set_monitor_condition(ovnsb_idl, mac_binding, &mb), - sb_table_set_monitor_condition(ovnsb_idl, multicast_group, &mg), - sb_table_set_monitor_condition(ovnsb_idl, dns, &dns), - sb_table_set_monitor_condition(ovnsb_idl, controller_event, &ce), - sb_table_set_monitor_condition(ovnsb_idl, ip_multicast, &ip_mcast), - sb_table_set_monitor_condition(ovnsb_idl, igmp_group, &igmp), - sb_table_set_monitor_condition(ovnsb_idl, chassis_private, &chprv), - sb_table_set_monitor_condition(ovnsb_idl, chassis_template_var, &tv), + sb_table_set_req_mon_condition(ovnsb_idl, port_binding, &pb), + sb_table_set_req_mon_condition(ovnsb_idl, logical_flow, &lf), + sb_table_set_req_mon_condition(ovnsb_idl, logical_dp_group, &ldpg), + sb_table_set_req_mon_condition(ovnsb_idl, mac_binding, &mb), + sb_table_set_req_mon_condition(ovnsb_idl, multicast_group, &mg), + sb_table_set_req_mon_condition(ovnsb_idl, dns, &dns), + sb_table_set_req_mon_condition(ovnsb_idl, controller_event, &ce), + sb_table_set_req_mon_condition(ovnsb_idl, ip_multicast, &ip_mcast), + sb_table_set_req_mon_condition(ovnsb_idl, igmp_group, &igmp), + sb_table_set_req_mon_condition(ovnsb_idl, chassis_private, &chprv), + sb_table_set_opt_mon_condition(ovnsb_idl, chassis_template_var, &tv), }; unsigned int expected_cond_seqno = 0;