From patchwork Thu Apr 30 08:10:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Numan Siddique X-Patchwork-Id: 1280041 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.137; helo=fraxinus.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ovn.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49CSkJ23Zwz9sSg for ; Thu, 30 Apr 2020 18:10:47 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 2D11D86CF1; Thu, 30 Apr 2020 08:10:45 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id w7DLpaY3lwqb; Thu, 30 Apr 2020 08:10:41 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by fraxinus.osuosl.org (Postfix) with ESMTP id 8753685188; Thu, 30 Apr 2020 08:10:41 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 69B56C0864; Thu, 30 Apr 2020 08:10:41 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by lists.linuxfoundation.org (Postfix) with ESMTP id B4F96C016F for ; Thu, 30 Apr 2020 08:10:39 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id A850D235AE for ; Thu, 30 Apr 2020 08:10:39 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id GCuOxcNeGJsf for ; Thu, 30 Apr 2020 08:10:38 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay10.mail.gandi.net (relay10.mail.gandi.net [217.70.178.230]) by silver.osuosl.org (Postfix) with ESMTPS id 4B093234AC for ; Thu, 30 Apr 2020 08:10:38 +0000 (UTC) Received: from nummac.local (unknown [27.7.27.181]) (Authenticated sender: numans@ovn.org) by relay10.mail.gandi.net (Postfix) with ESMTPSA id 30219240006; Thu, 30 Apr 2020 08:10:33 +0000 (UTC) From: numans@ovn.org To: dev@openvswitch.org Date: Thu, 30 Apr 2020 13:40:00 +0530 Message-Id: <20200430081000.751498-1-numans@ovn.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [ovs-dev] [PATCH ovn] ovn-controller: Configure hwaddr for the integration bridge 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" From: Numan Siddique When a first non-local port is added to the integration bridge, it results in the recalculation of datapath-id by ovs-vswitchd forcing all active connections to the controllers to reconnect. This patch avoids these reconnections between ovs-vswitchd and ovn-controller by setting the hwaddr for the integration bridge when ovn-controller creates the integration bridge. ovs-vswitchd uses the bridge:hwaddr if set to generate the datapath-id. Signed-off-by: Numan Siddique --- controller/ovn-controller.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/controller/ovn-controller.c b/controller/ovn-controller.c index 6ff897325..299e1e544 100644 --- a/controller/ovn-controller.c +++ b/controller/ovn-controller.c @@ -277,10 +277,21 @@ create_br_int(struct ovsdb_idl_txn *ovs_idl_txn, bridge = ovsrec_bridge_insert(ovs_idl_txn); ovsrec_bridge_set_name(bridge, bridge_name); ovsrec_bridge_set_fail_mode(bridge, "secure"); - const struct smap oc = SMAP_CONST1(&oc, "disable-in-band", "true"); - ovsrec_bridge_set_other_config(bridge, &oc); ovsrec_bridge_set_ports(bridge, &port, 1); + struct smap oc = SMAP_INITIALIZER(&oc); + smap_add(&oc, "disable-in-band", "true"); + + struct eth_addr br_hwaddr; + eth_addr_random(&br_hwaddr); + char ea_s[ETH_ADDR_STRLEN + 1]; + snprintf(ea_s, sizeof ea_s, ETH_ADDR_FMT, + ETH_ADDR_ARGS(br_hwaddr)); + smap_add(&oc, "hwaddr", ea_s); + + ovsrec_bridge_set_other_config(bridge, &oc); + smap_destroy(&oc); + struct ovsrec_bridge **bridges; size_t bytes = sizeof *bridges * cfg->n_bridges; bridges = xmalloc(bytes + sizeof *bridges);