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<gshe...@nicira.com> --- debian/openvswitch-switch.init | 15 +++++++++++++-- rhel/etc_init.d_openvswitch | 13 +++++++++++-- xenserver/etc_init.d_openvswitch | 14 ++++++++++++-- 3 files changed, 36 insertions(+), 6 deletions(-) diff --git a/debian/openvswitch-switch.init b/debian/openvswitch-switch.init index f650f87..301bc73 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 85cf55d..3b2343f 100755 --- a/rhel/etc_init.d_openvswitch +++ b/rhel/etc_init.d_openvswitch @@ -62,6 +62,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) @@ -71,8 +80,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 48fc174..d4a056d 100755 --- a/xenserver/etc_init.d_openvswitch +++ b/xenserver/etc_init.d_openvswitch @@ -109,6 +109,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) @@ -118,8 +128,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. -- 1.7.9.5 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev