diff mbox series

[ovs-dev,1/3] utilities: move some functions from ovs-ctl.in to ovs-lib.in

Message ID 65ba4faaeaf65818a4639361ba9884048692db78.1513954107.git.tredaelli@redhat.com
State Accepted
Headers show
Series rhel: Add force-reload-kmod support in ovs-systemd-reload | expand

Commit Message

Timothy Redaelli Dec. 22, 2017, 3 p.m. UTC
Move the functions related to "force-reload-kmod" and "restart" from
ovs-ctl.in to ovs-lib.in in order to permit other scripts to use them.

Signed-off-by: Timothy Redaelli <tredaelli@redhat.com>
---
 utilities/ovs-ctl.in | 173 ---------------------------------------------------
 utilities/ovs-lib.in | 173 +++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 173 insertions(+), 173 deletions(-)

Comments

Gregory Rose Jan. 5, 2018, 9:35 p.m. UTC | #1
On 12/22/2017 7:00 AM, Timothy Redaelli wrote:
> Move the functions related to "force-reload-kmod" and "restart" from
> ovs-ctl.in to ovs-lib.in in order to permit other scripts to use them.
>
> Signed-off-by: Timothy Redaelli <tredaelli@redhat.com>
> ---
>   utilities/ovs-ctl.in | 173 ---------------------------------------------------
>   utilities/ovs-lib.in | 173 +++++++++++++++++++++++++++++++++++++++++++++++++++
>   2 files changed, 173 insertions(+), 173 deletions(-)

A few minor checkpatch errors:

