diff mbox series

[ovs-dev,2/3] rhel: use the functions in ovs-lib.in in ovs-systemd-reload

Message ID f3e8fe3972c2bc9b16c5e6868627673c24735859.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
To avoid code duplication use the functions from ovs-lib.in

Signed-off-by: Timothy Redaelli <tredaelli@redhat.com>
---
 ...sr_share_openvswitch_scripts_ovs-systemd-reload | 37 ++++++++++++++--------
 1 file changed, 23 insertions(+), 14 deletions(-)

Comments

Gregory Rose Jan. 5, 2018, 9:39 p.m. UTC | #1
On 12/22/2017 7:00 AM, Timothy Redaelli wrote:
> To avoid code duplication use the functions from ovs-lib.in
>
> Signed-off-by: Timothy Redaelli <tredaelli@redhat.com>
> ---
>   ...sr_share_openvswitch_scripts_ovs-systemd-reload | 37 ++++++++++++++--------
>   1 file changed, 23 insertions(+), 14 deletions(-)

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

>
> diff --git a/rhel/usr_share_openvswitch_scripts_ovs-systemd-reload b/rhel/usr_share_openvswitch_scripts_ovs-systemd-reload
> index 3ac1a46c6..5d2efc621 100755
> --- a/rhel/usr_share_openvswitch_scripts_ovs-systemd-reload
> +++ b/rhel/usr_share_openvswitch_scripts_ovs-systemd-reload
> @@ -14,23 +14,32 @@
>   # See the License for the specific language governing permissions and
>   # limitations under the License.
>   
> -# Save flows
> -bridges=$(ovs-vsctl -- --real list-br)
> -flows=$(/usr/share/openvswitch/scripts/ovs-save save-flows $bridges)
> +case $0 in
> +    */*) dir0=`echo "$0" | sed 's,/[^/]*$,,'` ;;
> +    *) dir0=./ ;;
> +esac
> +. "$dir0/ovs-lib" || exit 1
>   
> -# Restart the database first, since a large database may take a
> -# while to load, and we want to minimize forwarding disruption.
> -systemctl --job-mode=ignore-dependencies restart ovsdb-server
> +stop_ovsdb() {
> +    systemctl --job-mode=ignore-dependencies stop ovsdb-server
> +}
>   
> -# Stop ovs-vswitchd.
> -systemctl --job-mode=ignore-dependencies stop ovs-vswitchd
> +start_ovsdb() {
> +    systemctl --job-mode=ignore-dependencies start ovsdb-server
> +}
>   
> -# Start vswitchd by asking it to wait till flow restore is finished.
> -ovs-vsctl --no-wait set open_vswitch . other_config:flow-restore-wait=true
> -systemctl --job-mode=ignore-dependencies start ovs-vswitchd
> +stop_forwarding() {
> +    systemctl --job-mode=ignore-dependencies stop ovs-vswitchd
> +}
>   
> -# Restore saved flows and inform vswitchd that we are done.
> -eval "$flows"
> -ovs-vsctl --if-exists remove open_vswitch . other_config flow-restore-wait=true
> +start_forwarding() {
> +    systemctl --job-mode=ignore-dependencies start ovs-vswitchd
> +}
> +
> +add_managers() {
> +    :
> +}
> +
> +restart
>   
>   exit 0
diff mbox series

Patch

diff --git a/rhel/usr_share_openvswitch_scripts_ovs-systemd-reload b/rhel/usr_share_openvswitch_scripts_ovs-systemd-reload
index 3ac1a46c6..5d2efc621 100755
--- a/rhel/usr_share_openvswitch_scripts_ovs-systemd-reload
+++ b/rhel/usr_share_openvswitch_scripts_ovs-systemd-reload
@@ -14,23 +14,32 @@ 
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-# Save flows
-bridges=$(ovs-vsctl -- --real list-br)
-flows=$(/usr/share/openvswitch/scripts/ovs-save save-flows $bridges)
+case $0 in
+    */*) dir0=`echo "$0" | sed 's,/[^/]*$,,'` ;;
+    *) dir0=./ ;;
+esac
+. "$dir0/ovs-lib" || exit 1
 
-# Restart the database first, since a large database may take a
-# while to load, and we want to minimize forwarding disruption.
-systemctl --job-mode=ignore-dependencies restart ovsdb-server
+stop_ovsdb() {
+    systemctl --job-mode=ignore-dependencies stop ovsdb-server
+}
 
-# Stop ovs-vswitchd.
-systemctl --job-mode=ignore-dependencies stop ovs-vswitchd
+start_ovsdb() {
+    systemctl --job-mode=ignore-dependencies start ovsdb-server
+}
 
-# Start vswitchd by asking it to wait till flow restore is finished.
-ovs-vsctl --no-wait set open_vswitch . other_config:flow-restore-wait=true
-systemctl --job-mode=ignore-dependencies start ovs-vswitchd
+stop_forwarding() {
+    systemctl --job-mode=ignore-dependencies stop ovs-vswitchd
+}
 
-# Restore saved flows and inform vswitchd that we are done.
-eval "$flows"
-ovs-vsctl --if-exists remove open_vswitch . other_config flow-restore-wait=true
+start_forwarding() {
+    systemctl --job-mode=ignore-dependencies start ovs-vswitchd
+}
+
+add_managers() {
+    :
+}
+
+restart
 
 exit 0