[lnst trac] #50: Wiki article: How to Structure LNST Recipes
by fedora-badges
#50: Wiki article: How to Structure LNST Recipes
----------------------+------------------------------------------
Reporter: rpazdera | Owner:
Type: task | Status: new
Priority: major | Milestone: Complete Wiki Documentation
Component: wiki | Version:
Keywords: | Blocked By:
Blocking: |
----------------------+------------------------------------------
This article should cover everything about lnst recipe creation from a
point of view of an inexperienced LNST user.
It should be easy to understand and not too technical. It doesn't have to
cover the topic completely, but it should give enough information for a
newcomer.
This article should incorporate the topic in the 4th section of the LNST
Intro document.
--
Ticket URL: <https://fedorahosted.org/lnst/ticket/50>
lnst <https://fedorahosted.org/lnst/>
Linux Network Stack Test
10 years, 7 months
[lnst trac] #52: Wiki article: Machine Config XML Reference
by fedora-badges
#52: Wiki article: Machine Config XML Reference
----------------------+------------------------------------------
Reporter: rpazdera | Owner:
Type: task | Status: new
Priority: major | Milestone: Complete Wiki Documentation
Component: wiki | Version:
Keywords: | Blocked By:
Blocking: |
----------------------+------------------------------------------
There should be a separate reference for the XML format of machine configs
that belong to a pool directory. It should be a brief enumeration of
values for advanced users (the guide for beginners will be placed
separately).
--
Ticket URL: <https://fedorahosted.org/lnst/ticket/52>
lnst <https://fedorahosted.org/lnst/>
Linux Network Stack Test
10 years, 7 months
[PATCH] Fix slave options handling
by Jan Tluka
The patch fixes crash of lnst-slave when options are specified for an
enslaved device.
Signed-off-by: Jan Tluka <jtluka(a)redhat.com>
---
lnst/Controller/Machine.py | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/lnst/Controller/Machine.py b/lnst/Controller/Machine.py
index 5876347..96a0faa 100644
--- a/lnst/Controller/Machine.py
+++ b/lnst/Controller/Machine.py
@@ -375,7 +375,9 @@ class Interface(object):
self._slaves[iface.get_id()] = iface
def set_slave_option(self, slave_id, name, value):
- self._slave_options[slave_id] = (name, value)
+ if slave_id not in self._slave_options:
+ self._slave_options[slave_id] = []
+ self._slave_options[slave_id].append((name, value))
def add_address(self, addr):
self._addresses.append(addr)
--
1.8.1.4
10 years, 7 months
[PATCH] Remove NetConfigDeviceAllCleanup from machine cleanup
by Jan Tluka
NetConfigDeviceAllCleanup would clean the system from netdevice modules
even if they had not been configured at all. This can break a setup with
virt guest running on a host system both acting as lnst slaves and using
bridge netdevice driver.
Signed-off-by: Jan Tluka <jtluka(a)redhat.com>
---
lnst/Slave/NetTestSlave.py | 2 --
1 file changed, 2 deletions(-)
diff --git a/lnst/Slave/NetTestSlave.py b/lnst/Slave/NetTestSlave.py
index 75fa7ab..0f17839 100644
--- a/lnst/Slave/NetTestSlave.py
+++ b/lnst/Slave/NetTestSlave.py
@@ -31,7 +31,6 @@ from lnst.Common.ResourceCache import ResourceCache
from lnst.Common.NetTestCommand import NetTestCommandContext
from lnst.Common.NetTestCommand import CommandException, NetTestCommand
from lnst.Slave.NetConfig import NetConfig
-from lnst.Slave.NetConfigDevice import NetConfigDeviceAllCleanup
from lnst.Slave.NmConfigDevice import is_nm_managed_by_name
from lnst.Common.Utils import check_process_running
from lnst.Common.ConnectionHandler import recv_data, send_data
@@ -271,7 +270,6 @@ class SlaveMethods:
self._command_context.cleanup()
self._netconfig.deconfigure_all()
self._netconfig.cleanup()
- NetConfigDeviceAllCleanup()
self._cache.del_old_entries()
self.restore_system_config()
return True
--
1.8.1.4
10 years, 7 months
[lnst] NetTestSlave: ctl disconnect cleanup fix
by Jiří Pírko
commit d8dd651a0842f64f9bf5840ebd925042dab271c4
Author: Ondrej Lichtner <olichtne(a)redhat.com>
Date: Wed Aug 14 09:50:09 2013 +0200
NetTestSlave: ctl disconnect cleanup fix
Slaves were too good at cleaning up- the config_only run didn't work
because the slave would cleanup everything after the controller
disconnected.
This commit fixes that by slave cleaning up only when the controller
disconnected unexpectedly. This relies on the controller calling the bye
method before disconnecting.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
Signed-off-by: Jiri Pirko <jiri(a)resnulli.us>
lnst/Slave/NetTestSlave.py | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/lnst/Slave/NetTestSlave.py b/lnst/Slave/NetTestSlave.py
index 629ed88..75fa7ab 100644
--- a/lnst/Slave/NetTestSlave.py
+++ b/lnst/Slave/NetTestSlave.py
@@ -61,11 +61,14 @@ class SlaveMethods:
self._resource_table = {}
+ self.ctl_clean_exit = True
+
def hello(self, recipe_path):
logging.info("Recieved a controller connection.")
self.clear_resource_table()
self._cache.del_old_entries()
self.reset_file_transfers()
+ self.ctl_clean_exit = False
date = datetime.datetime.now().strftime("%Y-%m-%d_%H:%M:%S")
self._log_ctl.set_recipe(recipe_path, expand=date)
@@ -87,6 +90,7 @@ class SlaveMethods:
self._cache.del_old_entries()
self.reset_file_transfers()
self._remove_capture_files()
+ self.ctl_clean_exit = True
return "bye"
def kill_cmds(self):
@@ -435,8 +439,9 @@ class NetTestSlave:
while not self._finished:
if self._server_handler.get_ctl_sock() == None:
self._log_ctl.cancel_connection()
- if not self._start:
+ if not self._start and not self._methods.ctl_clean_exit:
self._methods.machine_cleanup()
+ self._methods.ctl_clean_exit = True
try:
logging.info("Waiting for connection.")
self._server_handler.accept_connection()
10 years, 7 months
[lnst] NetTestController: add detection of slave disconnect
by Jiří Pírko
commit 39d0a1f0421f0176fb4c3b3851f3b176c13d89f2
Author: Ondrej Lichtner <olichtne(a)redhat.com>
Date: Wed Aug 14 09:50:08 2013 +0200
NetTestController: add detection of slave disconnect
This commit adds detection of slaves being disconnected while the
controller is waiting for a response.
When this happens an Exception is raised resulting in the recipe failing
and remaining slaves being deconfigured.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
Signed-off-by: Jiri Pirko <jiri(a)resnulli.us>
lnst/Controller/Machine.py | 4 ++++
lnst/Controller/NetTestController.py | 12 ++++++++++++
2 files changed, 16 insertions(+), 0 deletions(-)
---
diff --git a/lnst/Controller/Machine.py b/lnst/Controller/Machine.py
index 76e35b5..5876347 100644
--- a/lnst/Controller/Machine.py
+++ b/lnst/Controller/Machine.py
@@ -148,6 +148,10 @@ class Machine(object):
if not self._configured:
return
+ #connection to the slave was closed
+ if not self._msg_dispatcher.get_connection(self._id):
+ return
+
self._rpc_call("kill_cmds")
if deconfigure:
diff --git a/lnst/Controller/NetTestController.py b/lnst/Controller/NetTestController.py
index a90a3dc..fee06ed 100644
--- a/lnst/Controller/NetTestController.py
+++ b/lnst/Controller/NetTestController.py
@@ -612,7 +612,12 @@ class MessageDispatcher(ConnectionHandler):
def wait_for_result(self, machine_id):
wait = True
while wait:
+ connected_slaves = self._connections.keys()
+
messages = self.check_connections()
+
+ remaining_slaves = self._connections.keys()
+
for msg in messages:
if msg[1]["type"] == "result" and msg[0] == machine_id:
wait = False
@@ -620,6 +625,13 @@ class MessageDispatcher(ConnectionHandler):
else:
self._process_message(msg)
+ if connected_slaves != remaining_slaves:
+ disconnected_slaves = set(connected_slaves) -\
+ set(remaining_slaves)
+ msg = "Slaves " + str(list(disconnected_slaves)) + \
+ " disconnected from the controller."
+ raise NetTestError(msg)
+
return result
def _process_message(self, message):
10 years, 7 months
[lnst] NetTestSlave: update of slave cleanup
by Jiří Pírko
commit 4b191254549b9730258c9cecf2073bc38c75e948
Author: Ondrej Lichtner <olichtne(a)redhat.com>
Date: Wed Aug 14 09:50:07 2013 +0200
NetTestSlave: update of slave cleanup
I didn't notice this before but we already had a method that did slave
cleanup. This commit makes a slight modification to the function and
makes use of it instead of calling the individual cleanup methods
themselves.
The cleanup process is now logged in DEBUG level, and I added detection
of server startup so that no cleanup happens when we didn't do anything
yet.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
Signed-off-by: Jiri Pirko <jiri(a)resnulli.us>
lnst/Common/NetTestCommand.py | 1 +
lnst/Slave/NetConfig.py | 1 +
lnst/Slave/NetConfigDevice.py | 1 +
lnst/Slave/NetTestSlave.py | 33 ++++++++++++++-------------------
4 files changed, 17 insertions(+), 19 deletions(-)
---
diff --git a/lnst/Common/NetTestCommand.py b/lnst/Common/NetTestCommand.py
index 08228d9..1d50c7c 100644
--- a/lnst/Common/NetTestCommand.py
+++ b/lnst/Common/NetTestCommand.py
@@ -218,6 +218,7 @@ class NetTestCommandContext:
self._dict[id].kill()
def cleanup(self):
+ logging.debug("Cleaning up leftover processes.")
self._kill_all_cmds()
self._dict = {}
diff --git a/lnst/Slave/NetConfig.py b/lnst/Slave/NetConfig.py
index cbb8487..f622848 100644
--- a/lnst/Slave/NetConfig.py
+++ b/lnst/Slave/NetConfig.py
@@ -104,6 +104,7 @@ class NetConfig:
device.deconfigure()
def deconfigure_all(self):
+ logging.debug("Deconfiguring interfaces.")
dev_order = self._get_dev_order()
for dev_id in reversed(dev_order):
self.deconfigure(dev_id)
diff --git a/lnst/Slave/NetConfigDevice.py b/lnst/Slave/NetConfigDevice.py
index 91dce5e..53e89b2 100644
--- a/lnst/Slave/NetConfigDevice.py
+++ b/lnst/Slave/NetConfigDevice.py
@@ -313,6 +313,7 @@ def NetConfigDeviceType(netdev, config):
return type_class_mapping[netdev["type"]]
def NetConfigDeviceAllCleanup():
+ logging.debug("Performing interface type cleanup.")
if check_process_running("NetworkManager") and \
lnst_config.get_option("environment", "use_nm"):
for dev_type in nm_type_class_mapping:
diff --git a/lnst/Slave/NetTestSlave.py b/lnst/Slave/NetTestSlave.py
index a3d7e66..629ed88 100644
--- a/lnst/Slave/NetTestSlave.py
+++ b/lnst/Slave/NetTestSlave.py
@@ -45,9 +45,9 @@ class SlaveMethods:
'''
Exported xmlrpc methods
'''
- def __init__(self, command_context, netconfig, log_ctl):
+ def __init__(self, command_context, log_ctl):
self._packet_captures = {}
- self._netconfig = netconfig
+ self._netconfig = NetConfig()
self._command_context = command_context
self._log_ctl = log_ctl
@@ -263,9 +263,11 @@ class SlaveMethods:
return True
def machine_cleanup(self):
- NetConfigDeviceAllCleanup()
- self._netconfig.cleanup()
+ logging.info("Performing machine cleanup.")
self._command_context.cleanup()
+ self._netconfig.deconfigure_all()
+ self._netconfig.cleanup()
+ NetConfigDeviceAllCleanup()
self._cache.del_old_entries()
self.restore_system_config()
return True
@@ -415,9 +417,7 @@ class NetTestSlave:
die_when_parent_die()
self._cmd_context = NetTestCommandContext()
- self._netconfig = NetConfig()
- self._methods = SlaveMethods(self._cmd_context, self._netconfig,
- log_ctl)
+ self._methods = SlaveMethods(self._cmd_context, log_ctl)
self.register_die_signal(signal.SIGHUP)
self.register_die_signal(signal.SIGINT)
@@ -429,21 +429,20 @@ class NetTestSlave:
self._log_ctl = log_ctl
+ self._start = True
+
def run(self):
while not self._finished:
if self._server_handler.get_ctl_sock() == None:
self._log_ctl.cancel_connection()
- logging.info("Waiting for connection, performing cleanup.")
- logging.info("Cleaning up leftover commands.")
- self._cmd_context.cleanup()
- logging.info("Cleaning up configured interfaces.")
- self._netconfig.deconfigure_all()
- self._netconfig.cleanup()
+ if not self._start:
+ self._methods.machine_cleanup()
try:
+ logging.info("Waiting for connection.")
self._server_handler.accept_connection()
+ self._start = False
except socket.error:
continue
- self._cmd_context.cleanup()
self._log_ctl.set_connection(
self._server_handler.get_ctl_sock())
@@ -452,11 +451,7 @@ class NetTestSlave:
for msg in msgs:
self._process_msg(msg[1])
- logging.info("Cleaning up leftover commands.")
- self._cmd_context.cleanup()
- logging.info("Cleaning up configured interfaces.")
- self._netconfig.deconfigure_all()
- self._netconfig.cleanup()
+ self._methods.machine_cleanup()
def _process_msg(self, msg):
if msg["type"] == "command":
10 years, 7 months