From 407b147399feb37295ef09395be14a06f7f169ca Mon Sep 17 00:00:00 2001 From: Gurucharan Shetty Date: Tue, 28 May 2013 13:21:56 +0000 Subject: [PATCH] ovs-ctl.in: Restore flows with vswitchd packet processing disabled. It has been observed that when we upgrade openvswitch with thousands of openflow flows already established and there is heavy traffic going through the switch, restoring flows can take a very long time (8 minutes in one use case) with CPU running at 100%. This can make the upgrade very expensive. This commit starts vswitchd by asking it to wait till flow restore is finished. Once the flows are restored, it resumes normal operations. Bug #16086. Signed-off-by: Gurucharan Shetty --- utilities/ovs-ctl.in | 19 ++++++++++++++++++- vswitchd/vswitch.xml | 4 ++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/utilities/ovs-ctl.in b/utilities/ovs-ctl.in index fb33f72af..6465fdf14 100755 --- a/utilities/ovs-ctl.in +++ b/utilities/ovs-ctl.in @@ -306,6 +306,15 @@ restore_ofports () { action "Restoring ofport values" "${script_ofports}" } +flow_restore_wait () { + ovs_vsctl set open_vswitch . other_config:flow-restore-wait="true" +} + +flow_restore_complete () { + ovs_vsctl --if-exists remove open_vswitch . other_config \ + flow-restore-wait="true" +} + restore_flows () { [ -x "${script_flows}" ] && \ action "Restoring saved flows" "${script_flows}" @@ -373,9 +382,13 @@ force_reload_kmod () { action "Removing openvswitch module" rmmod openvswitch fi + # Start vswitchd by asking it to wait till flow restore is finished. + flow_restore_wait start_forwarding + # Restore saved flows and inform vswitchd that we are done. restore_flows + flow_restore_complete add_managers restore_interfaces @@ -418,10 +431,14 @@ restart () { restore_ofports stop_forwarding + + # Start vswitchd by asking it to wait till flow restore is finished. + flow_restore_wait start_forwarding - # Restore the saved flows. + # Restore saved flows and inform vswitchd that we are done. restore_flows + flow_restore_complete add_managers # Restore the interfaces if required. Return true even if restore fails. diff --git a/vswitchd/vswitch.xml b/vswitchd/vswitch.xml index e3ea29182..a17eae768 100644 --- a/vswitchd/vswitch.xml +++ b/vswitchd/vswitch.xml @@ -117,6 +117,10 @@ to false (or remove it entirely from the database). +

+ The ovs-ctl's ``restart'' and ``force-reload-kmod'' + functions use the above config option during hot upgrades. +

-- 2.43.0