From patchwork Mon Sep 12 09:07:57 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markos Chandras X-Patchwork-Id: 668670 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from archives.nicira.com (archives.nicira.com [96.126.127.54]) by ozlabs.org (Postfix) with ESMTP id 3sXhnR45H2z9sC4 for ; Mon, 12 Sep 2016 19:08:59 +1000 (AEST) Received: from archives.nicira.com (localhost [127.0.0.1]) by archives.nicira.com (Postfix) with ESMTP id CB9C310312; Mon, 12 Sep 2016 02:08:58 -0700 (PDT) X-Original-To: dev@openvswitch.org Delivered-To: dev@openvswitch.org Received: from mx3v3.cudamail.com (mx3.cudamail.com [64.34.241.5]) by archives.nicira.com (Postfix) with ESMTPS id 11867102BD for ; Mon, 12 Sep 2016 02:08:58 -0700 (PDT) Received: from bar6.cudamail.com (localhost [127.0.0.1]) by mx3v3.cudamail.com (Postfix) with ESMTPS id 92D91162664 for ; Mon, 12 Sep 2016 03:08:57 -0600 (MDT) X-ASG-Debug-ID: 1473671336-0b32373e00309d0001-byXFYA Received: from mx3-pf1.cudamail.com ([192.168.14.2]) by bar6.cudamail.com with ESMTP id kKwke1rxNTHSJ5IH (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Mon, 12 Sep 2016 03:08:56 -0600 (MDT) X-Barracuda-Envelope-From: mchandras@suse.de X-Barracuda-RBL-Trusted-Forwarder: 192.168.14.2 Received: from unknown (HELO mx2.suse.de) (195.135.220.15) by mx3-pf1.cudamail.com with ESMTPS (DHE-RSA-AES256-SHA encrypted); 12 Sep 2016 09:08:56 -0000 Received-SPF: pass (mx3-pf1.cudamail.com: SPF record at suse.de designates 195.135.220.15 as permitted sender) X-Barracuda-Apparent-Source-IP: 195.135.220.15 X-Barracuda-RBL-IP: 195.135.220.15 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 7B438ABDB; Mon, 12 Sep 2016 09:08:54 +0000 (UTC) X-CudaMail-Envelope-Sender: mchandras@suse.de From: Markos Chandras To: dev@openvswitch.org X-CudaMail-MID: CM-V1-911002001 X-CudaMail-DTE: 091216 X-CudaMail-Originating-IP: 195.135.220.15 Date: Mon, 12 Sep 2016 10:07:57 +0100 X-ASG-Orig-Subj: [##CM-V1-911002001##][PATCH v2 2/2] utilities: ovs-ctl: Handle start up errors Message-Id: <20160912090757.23511-2-mchandras@suse.de> X-Mailer: git-send-email 2.10.0 In-Reply-To: <20160912090757.23511-1-mchandras@suse.de> References: <44cd44d7-6c73-21b8-2ed8-ca8c84405561@suse.de> <20160912090757.23511-1-mchandras@suse.de> X-GBUdb-Analysis: 0, 195.135.220.15, Ugly c=0 p=0 Source New X-MessageSniffer-Rules: 0-0-0-5960-c X-Barracuda-Connect: UNKNOWN[192.168.14.2] X-Barracuda-Start-Time: 1473671336 X-Barracuda-Encrypted: DHE-RSA-AES256-SHA X-Barracuda-URL: https://web.cudamail.com:443/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at cudamail.com X-Barracuda-BRTS-Status: 1 X-Barracuda-Spam-Score: 0.60 X-Barracuda-Spam-Status: No, SCORE=0.60 using global scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=4.0 tests=BSF_SC5_MJ1963, RDNS_NONE X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.32828 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.10 RDNS_NONE Delivered to trusted network by a host with no rDNS 0.50 BSF_SC5_MJ1963 Custom Rule MJ1963 Subject: [ovs-dev] [PATCH v2 2/2] utilities: ovs-ctl: Handle start up errors X-BeenThere: dev@openvswitch.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dev-bounces@openvswitch.org Sender: "dev" Make sure we take the return values into consideration so we can break early in case of failures. This makes the ovs-ctl helper more accurate in reporting the real status of its managing processes. Cc: Aaron Conole Signed-off-by: Markos Chandras Acked-by: Aaron Conole --- utilities/ovs-ctl.in | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/utilities/ovs-ctl.in b/utilities/ovs-ctl.in index dc275f8..ce3fb58 100755 --- a/utilities/ovs-ctl.in +++ b/utilities/ovs-ctl.in @@ -190,8 +190,9 @@ do_start_ovsdb () { start_ovsdb() { if test X"$OVSDB_SERVER" = Xyes; then - do_start_ovsdb + do_start_ovsdb || return 1 fi + return 0 } add_managers () { @@ -238,14 +239,16 @@ do_start_forwarding () { if test X"$SELF_CONFINEMENT" = Xno; then set "$@" --no-self-confinement fi - start_daemon "$OVS_VSWITCHD_PRIORITY" "$OVS_VSWITCHD_WRAPPER" "$@" + start_daemon "$OVS_VSWITCHD_PRIORITY" "$OVS_VSWITCHD_WRAPPER" "$@" || + return 1 fi } start_forwarding () { if test X"$OVS_VSWITCHD" = Xyes; then - do_start_forwarding + do_start_forwarding || return 1 fi + return 0 } ## ---- ## @@ -364,7 +367,7 @@ force_reload_kmod () { # Restart the database first, since a large database may take a # while to load, and we want to minimize forwarding disruption. stop_ovsdb - start_ovsdb + start_ovsdb || return 1 stop_forwarding @@ -395,7 +398,7 @@ force_reload_kmod () { # Start vswitchd by asking it to wait till flow restore is finished. flow_restore_wait - start_forwarding + start_forwarding || return 1 # Restore saved flows and inform vswitchd that we are done. restore_flows @@ -422,13 +425,13 @@ restart () { # Restart the database first, since a large database may take a # while to load, and we want to minimize forwarding disruption. stop_ovsdb - start_ovsdb + start_ovsdb || return 1 stop_forwarding # Start vswitchd by asking it to wait till flow restore is finished. flow_restore_wait - start_forwarding + start_forwarding || return 1 # Restore saved flows and inform vswitchd that we are done. restore_flows @@ -686,7 +689,7 @@ done case $command in start) start_ovsdb || exit 1 - start_forwarding + start_forwarding || exit 1 add_managers ;; stop)