From: Gurucharan Shetty Date: Wed, 24 Oct 2012 20:02:22 +0000 (-0700) Subject: xenserver, rhel, debian: Use ovs-ctl restart. X-Git-Tag: sliver-openvswitch-1.9.90-1~3^2~9 X-Git-Url: http://git.onelab.eu/?p=sliver-openvswitch.git;a=commitdiff_plain;h=aad12c5f8f6a15681c525d552bd76afd46a1c08b xenserver, rhel, debian: Use ovs-ctl restart. 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 --- diff --git a/debian/openvswitch-switch.init b/debian/openvswitch-switch.init index f650f8731..301bc73d2 100755 --- a/debian/openvswitch-switch.init +++ b/debian/openvswitch-switch.init @@ -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 diff --git a/rhel/etc_init.d_openvswitch b/rhel/etc_init.d_openvswitch index ad7579cd2..af332c0b5 100755 --- a/rhel/etc_init.d_openvswitch +++ b/rhel/etc_init.d_openvswitch @@ -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. diff --git a/xenserver/etc_init.d_openvswitch b/xenserver/etc_init.d_openvswitch index a19982516..534451bac 100755 --- a/xenserver/etc_init.d_openvswitch +++ b/xenserver/etc_init.d_openvswitch @@ -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.