[PATCH 1/2] NetTestSlave: fix restoration of system configuration
Jiri Pirko
jpirko at redhat.com
Fri May 31 11:35:24 UTC 2013
Fri, May 31, 2013 at 01:15:41PM CEST, olichtne at redhat.com wrote:
>From: Ondrej Lichtner <olichtne at redhat.com>
>
>When the NetTestController code was refactored and several methods were
>moved to the new class Machine, part of the code of run_command was
>forgotten.
>
>The system configuration data was moved to be stored in the slave
>application, however for that the method _update_system_config has to be
>called and that wasn't happening.
>
>This commit fixes that. The fix also changes the behaviour of the
>system_config command- it will not be running in the background anymore,
>instead it is run in the main lnst-slave application, just like the
>wait/intr/kill commands.
>
>Signed-off-by: Ondrej Lichtner <olichtne at redhat.com>
>---
> lnst/Common/NetTestCommand.py | 5 +++--
> lnst/Slave/NetTestSlave.py | 11 +++++++++++
> 2 files changed, 14 insertions(+), 2 deletions(-)
>
>diff --git a/lnst/Common/NetTestCommand.py b/lnst/Common/NetTestCommand.py
>index 527764e..8dc9562 100644
>--- a/lnst/Common/NetTestCommand.py
>+++ b/lnst/Common/NetTestCommand.py
>@@ -80,7 +80,8 @@ class NetTestCommand:
> return self._finished
>
> def run(self):
>- if isinstance(self._cmd_cls, NetTestCommandControl):
>+ if isinstance(self._cmd_cls, NetTestCommandControl) or \
>+ isinstance(self._cmd_cls, NetTestCommandSystemConfig):
> return self._cmd_cls.run()
>
> self._read_pipe, self._write_pipe = multiprocessing.Pipe()
>@@ -321,7 +322,7 @@ class NetTestCommandSystemConfig(NetTestCommandGeneric):
>
> res = {"passed": True}
> res["res_data"] = res_data
>- self.set_result(res)
>+ return res
>
> class NetTestCommandControl(NetTestCommandGeneric):
> def __init__(self, command_context, command):
>diff --git a/lnst/Slave/NetTestSlave.py b/lnst/Slave/NetTestSlave.py
>index 9b39c0a..d2dd484 100644
>--- a/lnst/Slave/NetTestSlave.py
>+++ b/lnst/Slave/NetTestSlave.py
>@@ -207,6 +207,7 @@ class SlaveMethods:
> logging.warn("Unable to restore '%s' config option!", option)
> return False
>
>+ self._system_config = {}
> return True
>
> def run_command(self, command):
>@@ -218,6 +219,16 @@ class SlaveMethods:
> res = cmd.run()
> if not cmd.forked():
> self._command_context.del_cmd(cmd)
>+
>+ if command["type"] == "system_config":
>+ if res["passed"]:
>+ self._update_system_config(res["res_data"]["options"],
>+ command["persistent"])
>+ else:
>+ err = "Error occured while setting system "\
>+ "configuration (%s)" % res["err_msg"]
>+ logging.error(err)
>+
> return res
> except:
> log_exc_traceback()
>--
>1.8.1.4
>
>_______________________________________________
>LNST-developers mailing list
>LNST-developers at lists.fedorahosted.org
>https://lists.fedorahosted.org/mailman/listinfo/lnst-developers
both applied. Thanks
More information about the LNST-developers
mailing list