Info log does not contain any information about network namespace used for command. This patch appends netns information.
Signed-off-by: Jan Tluka jtluka@redhat.com --- lnst/Common/NetTestCommand.py | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/lnst/Common/NetTestCommand.py b/lnst/Common/NetTestCommand.py index 1e404bf..0ce8998 100644 --- a/lnst/Common/NetTestCommand.py +++ b/lnst/Common/NetTestCommand.py @@ -59,6 +59,9 @@ def str_command(command): else: raise RuntimeError("Unknown command type '%s'" % command["type"])
+ if "netns" in command: + attrs.append("netns(%s)" % command["netns"]) + return ", ".join(attrs)
class CommandException(Exception):
If a user runs a command in a namespace that has not been defined previously the slave would crash with an exception. This patch handles exception raised from calls to a network namespace and reports it back to controller.
Fixes #135
Signed-off-by: Jan Tluka jtluka@redhat.com --- lnst/Slave/NetTestSlave.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/lnst/Slave/NetTestSlave.py b/lnst/Slave/NetTestSlave.py index 36a43b9..a725a62 100644 --- a/lnst/Slave/NetTestSlave.py +++ b/lnst/Slave/NetTestSlave.py @@ -718,7 +718,7 @@ class ServerHandler(ConnectionHandler):
def send_data_to_netns(self, netns, data): if netns not in self._netns_con_mapping: - raise Exception("No such namespace!") + raise Exception("No network namespace '%s'!" % netns) else: netns_con = self._netns_con_mapping[netns] return send_data(netns_con, data) @@ -869,7 +869,17 @@ class NetTestSlave: self._server_handler.send_data_to_ctl(msg["data"]) elif msg["type"] == "to_netns": netns = msg["netns"] - self._server_handler.send_data_to_netns(netns, msg["data"]) + try: + self._server_handler.send_data_to_netns(netns, msg["data"]) + except: + log_exc_traceback() + type, value, tb = sys.exc_info() + exc_trace = ''.join(traceback.format_exception(type, + value, tb)) + response = {"type": "exception", "Exception": value} + + self._server_handler.send_data_to_ctl(response) + return else: raise Exception("Recieved unknown command")
On Fri, Jul 24, 2015 at 07:06:14PM +0200, Jan Tluka wrote:
If a user runs a command in a namespace that has not been defined previously the slave would crash with an exception. This patch handles exception raised from calls to a network namespace and reports it back to controller.
Fixes #135
Signed-off-by: Jan Tluka jtluka@redhat.com
Acked-by: Ondrej Lichtner olichtne@redhat.com
On Fri, Jul 24, 2015 at 07:06:13PM +0200, Jan Tluka wrote:
Info log does not contain any information about network namespace used for command. This patch appends netns information.
Signed-off-by: Jan Tluka jtluka@redhat.com
Acked-by: Ondrej Lichtner olichtne@redhat.com
lnst-developers@lists.fedorahosted.org