Support running a list of scripts after vswitchd start, so that we can make some runtime config persistence across ovs restart. For example, the config that `ovs-appctl dpctl` makes.
Signed-off-by: lic121 <[email protected]> --- Documentation/ref/ovs-ctl.8.rst | 9 +++++++++ NEWS | 2 ++ utilities/ovs-ctl.in | 11 +++++++++++ 3 files changed, 22 insertions(+) diff --git a/Documentation/ref/ovs-ctl.8.rst b/Documentation/ref/ovs-ctl.8.rst index 7cfc413..380ef06 100644 --- a/Documentation/ref/ovs-ctl.8.rst +++ b/Documentation/ref/ovs-ctl.8.rst @@ -37,6 +37,15 @@ system administrators but to be called internally by system startup scripts. +Ovs has a lot of runtime configurations which can't survive from +service restart. For example, the vlog level config, dpctl/set +config and flows. To persistent runtime configurations, we now +support running a list of scripts after vswitchd process. Just +put your scripts under ``etcdir/post_scripts_vswitchd/`` and with +``.sh`` suffix, ovs-ctl start/restart will auto execute your +scripts one by one. + + Each ``ovs-ctl`` command is described separately below. The ``start`` command diff --git a/NEWS b/NEWS index 024fa44..9387d37 100644 --- a/NEWS +++ b/NEWS @@ -81,6 +81,8 @@ v3.0.0 - xx xxx xxxx - Linux TC offload: * Add support for offloading meters via tc police. * Add support for offloading the check_pkt_len action. + - ovs-ctl: + * Support ovs post start scripts - New configuration knob 'other_config:all-members-active' for balance-slb bonds. - Previously deprecated Linux kernel module is now fully removed from diff --git a/utilities/ovs-ctl.in b/utilities/ovs-ctl.in index e6e07f4..a765ef3 100644 --- a/utilities/ovs-ctl.in +++ b/utilities/ovs-ctl.in @@ -226,9 +226,18 @@ do_start_forwarding () { fi } +run_post_start_scripts () { + mkdir -p $POST_SCRIPTS_DIR_VSWITCHD + for f in `ls $POST_SCRIPTS_DIR_VSWITCHD/*.sh 2>/dev/null|| true` + do + action "Running post script $f" bash $f + done +} + start_forwarding () { if test X"$OVS_VSWITCHD" = Xyes; then do_start_forwarding || return 1 + run_post_start_scripts || return 1 fi if test X"$RECORD_HOSTNAME" = Xyes; then set_hostname & @@ -348,6 +357,8 @@ set_defaults () { DB_SCHEMA=$datadir/vswitch.ovsschema EXTRA_DBS= + POST_SCRIPTS_DIR_VSWITCHD=$etcdir/post_scripts_vswitchd + PROTOCOL=gre DPORT= SPORT= -- 1.8.3.1 _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
