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 f650f8731cde080a01e6ad78ae8f56b7924eddd3..301bc73d2264fc5535b3dec1614f77c626161199 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 ad7579cd2751fa9bc0712be3680f94ad4b6fd6dd..af332c0b577967893600d9d6b202c02d145195e0 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 a1998251685f5d2545c0469108b9a2cdf4ac273a..534451bacbb5853e8e3d9beb9c8d52d29d01d8c9 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.