xenserver, rhel, debian: Use ovs-ctl restart.
authorGurucharan Shetty <gshetty@nicira.com>
Wed, 24 Oct 2012 20:02:22 +0000 (13:02 -0700)
committerGurucharan Shetty <gshetty@nicira.com>
Wed, 24 Oct 2012 23:43:38 +0000 (16:43 -0700)
ovs-ctl has a new command called "restart" which
saves and restores the openflow flows on bridges.
Use that command from the init scripts when doing
a "restart --save-flows=yes".

Also, the debian package postinst script can
set the variable OVS_RESTART_SAVE_FLOWS to "yes"
to ask for save and restore of flows.

Feature #13555.
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
debian/openvswitch-switch.init
rhel/etc_init.d_openvswitch
xenserver/etc_init.d_openvswitch

index f650f87..301bc73 100755 (executable)
@@ -78,6 +78,17 @@ stop () {
     ovs_ctl stop
 }
 
+restart () {
+    # OVS_RESTART_SAVE_FLOWS can be set by package postinst script.
+    if [ "$OVS_RESTART_SAVE_FLOWS" = "yes" ] || \
+       [ "$1" = "--save-flows=yes" ]; then
+        start restart
+    else
+        stop
+        start
+    fi
+}
+
 case $1 in
     start)
         start
@@ -89,8 +100,8 @@ case $1 in
         # The OVS daemons keep up-to-date.
         ;;
     restart)
-        stop
-        start
+        shift
+        restart "$@"
         ;;
     status)
         ovs_ctl status
index ad7579c..af332c0 100755 (executable)
@@ -61,6 +61,15 @@ stop () {
     rm -f /var/lock/subsys/openvswitch
 }
 
+restart () {
+    if [ "$1" = "--save-flows=yes" ]; then
+        start restart
+    else
+        stop
+        start
+    fi
+}
+
 ovs_ctl=/usr/share/openvswitch/scripts/ovs-ctl
 case $1 in
     start)
@@ -70,8 +79,8 @@ case $1 in
         stop
         ;;
     restart)
-        stop
-        start
+        shift
+        restart "$@"
         ;;
     reload|force-reload)
         # Nothing to do.
index a199825..534451b 100755 (executable)
@@ -107,6 +107,16 @@ stop () {
     rm -f /var/lock/subsys/openvswitch
 }
 
+restart () {
+    if [ "$1" = "--save-flows=yes" ]; then
+        stop_daemon ovs-xapi-sync
+        start restart
+    else
+        stop
+        start
+    fi
+}
+
 ovs_ctl=/usr/share/openvswitch/scripts/ovs-ctl
 case $1 in
     start)
@@ -116,8 +126,8 @@ case $1 in
         stop
         ;;
     restart)
-        stop
-        start
+        shift
+        restart "$@"
         ;;
     reload|force-reload)
         # The main OVS daemons keep up-to-date, but ovs-xapi-sync needs help.