From patchwork Tue Aug 20 01:36:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: aginwala aginwala X-Patchwork-Id: 1149703 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=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="kKfYsabE"; dkim-atps=neutral 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 46CD0S6776z9sDQ for ; Tue, 20 Aug 2019 11:36:23 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 39BF7C6E; Tue, 20 Aug 2019 01:36:20 +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 95725C6D for ; Tue, 20 Aug 2019 01:36:18 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-pf1-f196.google.com (mail-pf1-f196.google.com [209.85.210.196]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 9087067F for ; Tue, 20 Aug 2019 01:36:17 +0000 (UTC) Received: by mail-pf1-f196.google.com with SMTP id g2so2299659pfq.0 for ; Mon, 19 Aug 2019 18:36:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=d/p/JpCLqTWCL7Gi2Y5Xl2hAyBK37aAdEcSjFM0PiM8=; b=kKfYsabESU67F7sSzPavfyuTUrqWQ53mZEDDVbFLidv74G8i8czvzWl04nbFLKZCOf EoC1d7K/iQJ2fjKl3IwvD0EDuIn7xAcLyw4K7Ns0M/WxcV9wsejb2GkKcnkL6GNFRaYh 0R7eT1tax8c7VTLj1j3KjoGUTK5PoLpMoB3XA9z09Tivu9O86aXSzvazF4fSWFbNUH4i 72XoxhNXVopTVUgTCmoD+PMPdwNmZQP/Cb/zTdD7vkfFnCI7LAtLaUfcLhoH/Rc90cHf 0cliBT1UahirlpTUemakD8D2P7H1F6eDv+tdtHvI1Em37gD8oXxyMXrfG1OckMLvNQp9 qibQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=d/p/JpCLqTWCL7Gi2Y5Xl2hAyBK37aAdEcSjFM0PiM8=; b=I3WH/ZU/dAoK1FJ46Zjp6UOSO4UdKCS19l2nBMv2lfnoieQkNNr4k4oslx2Oo6WV3B htseKdbvQfYYXXmXjRTy91YNY8Yaz9NBADf1hLMORWzkmWPMlbOEMJghZ08mLy1u0FLf MRBVQGypCmqRB4PirFth7svcWMrUiATTj1v0Avc4sKZ6YikhA/GHmffBJC5/LDg5tMA4 BHOaRXWoUJ6pSKEXPvqkwWU1IxdaoWWKqeJsut6B+FY4uupQrxcYdTtoi4T9Vm0BJ6vU GHLvx/rG8H1USmzqdR+Zgz1HIxmpSj6Z2I9xgzUpBVdFq+XaTnasXF1AG1yhbY8k44ov OcrA== X-Gm-Message-State: APjAAAUnAXVslO8jW1dW3G6VpSbW4NUFXkV5V/DvN3fJ2VUGV3qKuvvh jmRlGtAl4SJw+XAQGncMNkNMJBzu X-Google-Smtp-Source: APXvYqwPobgUh/SM5KTf0piSaNReNCcZmbEWCNP5OaUnZr4wLV8nRxlPlmI8UZo1ZYqLiPwxq4gnZQ== X-Received: by 2002:a17:90b:8c5:: with SMTP id ds5mr24058606pjb.142.1566264976935; Mon, 19 Aug 2019 18:36:16 -0700 (PDT) Received: from LM-SJC-11015761.corp.ebay.com ([216.113.160.77]) by smtp.gmail.com with ESMTPSA id r61sm16820405pjb.7.2019.08.19.18.36.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 19 Aug 2019 18:36:16 -0700 (PDT) From: Aliasgar Ginwala X-Google-Original-From: Aliasgar Ginwala To: dev@openvswitch.org Date: Mon, 19 Aug 2019 18:36:13 -0700 Message-Id: <20190820013613.94682-1-aginwala@ebay.com> X-Mailer: git-send-email 2.20.1 (Apple Git-117) MIME-Version: 1.0 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: aginwala Subject: [ovs-dev] [PATCH v1] ovs-lib: Fix standalone db migration to raft 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 Current code of create-cluster from standalone db takes backup of existing standalone db and then generates a new clustered dbs from backup dbs. Hence, during migration if nb and sb dbs are still present, create-cluster will fail saying file exists and will not really convert dbs to clustered dbs. This patch fixes the same. e.g message that pops up while migration from standalone to raft cluster: * Backing up database to /etc/openvswitch/ovnnb_db.db.backup5.13.0-1278623084 ovsdb-tool: I/O error: /etc/openvswitch/ovnnb_db.db: create failed (File exists) * Creating cluster database /etc/openvswitch/ovnnb_db.db from existing one Signed-off-by: aginwala Acked-by: Han Zhou --- utilities/ovs-lib.in | 1 + 1 file changed, 1 insertion(+) diff --git a/utilities/ovs-lib.in b/utilities/ovs-lib.in index fa840ec63..76ce79b9c 100644 --- a/utilities/ovs-lib.in +++ b/utilities/ovs-lib.in @@ -485,6 +485,7 @@ create_cluster () { elif ovsdb_tool db-is-standalone "$DB_FILE"; then # Convert standalone database to clustered. backup_db || return 1 + rm -f "$DB_FILE" action "Creating cluster database $DB_FILE from existing one" \ ovsdb_tool create-cluster "$DB_FILE" "$backup" "$LOCAL_ADDR" fi