From patchwork Fri Dec 22 15:00:52 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Timothy Redaelli X-Patchwork-Id: 852404 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=) 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 3z3BrS5LKZz9s0g for ; Sat, 23 Dec 2017 02:14:48 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 5A83AC48; Fri, 22 Dec 2017 15:13:24 +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 11777C77 for ; Fri, 22 Dec 2017 15:13:23 +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 BB8CE496 for ; Fri, 22 Dec 2017 15:13:22 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4FC242D0FBD for ; Fri, 22 Dec 2017 15:13:22 +0000 (UTC) Received: from graphite.redhat.com (ovpn-204-59.brq.redhat.com [10.40.204.59]) by smtp.corp.redhat.com (Postfix) with ESMTP id AEE634C480 for ; Fri, 22 Dec 2017 15:13:21 +0000 (UTC) From: Timothy Redaelli To: dev@openvswitch.org Date: Fri, 22 Dec 2017 16:00:52 +0100 Message-Id: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Fri, 22 Dec 2017 15:13:22 +0000 (UTC) X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD 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 2/3] rhel: use the functions in ovs-lib.in in ovs-systemd-reload 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 To avoid code duplication use the functions from ovs-lib.in Signed-off-by: Timothy Redaelli Tested-by: Greg Rose Reviewed-by: Greg Rose --- ...sr_share_openvswitch_scripts_ovs-systemd-reload | 37 ++++++++++++++-------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/rhel/usr_share_openvswitch_scripts_ovs-systemd-reload b/rhel/usr_share_openvswitch_scripts_ovs-systemd-reload index 3ac1a46c6..5d2efc621 100755 --- a/rhel/usr_share_openvswitch_scripts_ovs-systemd-reload +++ b/rhel/usr_share_openvswitch_scripts_ovs-systemd-reload @@ -14,23 +14,32 @@ # See the License for the specific language governing permissions and # limitations under the License. -# Save flows -bridges=$(ovs-vsctl -- --real list-br) -flows=$(/usr/share/openvswitch/scripts/ovs-save save-flows $bridges) +case $0 in + */*) dir0=`echo "$0" | sed 's,/[^/]*$,,'` ;; + *) dir0=./ ;; +esac +. "$dir0/ovs-lib" || exit 1 -# Restart the database first, since a large database may take a -# while to load, and we want to minimize forwarding disruption. -systemctl --job-mode=ignore-dependencies restart ovsdb-server +stop_ovsdb() { + systemctl --job-mode=ignore-dependencies stop ovsdb-server +} -# Stop ovs-vswitchd. -systemctl --job-mode=ignore-dependencies stop ovs-vswitchd +start_ovsdb() { + systemctl --job-mode=ignore-dependencies start ovsdb-server +} -# Start vswitchd by asking it to wait till flow restore is finished. -ovs-vsctl --no-wait set open_vswitch . other_config:flow-restore-wait=true -systemctl --job-mode=ignore-dependencies start ovs-vswitchd +stop_forwarding() { + systemctl --job-mode=ignore-dependencies stop ovs-vswitchd +} -# Restore saved flows and inform vswitchd that we are done. -eval "$flows" -ovs-vsctl --if-exists remove open_vswitch . other_config flow-restore-wait=true +start_forwarding() { + systemctl --job-mode=ignore-dependencies start ovs-vswitchd +} + +add_managers() { + : +} + +restart exit 0