From: Jiri Pirko jiri@mellanox.com
Similar to default RPC port on controller side, allow user to configure RPC port on the slave.
Signed-off-by: Jiri Pirko jiri@mellanox.com --- lnst-slave | 8 ++++---- lnst/Common/Config.py | 5 +++++ lnst/Slave/NetTestSlave.py | 4 +++- 3 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/lnst-slave b/lnst-slave index a91df1b..93856c2 100755 --- a/lnst-slave +++ b/lnst-slave @@ -88,10 +88,10 @@ def main(): colours=coloured_output) logging.info("Started")
- if port: - nettestslave = NetTestSlave(log_ctl, port=port) - else: - nettestslave = NetTestSlave(log_ctl) + if port != None: + lnst_config.set_option("environment", "rpcport", port) + + nettestslave = NetTestSlave(log_ctl)
if daemon: daemon = Daemon(pidfile) diff --git a/lnst/Common/Config.py b/lnst/Common/Config.py index ddaa508..97a82e4 100644 --- a/lnst/Common/Config.py +++ b/lnst/Common/Config.py @@ -112,6 +112,11 @@ class Config(): "additive" : False, "action" : self.optionBool, "name" : "use_nm"} + self._options['environment']['rpcport'] = {\ + "value" : DefaultRPCPort, + "additive" : False, + "action" : self.optionPort, + "name" : "rpcport"}
self._options['cache'] = dict() self._options['cache']['dir'] = {\ diff --git a/lnst/Slave/NetTestSlave.py b/lnst/Slave/NetTestSlave.py index dc58e1c..d65db5a 100644 --- a/lnst/Slave/NetTestSlave.py +++ b/lnst/Slave/NetTestSlave.py @@ -849,10 +849,12 @@ class ServerHandler(ConnectionHandler): self._netns_con_mapping = {}
class NetTestSlave: - def __init__(self, log_ctl, port = DefaultRPCPort): + def __init__(self, log_ctl): die_when_parent_die()
self._cmd_context = NetTestCommandContext() + port = lnst_config.get_option("environment", "rpcport") + logging.info("Using RPC port %d." % port) self._server_handler = ServerHandler(("", port)) self._if_manager = InterfaceManager(self._server_handler)
lnst-developers@lists.fedorahosted.org