== Checking 
"0001-utilities-move-some-functions-from-ovs-ctl.in-to-ovs.patch" ==
WARNING: Line has non-spaces leading whitespace
#231 FILE: utilities/ovs-lib.in:465:
                     -- list-br) | sort -u`

WARNING: Line has non-spaces leading whitespace
#234 FILE: utilities/ovs-lib.in:468:
                 printf "%s " "$d"

WARNING: Line has non-spaces leading whitespace
#235 FILE: utilities/ovs-lib.in:469:
             fi

Lines checked: 385, Warnings: 3, Errors: 0

Otherwise looks good to me.

Tested-by: Greg Rose <gvrose8192@gmail.com>
Reviewed-by: Greg Rose <gvrose8192@gmail.com>


>
> diff --git a/utilities/ovs-ctl.in b/utilities/ovs-ctl.in
> index f1b01d1d3..1df56c4a5 100755
> --- a/utilities/ovs-ctl.in
> +++ b/utilities/ovs-ctl.in
> @@ -63,10 +63,6 @@ insert_mod_if_required () {
>       insert_mods
>   }
>   
> -ovs_vsctl () {
> -    ovs-vsctl --no-wait "$@"
> -}
> -
>   set_hostname () {
>       # 'hostname -f' needs network connectivity to work.  So we should
>       # call this only after ovs-vswitchd is running.
> @@ -270,175 +266,6 @@ stop_forwarding () {
>       fi
>   }
>   
> -## ----------------- ##
> -## force-reload-kmod ##
> -## ----------------- ##
> -
> -internal_interfaces () {
> -    # Outputs a list of internal interfaces:
> -    #
> -    #   - There is an internal interface for every bridge, whether it
> -    #     has an Interface record or not and whether the Interface
> -    #     record's 'type' is properly set or not.
> -    #
> -    #   - There is an internal interface for each Interface record whose
> -    #     'type' is 'internal'.
> -    #
> -    # But ignore interfaces that don't really exist.
> -    for d in `(ovs_vsctl --bare \
> -                -- --columns=name find Interface type=internal \
> -		    -- list-br) | sort -u`
> -    do
> -        if test -e "/sys/class/net/$d"; then
> -	        printf "%s " "$d"
> -	    fi
> -    done
> -}
> -
> -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
> -    [ -z "${bridges}" ] && return 0
> -}
> -
> -save_flows_if_required () {
> -    if test X"$DELETE_BRIDGES" != Xyes; then
> -        action "Saving flows" ovs_save save-flows "${script_flows}"
> -    fi
> -}
> -
> -save_interfaces () {
> -    "$datadir/scripts/ovs-save" save-interfaces ${ifaces} \
> -        > "${script_interfaces}"
> -}
> -
> -flow_restore_wait () {
> -    if test X"$OVS_VSWITCHD" = Xyes; then
> -        ovs_vsctl set open_vswitch . other_config:flow-restore-wait="true"
> -    fi
> -}
> -
> -flow_restore_complete () {
> -    if test X"$OVS_VSWITCHD" = Xyes; then
> -        ovs_vsctl --if-exists remove open_vswitch . other_config \
> -                  flow-restore-wait="true"
> -    fi
> -}
> -
> -restore_flows () {
> -    [ -x "${script_flows}" ] && \
> -        action "Restoring saved flows" "${script_flows}"
> -}
> -
> -restore_interfaces () {
> -    [ ! -x "${script_interfaces}" ] && return 0
> -    action "Restoring interface configuration" "${script_interfaces}"
> -    rc=$?
> -    if test $rc = 0; then
> -        level=debug
> -    else
> -        level=err
> -    fi
> -    log="logger -p daemon.$level -t ovs-save"
> -    $log "interface restore script exited with status $rc:"
> -    $log -f "$script_interfaces"
> -}
> -
> -init_restore_scripts () {
> -    script_interfaces=`mktemp`
> -    script_flows=`mktemp`
> -    trap 'rm -f "${script_interfaces}" "${script_flows}"' 0
> -}
> -
> -force_reload_kmod () {
> -
> -    if test X"$OVS_VSWITCHD" != Xyes; then
> -        log_failure_msg "Reloading of kmod without ovs-vswitchd is an error"
> -        exit 1
> -    fi
> -
> -    ifaces=`internal_interfaces`
> -    action "Detected internal interfaces: $ifaces" true
> -
> -    init_restore_scripts
> -    save_flows_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 || return 1
> -
> -    stop_forwarding
> -
> -    if action "Saving interface configuration" save_interfaces; then
> -        :
> -    else
> -        log_warning_msg "Failed to save configuration, not replacing kernel module"
> -        start_forwarding
> -        add_managers
> -        exit 1
> -    fi
> -    chmod +x "$script_interfaces"
> -
> -    for dp in `ovs-dpctl dump-dps`; do
> -        action "Removing datapath: $dp" ovs-dpctl del-dp "$dp"
> -    done
> -
> -    for vport in `awk '/^vport_/ { print $1 }' /proc/modules`; do
> -        action "Removing $vport module" rmmod $vport
> -    done
> -
> -    if test -e /sys/module/openvswitch; then
> -        action "Removing openvswitch module" rmmod openvswitch
> -    fi
> -
> -    # Start vswitchd by asking it to wait till flow restore is finished.
> -    flow_restore_wait
> -    start_forwarding || return 1
> -
> -    # Restore saved flows and inform vswitchd that we are done.
> -    restore_flows
> -    flow_restore_complete
> -    add_managers
> -
> -    restore_interfaces
> -
> -    "$datadir/scripts/ovs-check-dead-ifs"
> -}
> -
> -## ------- ##
> -## restart ##
> -## ------- ##
> -
> -restart () {
> -    if daemon_is_running ovsdb-server && daemon_is_running ovs-vswitchd; then
> -        init_restore_scripts
> -        if test X"$OVS_VSWITCHD" = Xyes; then
> -            save_flows_if_required
> -        fi
> -    fi
> -
> -    # 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 || return 1
> -
> -    stop_forwarding
> -
> -    # Start vswitchd by asking it to wait till flow restore is finished.
> -    flow_restore_wait
> -    start_forwarding || return 1
> -
> -    # Restore saved flows and inform vswitchd that we are done.
> -    restore_flows
> -    flow_restore_complete
> -    add_managers
> -}
> -
>   ## --------------- ##
>   ## enable-protocol ##
>   ## --------------- ##
> diff --git a/utilities/ovs-lib.in b/utilities/ovs-lib.in
> index 1bccea0c5..5e25f85c8 100644
> --- a/utilities/ovs-lib.in
> +++ b/utilities/ovs-lib.in
> @@ -440,3 +440,176 @@ upgrade_db () {
>           fi
>       fi
>   }
> +
> +ovs_vsctl () {
> +    ovs-vsctl --no-wait "$@"
> +}
> +
> +## ----------------- ##
> +## force-reload-kmod ##
> +## ----------------- ##
> +
> +internal_interfaces () {
> +    # Outputs a list of internal interfaces:
> +    #
> +    #   - There is an internal interface for every bridge, whether it
> +    #     has an Interface record or not and whether the Interface
> +    #     record's 'type' is properly set or not.
> +    #
> +    #   - There is an internal interface for each Interface record whose
> +    #     'type' is 'internal'.
> +    #
> +    # But ignore interfaces that don't really exist.
> +    for d in `(ovs_vsctl --bare \
> +                -- --columns=name find Interface type=internal \
> +		    -- list-br) | sort -u`
> +    do
> +        if test -e "/sys/class/net/$d"; then
> +	        printf "%s " "$d"
> +	    fi
> +    done
> +}
> +
> +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
> +    [ -z "${bridges}" ] && return 0
> +}
> +
> +save_flows_if_required () {
> +    if test X"$DELETE_BRIDGES" != Xyes; then
> +        action "Saving flows" ovs_save save-flows "${script_flows}"
> +    fi
> +}
> +
> +save_interfaces () {
> +    "$datadir/scripts/ovs-save" save-interfaces ${ifaces} \
> +        > "${script_interfaces}"
> +}
> +
> +flow_restore_wait () {
> +    if test X"${OVS_VSWITCHD:-yes}" = Xyes; then
> +        ovs_vsctl set open_vswitch . other_config:flow-restore-wait="true"
> +    fi
> +}
> +
> +flow_restore_complete () {
> +    if test X"${OVS_VSWITCHD:-yes}" = Xyes; then
> +        ovs_vsctl --if-exists remove open_vswitch . other_config \
> +                  flow-restore-wait="true"
> +    fi
> +}
> +
> +restore_flows () {
> +    [ -x "${script_flows}" ] && \
> +        action "Restoring saved flows" "${script_flows}"
> +}
> +
> +restore_interfaces () {
> +    [ ! -x "${script_interfaces}" ] && return 0
> +    action "Restoring interface configuration" "${script_interfaces}"
> +    rc=$?
> +    if test $rc = 0; then
> +        level=debug
> +    else
> +        level=err
> +    fi
> +    log="logger -p daemon.$level -t ovs-save"
> +    $log "interface restore script exited with status $rc:"
> +    $log -f "$script_interfaces"
> +}
> +
> +init_restore_scripts () {
> +    script_interfaces=`mktemp`
> +    script_flows=`mktemp`
> +    trap 'rm -f "${script_interfaces}" "${script_flows}"' 0
> +}
> +
> +force_reload_kmod () {
> +
> +    if test X"${OVS_VSWITCHD:-yes}" != Xyes; then
> +        log_failure_msg "Reloading of kmod without ovs-vswitchd is an error"
> +        exit 1
> +    fi
> +
> +    ifaces=`internal_interfaces`
> +    action "Detected internal interfaces: $ifaces" true
> +
> +    init_restore_scripts
> +    save_flows_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 || return 1
> +
> +    stop_forwarding
> +
> +    if action "Saving interface configuration" save_interfaces; then
> +        :
> +    else
> +        log_warning_msg "Failed to save configuration, not replacing kernel module"
> +        start_forwarding
> +        add_managers
> +        exit 1
> +    fi
> +    chmod +x "$script_interfaces"
> +
> +    for dp in `ovs-dpctl dump-dps`; do
> +        action "Removing datapath: $dp" ovs-dpctl del-dp "$dp"
> +    done
> +
> +    for vport in `awk '/^vport_/ { print $1 }' /proc/modules`; do
> +        action "Removing $vport module" rmmod $vport
> +    done
> +
> +    if test -e /sys/module/openvswitch; then
> +        action "Removing openvswitch module" rmmod openvswitch
> +    fi
> +
> +    # Start vswitchd by asking it to wait till flow restore is finished.
> +    flow_restore_wait
> +    start_forwarding || return 1
> +
> +    # Restore saved flows and inform vswitchd that we are done.
> +    restore_flows
> +    flow_restore_complete
> +    add_managers
> +
> +    restore_interfaces
> +
> +    "$datadir/scripts/ovs-check-dead-ifs"
> +}
> +
> +## ------- ##
> +## restart ##
> +## ------- ##
> +
> +restart () {
> +    if daemon_is_running ovsdb-server && daemon_is_running ovs-vswitchd; then
> +        init_restore_scripts
> +        if test X"${OVS_VSWITCHD:-yes}" = Xyes; then
> +            save_flows_if_required
> +        fi
> +    fi
> +
> +    # 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 || return 1
> +
> +    stop_forwarding
> +
> +    # Start vswitchd by asking it to wait till flow restore is finished.
> +    flow_restore_wait
> +    start_forwarding || return 1
> +
> +    # Restore saved flows and inform vswitchd that we are done.
> +    restore_flows
> +    flow_restore_complete
> +    add_managers
> +}
diff mbox series

Patch

diff --git a/utilities/ovs-ctl.in b/utilities/ovs-ctl.in
index f1b01d1d3..1df56c4a5 100755
--- a/utilities/ovs-ctl.in
+++ b/utilities/ovs-ctl.in
@@ -63,10 +63,6 @@  insert_mod_if_required () {
     insert_mods
 }
 
-ovs_vsctl () {
-    ovs-vsctl --no-wait "$@"
-}
-
 set_hostname () {
     # 'hostname -f' needs network connectivity to work.  So we should
     # call this only after ovs-vswitchd is running.
@@ -270,175 +266,6 @@  stop_forwarding () {
     fi
 }
 
-## ----------------- ##
-## force-reload-kmod ##
-## ----------------- ##
-
-internal_interfaces () {
-    # Outputs a list of internal interfaces:
-    #
-    #   - There is an internal interface for every bridge, whether it
-    #     has an Interface record or not and whether the Interface
-    #     record's 'type' is properly set or not.
-    #
-    #   - There is an internal interface for each Interface record whose
-    #     'type' is 'internal'.
-    #
-    # But ignore interfaces that don't really exist.
-    for d in `(ovs_vsctl --bare \
-                -- --columns=name find Interface type=internal \
-		    -- list-br) | sort -u`
-    do
-        if test -e "/sys/class/net/$d"; then
-	        printf "%s " "$d"
-	    fi
-    done
-}
-
-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
-    [ -z "${bridges}" ] && return 0
-}
-
-save_flows_if_required () {
-    if test X"$DELETE_BRIDGES" != Xyes; then
-        action "Saving flows" ovs_save save-flows "${script_flows}"
-    fi
-}
-
-save_interfaces () {
-    "$datadir/scripts/ovs-save" save-interfaces ${ifaces} \
-        > "${script_interfaces}"
-}
-
-flow_restore_wait () {
-    if test X"$OVS_VSWITCHD" = Xyes; then
-        ovs_vsctl set open_vswitch . other_config:flow-restore-wait="true"
-    fi
-}
-
-flow_restore_complete () {
-    if test X"$OVS_VSWITCHD" = Xyes; then
-        ovs_vsctl --if-exists remove open_vswitch . other_config \
-                  flow-restore-wait="true"
-    fi
-}
-
-restore_flows () {
-    [ -x "${script_flows}" ] && \
-        action "Restoring saved flows" "${script_flows}"
-}
-
-restore_interfaces () {
-    [ ! -x "${script_interfaces}" ] && return 0
-    action "Restoring interface configuration" "${script_interfaces}"
-    rc=$?
-    if test $rc = 0; then
-        level=debug
-    else
-        level=err
-    fi
-    log="logger -p daemon.$level -t ovs-save"
-    $log "interface restore script exited with status $rc:"
-    $log -f "$script_interfaces"
-}
-
-init_restore_scripts () {
-    script_interfaces=`mktemp`
-    script_flows=`mktemp`
-    trap 'rm -f "${script_interfaces}" "${script_flows}"' 0
-}
-
-force_reload_kmod () {
-
-    if test X"$OVS_VSWITCHD" != Xyes; then
-        log_failure_msg "Reloading of kmod without ovs-vswitchd is an error"
-        exit 1
-    fi
-
-    ifaces=`internal_interfaces`
-    action "Detected internal interfaces: $ifaces" true
-
-    init_restore_scripts
-    save_flows_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 || return 1
-
-    stop_forwarding
-
-    if action "Saving interface configuration" save_interfaces; then
-        :
-    else
-        log_warning_msg "Failed to save configuration, not replacing kernel module"
-        start_forwarding
-        add_managers
-        exit 1
-    fi
-    chmod +x "$script_interfaces"
-
-    for dp in `ovs-dpctl dump-dps`; do
-        action "Removing datapath: $dp" ovs-dpctl del-dp "$dp"
-    done
-
-    for vport in `awk '/^vport_/ { print $1 }' /proc/modules`; do
-        action "Removing $vport module" rmmod $vport
-    done
-
-    if test -e /sys/module/openvswitch; then
-        action "Removing openvswitch module" rmmod openvswitch
-    fi
-
-    # Start vswitchd by asking it to wait till flow restore is finished.
-    flow_restore_wait
-    start_forwarding || return 1
-
-    # Restore saved flows and inform vswitchd that we are done.
-    restore_flows
-    flow_restore_complete
-    add_managers
-
-    restore_interfaces
-
-    "$datadir/scripts/ovs-check-dead-ifs"
-}
-
-## ------- ##
-## restart ##
-## ------- ##
-
-restart () {
-    if daemon_is_running ovsdb-server && daemon_is_running ovs-vswitchd; then
-        init_restore_scripts
-        if test X"$OVS_VSWITCHD" = Xyes; then
-            save_flows_if_required
-        fi
-    fi
-
-    # 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 || return 1
-
-    stop_forwarding
-
-    # Start vswitchd by asking it to wait till flow restore is finished.
-    flow_restore_wait
-    start_forwarding || return 1
-
-    # Restore saved flows and inform vswitchd that we are done.
-    restore_flows
-    flow_restore_complete
-    add_managers
-}
-
 ## --------------- ##
 ## enable-protocol ##
 ## --------------- ##
diff --git a/utilities/ovs-lib.in b/utilities/ovs-lib.in
index 1bccea0c5..5e25f85c8 100644
--- a/utilities/ovs-lib.in
+++ b/utilities/ovs-lib.in
@@ -440,3 +440,176 @@  upgrade_db () {
         fi
     fi
 }
+
+ovs_vsctl () {
+    ovs-vsctl --no-wait "$@"
+}
+
+## ----------------- ##
+## force-reload-kmod ##
+## ----------------- ##
+
+internal_interfaces () {
+    # Outputs a list of internal interfaces:
+    #
+    #   - There is an internal interface for every bridge, whether it
+    #     has an Interface record or not and whether the Interface
+    #     record's 'type' is properly set or not.
+    #
+    #   - There is an internal interface for each Interface record whose
+    #     'type' is 'internal'.
+    #
+    # But ignore interfaces that don't really exist.
+    for d in `(ovs_vsctl --bare \
+                -- --columns=name find Interface type=internal \
+		    -- list-br) | sort -u`
+    do
+        if test -e "/sys/class/net/$d"; then
+	        printf "%s " "$d"
+	    fi
+    done
+}
+
+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
+    [ -z "${bridges}" ] && return 0
+}
+
+save_flows_if_required () {
+    if test X"$DELETE_BRIDGES" != Xyes; then
+        action "Saving flows" ovs_save save-flows "${script_flows}"
+    fi
+}
+
+save_interfaces () {
+    "$datadir/scripts/ovs-save" save-interfaces ${ifaces} \
+        > "${script_interfaces}"
+}
+
+flow_restore_wait () {
+    if test X"${OVS_VSWITCHD:-yes}" = Xyes; then
+        ovs_vsctl set open_vswitch . other_config:flow-restore-wait="true"
+    fi
+}
+
+flow_restore_complete () {
+    if test X"${OVS_VSWITCHD:-yes}" = Xyes; then
+        ovs_vsctl --if-exists remove open_vswitch . other_config \
+                  flow-restore-wait="true"
+    fi
+}
+
+restore_flows () {
+    [ -x "${script_flows}" ] && \
+        action "Restoring saved flows" "${script_flows}"
+}
+
+restore_interfaces () {
+    [ ! -x "${script_interfaces}" ] && return 0
+    action "Restoring interface configuration" "${script_interfaces}"
+    rc=$?
+    if test $rc = 0; then
+        level=debug
+    else
+        level=err
+    fi
+    log="logger -p daemon.$level -t ovs-save"
+    $log "interface restore script exited with status $rc:"
+    $log -f "$script_interfaces"
+}
+
+init_restore_scripts () {
+    script_interfaces=`mktemp`
+    script_flows=`mktemp`
+    trap 'rm -f "${script_interfaces}" "${script_flows}"' 0
+}
+
+force_reload_kmod () {
+
+    if test X"${OVS_VSWITCHD:-yes}" != Xyes; then
+        log_failure_msg "Reloading of kmod without ovs-vswitchd is an error"
+        exit 1
+    fi
+
+    ifaces=`internal_interfaces`
+    action "Detected internal interfaces: $ifaces" true
+
+    init_restore_scripts
+    save_flows_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 || return 1
+
+    stop_forwarding
+
+    if action "Saving interface configuration" save_interfaces; then
+        :
+    else
+        log_warning_msg "Failed to save configuration, not replacing kernel module"
+        start_forwarding
+        add_managers
+        exit 1
+    fi
+    chmod +x "$script_interfaces"
+
+    for dp in `ovs-dpctl dump-dps`; do
+        action "Removing datapath: $dp" ovs-dpctl del-dp "$dp"
+    done
+
+    for vport in `awk '/^vport_/ { print $1 }' /proc/modules`; do
+        action "Removing $vport module" rmmod $vport
+    done
+
+    if test -e /sys/module/openvswitch; then
+        action "Removing openvswitch module" rmmod openvswitch
+    fi
+
+    # Start vswitchd by asking it to wait till flow restore is finished.
+    flow_restore_wait
+    start_forwarding || return 1
+
+    # Restore saved flows and inform vswitchd that we are done.
+    restore_flows
+    flow_restore_complete
+    add_managers
+
+    restore_interfaces
+
+    "$datadir/scripts/ovs-check-dead-ifs"
+}
+
+## ------- ##
+## restart ##
+## ------- ##
+
+restart () {
+    if daemon_is_running ovsdb-server && daemon_is_running ovs-vswitchd; then
+        init_restore_scripts
+        if test X"${OVS_VSWITCHD:-yes}" = Xyes; then
+            save_flows_if_required
+        fi
+    fi
+
+    # 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 || return 1
+
+    stop_forwarding
+
+    # Start vswitchd by asking it to wait till flow restore is finished.
+    flow_restore_wait
+    start_forwarding || return 1
+
+    # Restore saved flows and inform vswitchd that we are done.
+    restore_flows
+    flow_restore_complete
+    add_managers
+}