diff options
author | Gurucharan Shetty <gshetty@nicira.com> | 2013-01-11 13:40:23 -0800 |
---|---|---|
committer | Gurucharan Shetty <gshetty@nicira.com> | 2013-01-16 13:39:38 -0800 |
commit | 167744623897a67ef3fd13bcaf44a84d3641fe68 (patch) | |
tree | 236dbcb7a01736cbb1e9c52a22360bb381247c7d /utilities | |
parent | 1eccfa36c1ab36e2120a527ca95ca7ef4bce39fc (diff) | |
download | openvswitch-167744623897a67ef3fd13bcaf44a84d3641fe68.tar.gz |
ovs-ctl.in: Restore ofport values across force-reload-kmod.
If we want to upgrade from pre-1.10 branch to 1.10 or later
and restore flows across force-reload-kmod, we need to maintain
the value of ofport.
To do this, we fetch the value of ofport before the upgrade and use
it to populate the column 'ofport_request' after ovsdb is upgraded.
We need to do this before vswitchd is restarted as vswitchd
needs the ofport_request column populated before it starts.
Issue #13556
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Diffstat (limited to 'utilities')
-rwxr-xr-x | utilities/ovs-ctl.in | 47 |
1 files changed, 35 insertions, 12 deletions
diff --git a/utilities/ovs-ctl.in b/utilities/ovs-ctl.in index bce74a693..78f67a3e7 100755 --- a/utilities/ovs-ctl.in +++ b/utilities/ovs-ctl.in @@ -267,16 +267,27 @@ internal_interfaces () { done } -save_flows () { - if set X `ovs_vsctl -- --real list-br`; then - shift - if "$datadir/scripts/ovs-save" save-flows "$@" > "$script_flows"; then - chmod +x "$script_flows" - return 0 - fi +ovs_save () { + bridges=`ovs_vsctl -- --real list-br` + if [ -n "${bridges}" ] && \ + "$datadir/scripts/ovs-save" "$1" ${bridges} > "$2"; then + chmod +x "$2" + return 0 fi - script_flows= - return 1 + eval $3="" + [ -z "${bridges}" ] && return 0 +} + +save_ofports_if_required () { + # Save ofports if we are upgrading from a pre-1.10 branch. + case `ovs-appctl version | sed 1q` in + "ovs-vswitchd (Open vSwitch) 1."[0-9].*) + action "Saving ofport values" ovs_save save-ofports \ + "${script_ofports}" script_ofports + ;; + *) + ;; + esac } save_interfaces () { @@ -284,6 +295,11 @@ save_interfaces () { > "${script_interfaces}" } +restore_ofports () { + [ -n "${script_ofports}" ] && \ + action "Restoring ofport values" "${script_ofports}" +} + restore_flows () { [ -n "${script_flows}" ] && \ action "Restoring saved flows" "${script_flows}" @@ -295,15 +311,21 @@ force_reload_kmod () { script_interfaces=`mktemp` script_flows=`mktemp` - trap 'rm -f "${script_interfaces}" "${script_flows}" ' 0 + script_ofports=`mktemp` + trap 'rm -f "${script_interfaces}" "${script_flows}" "${script_ofports}"' 0 - action "Saving flows" save_flows + action "Saving flows" ovs_save save-flows "${script_flows}" script_flows + + 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 @@ -353,7 +375,8 @@ restart () { script_flows=`mktemp` trap 'rm -f "${script_flows}"' 0 - action "Saving flows" save_flows + action "Saving flows" ovs_save save-flows "${script_flows}" \ + script_flows fi # Restart the database first, since a large database may take a |