From patchwork Wed Jun 12 10:37:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dumitru Ceara X-Patchwork-Id: 1114458 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45P3LG1cBlz9s7h for ; Wed, 12 Jun 2019 20:40:37 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 29B7119AE; Wed, 12 Jun 2019 10:40:34 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 8185A199F for ; Wed, 12 Jun 2019 10:38:34 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 355B6E6 for ; Wed, 12 Jun 2019 10:38:34 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A0A1681F18 for ; Wed, 12 Jun 2019 10:38:33 +0000 (UTC) Received: from dceara.remote.csb (ovpn-117-241.ams2.redhat.com [10.36.117.241]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0CFA11001B10 for ; Wed, 12 Jun 2019 10:38:31 +0000 (UTC) From: Dumitru Ceara To: dev@openvswitch.org Date: Wed, 12 Jun 2019 12:37:57 +0200 Message-Id: <20190612103757.18479.70964.stgit@dceara.remote.csb> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Wed, 12 Jun 2019 10:38:33 +0000 (UTC) X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [PATCH 0/3] ovn-controller: Fix and refactor chassis ovn-sbdb record init X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org The chassis_run code didn't take into account the scenario when the system-id was changed in the Open_vSwitch table. Due to this the code was trying to insert a new Chassis record in the OVN_Southbound DB with the same Encaps as the previous Chassis record. The transaction used to insert the new records was aborting due to the ["type", "ip"] index constraint violation as we were creating new Encap entries with the same "type" and "ip" as the old ones. This series: 1. introduces a (partial) fix for the reported issue by storing in ovn-controller memory the last successfully configured chassis-id. 2. refactors the code in chassis.c to abstract out the string processing and make available the ovs configuration to the code. that looks up stale chassis entries in the OVN_Southbound DB 3. completes the fix at point 1 above by taking care of the scenario when ovn-controller restarts after stopping forcefully (e.g., due to a crash) and the OVS system-id has changed in the meantime. Dumitru Ceara (3): ovn-controller: Fix chassis ovn-sbdb record init ovn-controller: Refactor chassis.c to abstract the string parsing ovn-controller: Update stale chassis entry at init ovn/controller/chassis.c | 659 +++++++++++++++++++++++++++------------ ovn/controller/chassis.h | 2 ovn/controller/ovn-controller.c | 26 +- tests/ovn-controller.at | 9 + 4 files changed, 489 insertions(+), 207 deletions(-)