[ovs-dev] [PATCH] ovn-ctl: Handle whitespaces when using eval for start_ovsdb:

Ben Pfaff blp at ovn.org
Wed Apr 25 19:54:26 UTC 2018


On Thu, Apr 12, 2018 at 03:40:33PM -0700, aginwala wrote:
> eval doesn't understand white spaces which was introduced in commit
> 79c7961b8b3c4b7ea0251dea2ffacfa84c84fecb for starting clustered ovn dbs
> 
> Hence, we need to explicitely handle it.
> e.g. /usr/share/openvswitch/scripts/ovn-ctl --db-nb-addr=192.168.220.101 --db-nb-create-insecure-remote=yes \
>     --db-sb-addr=192.168.220.101 --db-sb-create-insecure-remote=yes \
>     --db-nb-cluster-local-addr=192.168.220.101 \
>     --db-sb-cluster-local-addr=192.168.220.101 \
>     --ovn-northd-nb-db=tcp:192.168.220.101:6641,tcp:192.168.220.102:6641,tcp:192.168.220.103:6641 \
>     --ovn-northd-sb-db=tcp:192.168.220.101:6642,tcp:192.168.220.102:6642,tcp:192.168.220.103:6642 \
>     start_northd
> 
> gives error: /usr/share/openvswitch/scripts/ovn-ctl: 1: local: -vfile:info: bad variable name
> As a result ovsdb failes to even initialize and start. This commit fixes the same.
> 
> Signed-off-by: aginwala <aginwala at ebay.com>
> ---
>  ovn/utilities/ovn-ctl | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/ovn/utilities/ovn-ctl b/ovn/utilities/ovn-ctl
> index 25dda52..9a1ad75 100755
> --- a/ovn/utilities/ovn-ctl
> +++ b/ovn/utilities/ovn-ctl
> @@ -409,8 +409,8 @@ set_defaults () {
>      OVN_CONTROLLER_LOG="-vconsole:emer -vsyslog:err -vfile:info"
>      OVN_NORTHD_LOG="-vconsole:emer -vsyslog:err -vfile:info"
>      OVN_NORTHD_LOGFILE=""
> -    OVN_NB_LOG="-vconsole:off -vfile:info"
> -    OVN_SB_LOG="-vconsole:off -vfile:info"
> +    OVN_NB_LOG='"-vconsole:off' '-vfile:info"'
> +    OVN_SB_LOG='"-vconsole:off' '-vfile:info"'
>      OVN_NB_LOGFILE="$logdir/ovsdb-server-nb.log"
>      OVN_SB_LOGFILE="$logdir/ovsdb-server-sb.log"

This doesn't make sense to me.  The line

    eval local log=\$OVN_${DB}_LOG

should parameter-expand to:

    eval local log=$OVN_SB_LOG

which should be executed as:

    local log=$OVN_SB_LOG

which should assign "-vconsole:off -vfile:info", without the double
quotes, to $log (since variable assignment in shell doesn't do word
splitting).

Then, later,

    set "$@" $log --log-file=$logfile

should do word splitting on $log.

Do you understand what is going on here?

Thanks,

Ben.


More information about the dev mailing list