On Fri, Apr 29, 2016 at 11:11 PM, William Tu <u9012...@gmail.com> wrote:

> This avoids error message "Cannot remove namespace file
> "/var/run/netns/at_ns0": No such file or directory",
> when at_ns0 does not exist.


> Signed-off-by: William Tu <u9012...@gmail.com>
> ---
>  tests/system-common-macros.at | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/tests/system-common-macros.at b/tests/system-common-macros.at
> index 2116f1e..ae09e83 100644
> --- a/tests/system-common-macros.at
> +++ b/tests/system-common-macros.at
> @@ -3,8 +3,10 @@
>  # Delete namespaces from the running OS
>  m4_define([DEL_NAMESPACES],
>     [m4_foreach([ns], [$@],
> -               [ip netns del ns
> -])
> +               [if ip netns list | grep ns > /dev/null; then
> +                   ip netns del ns
> +                fi
> +               ])
>     ]
>  )
>

Do we want to suppress an error on deletion in general ?

Is the problem wherein ADD_NAMESPACES tries to always remove
a namespace before adding it ?
Is it better to check if ns exists here before calling DEL_NAMESPACES ?


m4_define([ADD_NAMESPACES],
   [m4_foreach([ns], [$@],
               [DEL_NAMESPACES(ns)
                AT_CHECK([ip netns add ns || return 77])
                on_exit 'DEL_NAMESPACES(ns)'
               ])
   ]
)




>
> --
> 2.5.0
>
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev
>
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to