The ovs-ctl script is used to launch ovs-vswitchd among other things. However it does not make it possible to pass DPDK options to the daemon. We fix this by explicitly looking and extracting the DPDK options from the command line which is then reconstructed so it can be parsed by ovs-ctl as usual. The DPDK options are later passed to ovs-vswitchd.
Signed-off-by: Markos Chandras <mchand...@suse.de> --- utilities/ovs-ctl.in | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/utilities/ovs-ctl.in b/utilities/ovs-ctl.in index 8ec825b..b4e7bf1 100755 --- a/utilities/ovs-ctl.in +++ b/utilities/ovs-ctl.in @@ -230,7 +230,12 @@ do_start_forwarding () { fi # Start ovs-vswitchd. - set ovs-vswitchd unix:"$DB_SOCK" + set ovs-vswitchd + # DPDK options are expected to be at the beginning of + # the command line arguments. Add '--' to mark the end + # of the DPDK options. + [ -n "$DPDK_OPTS" ] && set -- "$@" $DPDK_OPTS "--" + set "$@" unix:"$DB_SOCK" set "$@" -vconsole:emer -vsyslog:err -vfile:info if test X"$MLOCKALL" != Xno; then set "$@" --mlockall @@ -485,6 +490,25 @@ enable_protocol () { fi } +## ------------------ ## +## parse-dpdk-cmdline ## +## ------------------ ## +parse_dpdk_cmdline () { + echo "${@}" | grep -q -- "--dpdk" || return + + # The DPDK options can be passed anywhere on the command line when + # calling the ovs-ctl script so find out where they are. + if echo "${@}" | grep -q " -- "; then + # end of command line options found + DPDK_OPTS="$(echo ${@} | sed 's/^.*\(--dpdk.*\)\s* -- .*$/\1/')" + cmdline_args="$(echo ${@} | sed 's/\(^.*\)\(--dpdk.*\)\s* -- \(.*$\)/\1\3/')" + else + # no end of command line options found. DPDK options will be at the end + DPDK_OPTS="$(echo ${@} | sed 's/^.*\(--dpdk.*$\)/\1/')" + cmdline_args="$(echo ${@} | sed 's/\(^.*\)\(--dpdk.*$\)/\1/')" + fi +} + ## ---- ## ## main ## ## ---- ## @@ -530,13 +554,15 @@ set_defaults () { SYSTEM_TYPE=unknown SYSTEM_VERSION=unknown fi + + DPDK_OPTS= } usage () { set_defaults cat <<EOF $0: controls Open vSwitch daemons -usage: $0 [OPTIONS] COMMAND +usage: $0 [[OVS_VSWITCHD DPDK OPTIONS] --] [OPTIONS] COMMAND This program is intended to be invoked internally by Open vSwitch startup scripts. System administrators should not normally invoke it directly. @@ -624,7 +650,11 @@ daemons () { set_defaults extra_ids= +cmdline_args="${@}" command= +parse_dpdk_cmdline "${cmdline_args}" +set -- ${cmdline_args} + for arg do case $arg in -- 2.8.4 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev