From patchwork Sat Jul 7 11:09:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Sitnicki X-Patchwork-Id: 940814 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 41N8Kj5F88z9s0n for ; Sat, 7 Jul 2018 21:20:57 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id F313ECFF; Sat, 7 Jul 2018 11:10:39 +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 43F2DD07 for ; Sat, 7 Jul 2018 11:10:39 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-wm0-f66.google.com (mail-wm0-f66.google.com [74.125.82.66]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id C199E76A for ; Sat, 7 Jul 2018 11:10:38 +0000 (UTC) Received: by mail-wm0-f66.google.com with SMTP id s12-v6so17005377wmc.1 for ; Sat, 07 Jul 2018 04:10:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=iZJdTF74wcO4/eg2ol1WnFHNTAzDWLauhCOZM0Ac4+I=; b=ZHavl/rcgCt0afR2HCBAmO8Xh+Fx4XWRikblBbJCCwj+JttpRR9bqfcEANFI6yWNr9 cRirOdsQv4fDJHRLL9u4k/JWos1A6Srpn6751t01b0egNg4y4TVTI8UayWdP1k7L13bF MwSvoNQguinXkWIEKdeY+DQHDfKtndS2kayJje9t8b41lXyyzSEsZNMEygWlTAxqRDR4 TW225bgAC406C0zrfvHSxbeB7kJZqoj0Xz91JR70+8qBuWh8HZrgJH3KZgnM1ZjLtunD +PHT3DbzM7KrVKVdi8xHEOhM/FlFU/yu8tXWjPnJtqVuJLFbLKqCwYbXXTIiRH6R0bzj zl+w== X-Gm-Message-State: APt69E2TTexb4vKS0czgEADqNfyv3GVgJ1Ku8U+DIb2T/59mPhwTvrmu PSB82ZPmYQMygNwwjIaclVUDZWfjBLA= X-Google-Smtp-Source: AAOMgpfEwNMNGjkTYz67Y9Qfkd3MmsFah8YuxbIISHrbvEWssUmBX7eSQ+vhFYmda3DCKY/6Mmr9HQ== X-Received: by 2002:a7b:c0d5:: with SMTP id s21-v6mr7944178wmh.106.1530961837242; Sat, 07 Jul 2018 04:10:37 -0700 (PDT) Received: from redhat.com (218.red-2-136-166.dynamicip.rima-tde.net. [2.136.166.218]) by smtp.gmail.com with ESMTPSA id p8-v6sm10177762wre.84.2018.07.07.04.10.36 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 07 Jul 2018 04:10:36 -0700 (PDT) From: Jakub Sitnicki To: dev@openvswitch.org Date: Sat, 7 Jul 2018 13:09:55 +0200 Message-Id: <20180707111004.8320-22-jkbs@redhat.com> X-Mailer: git-send-email 2.14.4 In-Reply-To: <20180707111004.8320-1-jkbs@redhat.com> References: <20180707111004.8320-1-jkbs@redhat.com> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, 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 Subject: [ovs-dev] [PATCH 21/30] ovn-nbctl: Don't die in nbctl_lr_add(). 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: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org Propagate the error via the context instead. Signed-off-by: Jakub Sitnicki --- ovn/utilities/ovn-nbctl.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/ovn/utilities/ovn-nbctl.c b/ovn/utilities/ovn-nbctl.c index 989633120..f97bfbb3e 100644 --- a/ovn/utilities/ovn-nbctl.c +++ b/ovn/utilities/ovn-nbctl.c @@ -2566,7 +2566,9 @@ nbctl_lr_add(struct ctl_context *ctx) bool may_exist = shash_find(&ctx->options, "--may-exist") != NULL; bool add_duplicate = shash_find(&ctx->options, "--add-duplicate") != NULL; if (may_exist && add_duplicate) { - ctl_fatal("--may-exist and --add-duplicate may not be used together"); + ctl_error(ctx, "--may-exist and --add-duplicate may not be used " + "together"); + return; } if (lr_name) { @@ -2577,15 +2579,18 @@ nbctl_lr_add(struct ctl_context *ctx) if (may_exist) { return; } - ctl_fatal("%s: a router with this name already exists", - lr_name); + ctl_error(ctx, "%s: a router with this name already " + "exists", lr_name); + return; } } } } else if (may_exist) { - ctl_fatal("--may-exist requires specifying a name"); + ctl_error(ctx, "--may-exist requires specifying a name"); + return; } else if (add_duplicate) { - ctl_fatal("--add-duplicate requires specifying a name"); + ctl_error(ctx, "--add-duplicate requires specifying a name"); + return; } struct nbrec_logical_router *lr;