Skip to content

Commit

Permalink
Allow arbitrary args to be passed to called binary
Browse files Browse the repository at this point in the history
It is common to pass ovn-ctl options via an /etc/sysconfig file.
It would be useful to be able to pass custom --remote options or
additional DBs to listen to via this file. This would give end
users the ability to have more fine-grained control without
having to modify ovn-ctl.

Signed-off-by: Terry Wilson <twilson@redhat.com>
Acked-by: Dumitru Ceara <dceara@redhat.com>
Signed-off-by: Mark Michelson <mmichels@redhat.com>
  • Loading branch information
otherwiseguy authored and putnopvut committed Jun 28, 2022
1 parent 8423d02 commit b1d6d92
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
22 changes: 22 additions & 0 deletions utilities/ovn-ctl
Expand Up @@ -311,6 +311,10 @@ $cluster_remote_port
set "$@" --sync-from=`cat $active_conf_file`
fi

if test X"$extra_args" != X; then
set "$@" $extra_args
fi

local run_ovsdb_in_bg="no"
local process_id=
if test X$detach = Xno && test $mode = cluster && test -z "$cluster_remote_addr" ; then
Expand Down Expand Up @@ -538,6 +542,10 @@ start_ic () {

set "$@" $OVN_IC_LOG $ovn_ic_params

if test X"$extra_args" != X; then
set "$@" $extra_args
fi

OVS_RUNDIR=${OVS_RUNDIR} start_ovn_daemon "$OVN_IC_PRIORITY" "$OVN_IC_WRAPPER" "$@"
fi
}
Expand All @@ -560,6 +568,10 @@ start_controller () {

[ "$OVN_USER" != "" ] && set "$@" --user "$OVN_USER"

if test X"$extra_args" != X; then
set "$@" $extra_args
fi

OVS_RUNDIR=${OVS_RUNDIR} start_ovn_daemon "$OVN_CONTROLLER_PRIORITY" "$OVN_CONTROLLER_WRAPPER" "$@"
}

Expand Down Expand Up @@ -587,6 +599,10 @@ start_controller_vtep () {

[ "$OVN_USER" != "" ] && set "$@" --user "$OVN_USER"

if test X"$extra_args" != X; then
set "$@" $extra_args
fi

OVS_RUNDIR=${OVS_RUNDIR} start_ovn_daemon "$OVN_CONTROLLER_PRIORITY" "$OVN_CONTROLLER_WRAPPER" "$@"
}

Expand Down Expand Up @@ -1101,8 +1117,10 @@ EOF

set_defaults
command=
extra_args=
for arg
do
shift
case $arg in
-h | --help)
usage
Expand All @@ -1125,6 +1143,10 @@ do
type=bool
set_option
;;
--)
extra_args=$@
break
;;
-*)
echo >&2 "$0: unknown option \"$arg\" (use --help for help)"
exit 1
Expand Down
14 changes: 13 additions & 1 deletion utilities/ovn-ctl.8.xml
Expand Up @@ -4,7 +4,10 @@
<p>ovn-ctl -- Open Virtual Network northbound daemon lifecycle utility</p>

<h1>Synopsis</h1>
<p><code>ovn-ctl</code> [<var>options</var>] <var>command</var></p>
<p>
<code>ovn-ctl</code> [<var>options</var>] <var>command</var>
[--- <var>extra_args</var>]
</p>

<h1>Description</h1>
<p>This program is intended to be invoked internally by Open Virtual Network
Expand Down Expand Up @@ -156,6 +159,15 @@
<p><code>--db-nb-probe-interval-to-active=<var>Time in milliseconds</var></code></p>
<p><code>--db-sb-probe-interval-to-active=<var>Time in milliseconds</var></code></p>

<h1> Extra Options </h1>
<p>
Any options after '--' will be passed on to the binary run by
<var>command</var> with the exception of start_northd, which can have
options specified in ovn-northd-db-params.conf. Any <var>extra_args</var>
passed to start_northd will be passed to the ovsdb-servers if
<code>--ovn-manage-ovsdb=yes</code>
</p>

<h1>Configuration files</h1>
<p>Following are the optional configuration files. If present, it should be located in the etc dir</p>

Expand Down

0 comments on commit b1d6d92

Please sign in to comment.