• Pedro Tammela's avatar
    selftests: tc-testing: rework namespaces and devices setup · fa63d353
    Pedro Tammela authored
    As mentioned in the TC Workshop 0x17, our recent changes to tdc broke
    downstream CI systems like tuxsuite. The issue is the classic problem
    with rcu/workqueue objects where you can miss them if not enough wall time
    has passed. The latter is subjective to the system and kernel config,
    in my machine could be nanoseconds while in another could be microseconds
    or more.
    
    In order to make the suite deterministic, poll for the existence
    of the objects in a reasonable manner. Talking netlink directly is the
    the best solution in order to avoid paying the cost of multiple
    'fork()' calls, so introduce a netlink based setup routine using
    pyroute2. We leave the iproute2 one as a fallback when pyroute2 is not
    available.
    
    Also rework the iproute2 side to mimic the netlink routine where it
    creates DEV0 as the peer of DEV1 and moves DEV1 into the net namespace.
    This way when the namespace is deleted DEV0 is also deleted
    automatically, leaving no margin for resource leaks.
    
    Another bonus of this change is that our setup time sped up by a factor
    of 2 when using netlink.
    Signed-off-by: default avatarPedro Tammela <pctammela@mojatatu.com>
    Reviewed-by: default avatarSimon Horman <horms@kernel.org>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    fa63d353
nsPlugin.py 7.77 KB