ovs-ctl.in: Do not fail 'restart'.
[openvswitch] / utilities / ovs-ctl.in
index 9ce4973d1d09e130996b0948669b52bfebe0b5db..7febd1c2198527408ba544c22f1a98357375ac36 100755 (executable)
@@ -405,10 +405,12 @@ force_reload_kmod () {
 ## ------- ##
 
 restart () {
-    script_flows=`mktemp`
-    trap 'rm -f "${script_flows}"' 0 1 2 13 15
+    if daemon_is_running ovsdb-server && daemon_is_running ovs-vswitchd; then
+        script_flows=`mktemp`
+        trap 'rm -f "${script_flows}"' 0 1 2 13 15
 
-    action "Saving flows" save_flows
+        action "Saving flows" save_flows
+    fi
 
     # Restart the database first, since a large database may take a
     # while to load, and we want to minimize forwarding disruption.
@@ -418,7 +420,8 @@ restart () {
     stop_forwarding
     start_forwarding
 
-    restore_flows
+    # Restore the saved flows. Do not return error if restore fails.
+    restore_flows || true
 }
 
 ## --------------- ##