From: Ondrej Lichtner <olichtne(a)redhat.com>
Due to how the Ctl-Slave communication currently works, returning None
from a Slave Method is not possible - the main Slave loop doesn't resend
this to the Ctl, resulting in the Ctl waiting forever. This is due to
how background and foreground commands work - background command
immediately returns "passed" (meaning started) whereas a forground
command at first returns None, the command then runs in a forked process
and then returns the command results - meanwhile the Ctl is waiting
because it didn't get the "return None" message.
So returning None is fine as long as a different result message is
generated and returned later, currently that only happens in the
run_command method and the others are now fixed by this commit.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
---
lnst/Slave/NetTestSlave.py | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/lnst/Slave/NetTestSlave.py b/lnst/Slave/NetTestSlave.py
index de65d91..956ce1d 100644
--- a/lnst/Slave/NetTestSlave.py
+++ b/lnst/Slave/NetTestSlave.py
@@ -147,7 +147,7 @@ class SlaveMethods:
if device:
return device.get_if_data()
else:
- return None
+ return {}
def get_devices_by_devname(self, devname):
name_scan = self._if_manager.get_devices()
@@ -190,14 +190,14 @@ class SlaveMethods:
def get_if_data(self, if_id):
dev = self._if_manager.get_mapped_device(if_id)
if dev is None:
- return None
+ return {}
return dev.get_if_data()
def link_stats(self, if_id):
dev = self._if_manager.get_mapped_device(if_id)
if dev is None:
logging.error("Device with id '%s' not found." % if_id)
- return None
+ return {}
return dev.link_stats()
def set_addresses(self, if_id, ips):
@@ -670,7 +670,7 @@ class SlaveMethods:
self._net_namespaces[netns] = {"pid": pid,
"pipe": read_pipe}
self._server_handler.add_netns(netns, read_pipe)
- return None
+ return False
elif pid == 0:
self._slave_server.set_netns_sighandlers()
#create new network namespace
--
2.10.0