From: Ondrej Lichtner <olichtne(a)redhat.com>
When the lnst-slave process forks, the parent process should wait for
the result returned by rest of the add_namespace method. Otherwise 2
result messages are created, which could cause the Ctl <-> Slave message
lock-step to be desynchronized and cause race condition issues.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
---
lnst/Slave/NetTestSlave.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lnst/Slave/NetTestSlave.py b/lnst/Slave/NetTestSlave.py
index 8e26b4b..f11ca8b 100644
--- a/lnst/Slave/NetTestSlave.py
+++ b/lnst/Slave/NetTestSlave.py
@@ -670,7 +670,8 @@ class SlaveMethods:
self._net_namespaces[netns] = {"pid": pid,
"pipe": read_pipe}
self._server_handler.add_netns(netns, read_pipe)
- return False
+ result = self._slave_server.wait_for_result(netns)
+ return result["result"]
elif pid == 0:
self._slave_server.set_netns_sighandlers()
#create new network namespace
--
2.11.0