From c416eaf8c247225f0ebeb22b6ca5c473e96a53d2 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Wed, 16 Mar 2016 20:10:40 -0700 Subject: [PATCH] ovs-ctl: Remove code for upgrading from Open vSwitch 1.9 and earlier. OVS 1.10 was released in May 2013, so by the time current OVS is released, it will be about three years old. I think that this is long enough to remove special upgrade code from the startup scripts. Signed-off-by: Ben Pfaff Acked-by: Jesse Gross --- utilities/ovs-ctl.in | 46 ++------------------------------------------ utilities/ovs-save | 36 +--------------------------------- 2 files changed, 3 insertions(+), 79 deletions(-) diff --git a/utilities/ovs-ctl.in b/utilities/ovs-ctl.in index 0082bedf1..bc0848ca4 100755 --- a/utilities/ovs-ctl.in +++ b/utilities/ovs-ctl.in @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2009, 2010, 2011, 2012, 2013, 2014 Nicira, Inc. +# Copyright (C) 2009, 2010, 2011, 2012, 2013, 2014, 2016 Nicira, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -271,19 +271,6 @@ ovs_save () { [ -z "${bridges}" ] && return 0 } -save_ofports_if_required () { - # Save OpenFlow port numbers if we are upgrading from a pre-1.10 branch. - # - # (Versions 1.10 and later save OpenFlow port numbers without assistance, - # so we don't have to do anything for them. - case `ovs-appctl version | sed 1q` in - "ovs-vswitchd (Open vSwitch) 1."[0-9].*) - action "Saving ofport values" ovs_save save-ofports \ - "${script_ofports}" - ;; - esac -} - save_flows_if_required () { if test X"$DELETE_BRIDGES" != Xyes; then action "Saving flows" ovs_save save-flows "${script_flows}" @@ -295,11 +282,6 @@ save_interfaces () { > "${script_interfaces}" } -restore_ofports () { - [ -x "${script_ofports}" ] && \ - action "Restoring ofport values" "${script_ofports}" -} - flow_restore_wait () { ovs_vsctl set open_vswitch . other_config:flow-restore-wait="true" } @@ -331,8 +313,7 @@ restore_interfaces () { init_restore_scripts () { script_interfaces=`mktemp` script_flows=`mktemp` - script_ofports=`mktemp` - trap 'rm -f "${script_interfaces}" "${script_flows}" "${script_ofports}"' 0 + trap 'rm -f "${script_interfaces}" "${script_flows}"' 0 } force_reload_kmod () { @@ -341,16 +322,12 @@ force_reload_kmod () { init_restore_scripts save_flows_if_required - save_ofports_if_required # 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 - # Restore of ofports should happen before vswitchd is restarted. - restore_ofports - stop_forwarding if action "Saving interface configuration" save_interfaces; then @@ -399,25 +376,10 @@ force_reload_kmod () { ## restart ## ## ------- ## -save_interfaces_if_required () { - # Save interfaces if we are upgrading from a pre-1.10 branch. - case `ovs-appctl version | sed 1q` in - "ovs-vswitchd (Open vSwitch) 1."[0-9].*) - ifaces=`internal_interfaces` - action "Detected internal interfaces: $ifaces" true - if action "Saving interface configuration" save_interfaces; then - chmod +x "$script_interfaces" - fi - ;; - esac -} - restart () { if daemon_is_running ovsdb-server && daemon_is_running ovs-vswitchd; then init_restore_scripts - save_interfaces_if_required save_flows_if_required - save_ofports_if_required fi # Restart the database first, since a large database may take a @@ -425,10 +387,6 @@ restart () { stop_ovsdb start_ovsdb - # Restore of ofports, if required, should happen before vswitchd is - # restarted. - restore_ofports - stop_forwarding # Start vswitchd by asking it to wait till flow restore is finished. diff --git a/utilities/ovs-save b/utilities/ovs-save index bcaf27cf6..90320b1dc 100755 --- a/utilities/ovs-save +++ b/utilities/ovs-save @@ -1,6 +1,6 @@ #! /bin/sh -# Copyright (c) 2011, 2013 Nicira, Inc. +# Copyright (c) 2011, 2013, 2016 Nicira, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -33,8 +33,6 @@ Commands: configuration. save-flows Outputs a shell script on stdout that will restore OpenFlow flows of each Open vSwitch bridge. - save-ofports Outputs a shell script on stdout that will restore - the ofport value across a force-reload-kmod. This script is meant as a helper for the Open vSwitch init script commands. EOF } @@ -115,33 +113,6 @@ save_flows () { done } -ovs_vsctl () { - ovs-vsctl --no-wait "$@" -} - -save_ofports () -{ - if (ovs-vsctl --version) > /dev/null 2>&1; then :; else - echo "$0: ovs-vsctl not found in $PATH" >&2 - exit 1 - fi - - for bridge in "$@"; do - count=0 - for iface in `ovs_vsctl list-ifaces ${bridge}`; do - ofport=`ovs_vsctl get interface ${iface} ofport` - [ "${count}" -eq 0 ] && cmd="ovs-vsctl --no-wait" - cmd="${cmd} -- --if-exists set interface "${iface}" \ - ofport_request="${ofport}"" - - # Run set interface command on 50 ports at a time. - count=`expr ${count} + 1` - [ "${count}" -eq 50 ] && count=0 && echo "${cmd}" && cmd="" - done - echo "${cmd}" - done -} - while [ $# -ne 0 ] do case $1 in @@ -155,11 +126,6 @@ do save_interfaces "$@" exit 0 ;; - "save-ofports") - shift - save_ofports "$@" - exit 0 - ;; -h | --help) usage exit 0 -- 2.20.1