[ovs-dev] [PATCH 2/2] ovs-ctl.in: Restore flows across force-reload-kmod.
Gurucharan Shetty
shettyg at nicira.com
Fri Jan 11 23:48:41 UTC 2013
If we want to upgrade from branch1.9 to master (or potential 1.10)
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 at nicira.com>
---
utilities/ovs-ctl.in | 36 ++++++++++++++++++++++++------------
1 file changed, 24 insertions(+), 12 deletions(-)
diff --git a/utilities/ovs-ctl.in b/utilities/ovs-ctl.in
index bce74a6..cd8b3ea 100755
--- a/utilities/ovs-ctl.in
+++ b/utilities/ovs-ctl.in
@@ -267,16 +267,15 @@ 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_interfaces () {
@@ -284,6 +283,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 +299,22 @@ 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
+
+ action "Saving ofport values" ovs_save save-ofports "${script_ofports}" \
+ script_ofports
# 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 +364,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
--
1.7.9.5
More information about the dev
mailing list