On Mon, May 2, 2016 at 8:39 AM, William Tu <u9012...@gmail.com> wrote:

> Hi Darrel,
>
>  # 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 ?
>>
>>
> No, I think it won't suppress errors on deletion.
>


Just to be clear, what the comment means is that if:
1) DEL_NAMESPACE is called and there is no such ns, then this may be an
error with the surrounding code (i.e. a bug) or maybe the test itself.

2) Hence the above code in DEL_NAMESPACE would make the bug less
visible since there would be no visible complaint on trying to delete a ns
that does not exist





>
>
>> Is the problem wherein ADD_NAMESPACES tries to always remove
>> a namespace before adding it ?
>>
>
> Yes.
>
>
>> Is it better to check if ns exists here before calling DEL_NAMESPACES ?
>>
>>
>>
> yes we could also add check here:
>
>
>> m4_define([ADD_NAMESPACES],
>>    [m4_foreach([ns], [$@],
>>
> -               [DEL_NAMESPACES(ns)
>>
>  +                  [ //check if ns exists
>
>>                 AT_CHECK([ip netns add ns || return 77])
>>                 on_exit 'DEL_NAMESPACES(ns)'
>>                ])
>>    ]
>> )
>>
>> Regards,
> William
>
>
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to