[ovs-dev] [PATCH] system-traffic: Check namespace exists befoe delete.

William Tu u9012063 at gmail.com
Mon May 2 15:39:51 UTC 2016


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.


> 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



More information about the dev mailing list