From patchwork Wed Sep 15 14:22:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dumitru Ceara X-Patchwork-Id: 1528391 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: 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=VNJlzJxw; dkim-atps=neutral Authentication-Results: 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=) 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 RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4H8j931dksz9sR4 for ; Thu, 16 Sep 2021 00:22:31 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 11B0D404AE; Wed, 15 Sep 2021 14:22:28 +0000 (UTC) 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 exivI5XY_C4E; Wed, 15 Sep 2021 14:22:25 +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 983DB40181; Wed, 15 Sep 2021 14:22:24 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 78B40C0011; Wed, 15 Sep 2021 14:22:24 +0000 (UTC) X-Original-To: ovs-dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by lists.linuxfoundation.org (Postfix) with ESMTP id BF224C000D for ; Wed, 15 Sep 2021 14:22:22 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id A6568404AE for ; Wed, 15 Sep 2021 14:22:22 +0000 (UTC) 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 LZssJdC8n64Y for ; Wed, 15 Sep 2021 14:22:21 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by smtp2.osuosl.org (Postfix) with ESMTPS id AD16340181 for ; Wed, 15 Sep 2021 14:22:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1631715740; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=6o+MJyF1y8xXBS4nvfPJG4Dar014pN7uc2GGzzBtLPU=; b=VNJlzJxwrT3EY55ulL+Jold9nvQzDk1ZEg87KTzEqGmkUk3ngKxgA0uJ7ROlqDC4nBx9Ei vse8oroKo+TfGT7M/RqycJR30kzD78vMSqxirZfdaRG7mBBYyCWqGO6YWwK53zKvCouAam UE79gGd1tyCqiacqVWSklZRMtbXVqFE= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-148-NdL22kqHMkuWIXnLfsMFRA-1; Wed, 15 Sep 2021 10:22:18 -0400 X-MC-Unique: NdL22kqHMkuWIXnLfsMFRA-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id EA68D1006AA0 for ; Wed, 15 Sep 2021 14:22:17 +0000 (UTC) Received: from dceara.remote.csb (unknown [10.39.194.131]) by smtp.corp.redhat.com (Postfix) with ESMTP id 409FC60C7F for ; Wed, 15 Sep 2021 14:22:17 +0000 (UTC) From: Dumitru Ceara To: ovs-dev@openvswitch.org Date: Wed, 15 Sep 2021 16:22:13 +0200 Message-Id: <20210915142213.25413-1-dceara@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dceara@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH ovn] binding: Store timestamp at which ovn-installed was set. 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" CMSs (e.g., ovn-kubernetes) already use the ovn-installed external_id set by ovn-controller in OVS.Interface.external_ids to determine that the networking for a VIF is completely plugged. ovn-controller now also stores the timestamp (in milliseconds since the epoch) at which an interface was marked as "installed", as the ovn-installed-ts external id in the OVS DB. This commit also adds the relevant documentation for ovn-installed/ovn-installed-ts. Signed-off-by: Dumitru Ceara --- controller/binding.c | 7 ++++++- controller/binding.h | 3 ++- controller/if-status.c | 6 +++++- controller/ovn-controller.8.xml | 15 +++++++++++++++ 4 files changed, 28 insertions(+), 3 deletions(-) diff --git a/controller/binding.c b/controller/binding.c index 34935bb9c..c037b2352 100644 --- a/controller/binding.c +++ b/controller/binding.c @@ -44,6 +44,7 @@ VLOG_DEFINE_THIS_MODULE(binding); * flows have been installed. */ #define OVN_INSTALLED_EXT_ID "ovn-installed" +#define OVN_INSTALLED_TS_EXT_ID "ovn-installed-ts" #define OVN_QOS_TYPE "linux-htb" @@ -712,7 +713,8 @@ local_binding_is_down(struct shash *local_bindings, const char *pb_name) void local_binding_set_up(struct shash *local_bindings, const char *pb_name, - bool sb_readonly, bool ovs_readonly) + const char *ts_now_str, bool sb_readonly, + bool ovs_readonly) { struct local_binding *lbinding = local_binding_find(local_bindings, pb_name); @@ -725,6 +727,9 @@ local_binding_set_up(struct shash *local_bindings, const char *pb_name, ovsrec_interface_update_external_ids_setkey(lbinding->iface, OVN_INSTALLED_EXT_ID, "true"); + ovsrec_interface_update_external_ids_setkey(lbinding->iface, + OVN_INSTALLED_TS_EXT_ID, + ts_now_str); } if (!sb_readonly && lbinding && b_lport && b_lport->pb->n_up diff --git a/controller/binding.h b/controller/binding.h index f1abc4b9c..70cc37c78 100644 --- a/controller/binding.h +++ b/controller/binding.h @@ -120,7 +120,8 @@ ofp_port_t local_binding_get_lport_ofport(const struct shash *local_bindings, bool local_binding_is_up(struct shash *local_bindings, const char *pb_name); bool local_binding_is_down(struct shash *local_bindings, const char *pb_name); void local_binding_set_up(struct shash *local_bindings, const char *pb_name, - bool sb_readonly, bool ovs_readonly); + const char *ts_now_str, bool sb_readonly, + bool ovs_readonly); void local_binding_set_down(struct shash *local_bindings, const char *pb_name, bool sb_readonly, bool ovs_readonly); diff --git a/controller/if-status.c b/controller/if-status.c index 08fb50b87..b5a4025fc 100644 --- a/controller/if-status.c +++ b/controller/if-status.c @@ -21,6 +21,7 @@ #include "lib/hmapx.h" #include "lib/util.h" +#include "timeval.h" #include "openvswitch/vlog.h" VLOG_DEFINE_THIS_MODULE(if_status); @@ -398,11 +399,14 @@ if_status_mgr_update_bindings(struct if_status_mgr *mgr, * their flows installed but are not yet marked "up" in the binding * module. */ + char *ts_now_str = xasprintf("%lld", time_wall_msec()); HMAPX_FOR_EACH (node, &mgr->ifaces_per_state[OIF_MARK_UP]) { struct ovs_iface *iface = node->data; - local_binding_set_up(bindings, iface->id, sb_readonly, ovs_readonly); + local_binding_set_up(bindings, iface->id, ts_now_str, + sb_readonly, ovs_readonly); } + free(ts_now_str); /* Notify the binding module to set "down" all bindings that have been * released but are not yet marked as "down" in the binding module. diff --git a/controller/ovn-controller.8.xml b/controller/ovn-controller.8.xml index 5a649ee65..8c180f576 100644 --- a/controller/ovn-controller.8.xml +++ b/controller/ovn-controller.8.xml @@ -471,6 +471,21 @@ flows have been successfully installed in OVS.

+ +
+ external_ids:ovn-installed and + external_ids:ovn-installed-ts in the + Interface table +
+ +
+

+ This key is set after all openflow operations corresponding to the + OVS interface have been processed by ovs-vswitchd. At the same time + a timestamp, in milliseconds since the epoch, is stored in + external_ids:ovn-installed-ts. +

+

OVN Southbound Database Usage