aboutsummaryrefslogtreecommitdiff
path: root/utilities
diff options
context:
space:
mode:
authorGurucharan Shetty <gshetty@nicira.com>2013-02-28 14:46:43 -0800
committerGurucharan Shetty <gshetty@nicira.com>2013-03-05 09:47:39 -0800
commitd270011c636ffcc4bdaca9bb1481f55a28694468 (patch)
treeca94ade5646861c83c473f6dd3c974ad57b73c0e /utilities
parent1173325b42912cae635e82ae6f2c26aaa23848d7 (diff)
ovs-ctl.in: Restore interfaces and ofports for userspace restarts.
When we upgrade from pre-1.9 to 1.10 or later branches, when just the user space daemons are restarted, with the older kernel module intact, datapaths are recreated. This results in loosing the internal interface states like ip addresses, routing table entries etc. Also, the 'ofport' value of the older interfaces change. With this patch we restore the interface states, ofport values etc, when "ovs-ctl restart" or "/etc/init.d/openvswitch[-switch] restart --save-flows" is called. The later command is automatically called when debian packages are installed. Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Diffstat (limited to 'utilities')
-rwxr-xr-xutilities/ovs-ctl.in37
1 files changed, 27 insertions, 10 deletions
diff --git a/utilities/ovs-ctl.in b/utilities/ovs-ctl.in
index dd958a2d..a7b88eab 100755
--- a/utilities/ovs-ctl.in
+++ b/utilities/ovs-ctl.in
@@ -285,8 +285,6 @@ save_ofports_if_required () {
action "Saving ofport values" ovs_save save-ofports \
"${script_ofports}"
;;
- *)
- ;;
esac
}
@@ -315,7 +313,7 @@ restore_interfaces () {
level=err
fi
log="logger -p daemon.$level -t ovs-save"
- $log "force-reload-kmod interface restore script exited with status $rc:"
+ $log "interface restore script exited with status $rc:"
$log -f "$script_interfaces"
}
@@ -379,13 +377,25 @@ 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
- script_flows=`mktemp`
- trap 'rm -f "${script_flows}"' 0
-
- action "Saving flows" ovs_save save-flows "${script_flows}" \
- script_flows
+ init_restore_scripts
+ save_interfaces_if_required
+ action "Saving flows" ovs_save save-flows "${script_flows}"
+ save_ofports_if_required
fi
# Restart the database first, since a large database may take a
@@ -393,11 +403,18 @@ restart () {
stop_ovsdb
start_ovsdb
+ # Restore of ofports, if required, should happen before vswitchd is
+ # restarted.
+ restore_ofports
+
stop_forwarding
start_forwarding
- # Restore the saved flows. Do not return error if restore fails.
- restore_flows || true
+ # Restore the saved flows.
+ restore_flows
+
+ # Restore the interfaces if required. Return true even if restore fails.
+ restore_interfaces || true
}
## --------------- ##