[lnst] fix mans
by Jiří Pírko
commit 600dd723675eddeb8e68ab6da0275253efed31d1
Author: Jiri Pirko <jiri(a)resnulli.us>
Date: Wed Sep 18 15:56:08 2013 +0200
fix mans
Signed-off-by: Jiri Pirko <jiri(a)resnulli.us>
install/lnst-ctl.1.in | 3 ++-
install/lnst-slave.1.in | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/install/lnst-ctl.1.in b/install/lnst-ctl.1.in
index fd5c64b..61efe05 100644
--- a/install/lnst-ctl.1.in
+++ b/install/lnst-ctl.1.in
@@ -116,8 +116,9 @@ Project Homepage: http://lnst-project.org/
Online Documentation: https://github.com/jpirko/lnst/wiki#learn
.br
Git Source Tree: https://github.com/jpirko/lnst
+.br
+Mailing List: <lnst-developers(a)lists.fedorahosted.org>
-Mailing List: <lnst-developers(a)lists.fedorahosted.org>
.SH AUTHORS
\fBJiri Pirko\fR <jpirko(a)redhat.com>
.br
diff --git a/install/lnst-slave.1.in b/install/lnst-slave.1.in
index ebaa1eb..8bce9f0 100644
--- a/install/lnst-slave.1.in
+++ b/install/lnst-slave.1.in
@@ -82,8 +82,9 @@ Project Homepage: http://lnst-project.org/
Online Documentation: https://github.com/jpirko/lnst/wiki#learn
.br
Git Source Tree: https://github.com/jpirko/lnst
+.br
+Mailing List: <lnst-developers(a)lists.fedorahosted.org>
-Mailing List: <lnst-developers(a)lists.fedorahosted.org>
.SH AUTHORS
\fBJiri Pirko\fR <jpirko(a)redhat.com>
.br
9 years, 6 months
[PATCH] remove generate-recipes.sh
by Ondrej Lichtner
From: Ondrej Lichtner <olichtne(a)redhat.com>
file no longer needed as it was replaced by the generate-recipes.py file
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
---
recipes/smoke/generate-recipes.sh | 62 ---------------------------------------
1 file changed, 62 deletions(-)
delete mode 100755 recipes/smoke/generate-recipes.sh
diff --git a/recipes/smoke/generate-recipes.sh b/recipes/smoke/generate-recipes.sh
deleted file mode 100755
index d9a4e6f..0000000
--- a/recipes/smoke/generate-recipes.sh
+++ /dev/null
@@ -1,62 +0,0 @@
-#!/bin/bash
-
-# LNST Smoke Tests
-# Author: Radek Pazdera <rpazdera(a)redhat.com>
-# License: GNU GPLv2
-
-# This script will generate a set of recipes for assessing the very basic
-# functionality of LNST.
-
-DIR="tests/"
-LIB="../lib"
-
-echo "[LNST Smoke Tests]"
-
-echo -n "Creating '$DIR' directory for the recipes..."
-mkdir -p $DIR
-cd $DIR
-echo -e "[DONE]"
-
-sequences=""
-for seq in `ls -1 $LIB/seq-*`; do
- echo "Found command sequence $seq"
- sequences="$sequences\n <command_sequence source=\"$seq\"/>"
-done
-
-CONF_FILES=`ls -1 $LIB/conf-*`
-for conf in $CONF_FILES; do
- echo "Found configuration $conf"
-done
-
-for machine1 in $CONF_FILES; do
- for machine2 in $CONF_FILES; do
- name1=`echo -n "$machine1" | head -c -4 | cut -c 13-`
- name2=`echo -n "$machine2" | head -c -4 | cut -c 13-`
- recipe_name="recipe-$name1-$name2.xml"
- echo -ne "Generating $DIR$recipe_name..."
- cat "$LIB/recipe-temp.xml" | \
- sed "s|#CONF1#|$machine1|g" | \
- sed "s|#CONF2#|$machine2|g" | \
- sed "s|#SEQUENCES#|$sequences|g" > "$recipe_name"
-
- echo -e "[DONE]"
- done
-done
-
-echo ""
-
-echo "To run these recipes, you need to have a pool prepared with at"
-echo "least two machines. Both of them must have at least two test"
-echo "interfaces connected to the same network segment."
-
-echo ""
-
-echo " +-----------+ +--------+ +-----------+"
-echo " | |----------| |----------| |"
-echo " | Machine | | Switch | | Machine |"
-echo " | 1 |----------| |----------| 2 |"
-echo " | | +--------+ | |"
-echo " +-----------+ +-----------+"
-
-echo -e "\nYou can execute the set using the following command:"
-echo " ./lnst-ctl -d recipes/smoke/tests/ run"
--
1.8.3.1
9 years, 6 months
[lnst] Fix nested xinclude element bug
by Jiří Pírko
commit 3cd14bcc45b0bb3b371e45d8fc5568aae1528b10
Author: Jan Tluka <jtluka(a)redhat.com>
Date: Tue Sep 17 19:36:23 2013 +0200
Fix nested xinclude element bug
I found a bug where xinclude preprocessing works only for elements that
are direct children of lnstrecipe tag. If an xinclude is nested deeper
in the structure it won't be resolved. This patch adds one more
recursion to process xincludes in deeper levels.
Signed-off-by: Jan Tluka <jtluka(a)redhat.com>
Signed-off-by: Jiri Pirko <jiri(a)resnulli.us>
lnst/Common/XmlParser.py | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
---
diff --git a/lnst/Common/XmlParser.py b/lnst/Common/XmlParser.py
index 143b289..e50a2f2 100644
--- a/lnst/Common/XmlParser.py
+++ b/lnst/Common/XmlParser.py
@@ -136,6 +136,8 @@ class XmlParser(object):
return node
parent.replace(e, node)
+ else:
+ self._expand_xinclude(e, base_url)
return elem
def _remove_comments(self, doc):
9 years, 6 months
[lnst] NetTestController: allow config_only for virtualized machines
by Jiří Pírko
commit 6ecfdcf8e5c6f3dc2b4e04a26bd70e35d3281b40
Author: Ondrej Lichtner <olichtne(a)redhat.com>
Date: Mon Sep 16 15:03:05 2013 +0200
NetTestController: allow config_only for virtualized machines
This commit enables config_only functionality for virtualized machines.
This didn't work previously because the dynamically created devices
would be removed. This was needed because there was no way to store this
information between lnst-ctl runs.
Now the information is pickled and stored in a file /tmp/.lnst_virt_conf
this file is then detected on the next NetTestController object creation
(when the next recipe is being executed), and the configuration is
reversed removing interfaces, bridges, iptables rules and calling
machine_cleanup on slaves.
There are also a few helper get/set methods added in this commit.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
Signed-off-by: Jiri Pirko <jiri(a)resnulli.us>
lnst/Common/VirtUtils.py | 6 +++
lnst/Controller/Machine.py | 3 +
lnst/Controller/NetTestController.py | 73 +++++++++++++++++++++++++++++++++-
3 files changed, 80 insertions(+), 2 deletions(-)
---
diff --git a/lnst/Common/VirtUtils.py b/lnst/Common/VirtUtils.py
index e13bfe2..457e9a0 100644
--- a/lnst/Common/VirtUtils.py
+++ b/lnst/Common/VirtUtils.py
@@ -211,6 +211,12 @@ class BridgeCtl(NetCtl):
self._check_name(name)
self._name = name
+ def get_name(self):
+ return self._name
+
+ def set_remove(self, remove):
+ self._remove = remove
+
@staticmethod
def _check_name(name):
if len(name) > 16:
diff --git a/lnst/Controller/Machine.py b/lnst/Controller/Machine.py
index b104966..22d1f0b 100644
--- a/lnst/Controller/Machine.py
+++ b/lnst/Controller/Machine.py
@@ -213,6 +213,9 @@ class Machine(object):
"""
return self._hostname
+ def get_libvirt_domain(self):
+ return self._libvirt_domain
+
def get_id(self):
""" Returns machine's id as defined in the recipe """
return self._id
diff --git a/lnst/Controller/NetTestController.py b/lnst/Controller/NetTestController.py
index fe92b16..fd7692d 100644
--- a/lnst/Controller/NetTestController.py
+++ b/lnst/Controller/NetTestController.py
@@ -15,7 +15,7 @@ import logging
import socket
import os
import re
-import pickle
+import cPickle
import tempfile
import imp
from time import sleep
@@ -35,6 +35,7 @@ from lnst.Common.ConnectionHandler import ConnectionHandler
from lnst.Common.Config import lnst_config
from lnst.Common.RecipePath import RecipePath
from lnst.Common.Colours import decorate_with_preset
+from lnst.Common.NetUtils import test_tcp_connection
import lnst.Controller.Task as Task
class NetTestError(Exception):
@@ -53,6 +54,8 @@ class NetTestController:
self._recipe_path = recipe_path
self._msg_dispatcher = MessageDispatcher(log_ctl)
+ self._remove_virt_config()
+
sp = SlavePool(lnst_config.get_option('environment', 'pool_dirs'),
check_process_running("libvirtd"), pool_checks)
self._slave_pool = sp
@@ -408,8 +411,70 @@ class NetTestController:
self._log_ctl.remove_slave(machine_id)
# remove dynamically created bridges
+ if deconfigure:
+ for bridge in self._network_bridges.itervalues():
+ bridge.cleanup()
+
+ def _save_virt_config(self):
+ #saves current virtual configuration to a file, after pickling it
+ config_data = dict()
+ machines = config_data["machines"] = {}
+ for m in self._machines.itervalues():
+ machine = machines[m.get_hostname()] = dict()
+
+ machine["libvirt_dom"] = m.get_libvirt_domain()
+ machine["interfaces"] = []
+
+ for i in m._interfaces:
+ hwaddr = i.get_hwaddr()
+
+ machine["interfaces"].append(hwaddr)
+
+ config_data["bridges"] = bridges = []
for bridge in self._network_bridges.itervalues():
- bridge.cleanup()
+ bridges.append(bridge.get_name())
+
+ with open("/tmp/.lnst_virt_conf", "wb") as f:
+ pickled_data = cPickle.dump(config_data, f)
+
+ def _remove_virt_config(self):
+ #removes previously saved virtual configuration
+ cfg = None
+ try:
+ with open("/tmp/.lnst_virt_conf", "rb") as f:
+ cfg = cPickle.load(f)
+ except:
+ return
+
+ if cfg:
+ logging.info("Cleaning ip leftover configuration from previous "\
+ "virtualized config_only run.")
+ for hostname, machine in cfg["machines"].iteritems():
+ port = lnst_config.get_option("environment", "rpcport")
+ if test_tcp_connection(hostname, port):
+ rpc_con = socket.create_connection((hostname, port))
+
+ rpc_msg= {"type": "command",
+ "method_name": "machine_cleanup",
+ "args": []}
+
+ logging.debug("Calling cleanup on slave '%s'" % hostname)
+ send_data(rpc_con, rpc_msg)
+ rpc_con.close()
+
+ libvirt_dom = machine["libvirt_dom"]
+ domain_ctl = VirtDomainCtl(libvirt_dom)
+ logging.info("Detaching dynamically created interfaces.")
+ for i in machine["interfaces"]:
+ domain_ctl.detach_interface(i)
+
+ logging.info("Removing dynamically created bridges.")
+ for br in cfg["bridges"]:
+ br_ctl = BridgeCtl(br)
+ br_ctl.set_remove(True)
+ br_ctl.cleanup()
+
+ os.remove("/tmp/.lnst_virt_conf")
def match_setup(self):
mreq = self._get_machine_requirements()
@@ -426,6 +491,10 @@ class NetTestController:
self._cleanup_slaves()
raise
+ sp = self._slave_pool
+ if sp.is_setup_virtual():
+ self._save_virt_config()
+
self._cleanup_slaves(deconfigure=False)
return {"passed": True}
9 years, 6 months
[lnst] NetTestController: ensure partial cleanup
by Jiří Pírko
commit 4bfdc946b08d9995f886b02b50d250650317034d
Author: Ondrej Lichtner <olichtne(a)redhat.com>
Date: Mon Sep 16 15:03:04 2013 +0200
NetTestController: ensure partial cleanup
This commit adds cleanup to some places that it makes sense and it
wasn't done previously. Mainly when there are errors during
configuration the already configured parts will be cleaned up.
Another case that didn't work properly was when lnst was interrupted
by Ctrl-C during configuration.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
Signed-off-by: Jiri Pirko <jiri(a)resnulli.us>
lnst/Controller/NetTestController.py | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/lnst/Controller/NetTestController.py b/lnst/Controller/NetTestController.py
index 910b40e..fe92b16 100644
--- a/lnst/Controller/NetTestController.py
+++ b/lnst/Controller/NetTestController.py
@@ -418,7 +418,14 @@ class NetTestController:
return {"passed": True}
def config_only_recipe(self):
- self._prepare_network()
+ try:
+ self._prepare_network()
+ except (KeyboardInterrupt, Exception) as exc:
+ msg = "Exception raised during configuration."
+ logging.error(msg)
+ self._cleanup_slaves()
+ raise
+
self._cleanup_slaves(deconfigure=False)
return {"passed": True}
@@ -426,9 +433,10 @@ class NetTestController:
try:
self._prepare_network()
self._prepare_tasks()
- except Exception as exc:
+ except (KeyboardInterrupt, Exception) as exc:
msg = "Exception raised during configuration."
logging.error(msg)
+ self._cleanup_slaves()
raise
if packet_capture:
9 years, 6 months
[lnst] Machine: ensure virt device cleanup
by Jiří Pírko
commit cd0ab9be665571ebb8c5fbea6e0351aee7fdbb54
Author: Ondrej Lichtner <olichtne(a)redhat.com>
Date: Mon Sep 16 15:03:03 2013 +0200
Machine: ensure virt device cleanup
This commit ensures that virtual devices are cleaned up even when the
slave connection was lost. They won't be cleaned up when the deconfigure
parameter is set to false - this happens when lnst-ctl is run with
config_only.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
Signed-off-by: Jiri Pirko <jiri(a)resnulli.us>
lnst/Controller/Machine.py | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
---
diff --git a/lnst/Controller/Machine.py b/lnst/Controller/Machine.py
index 6a870ef..b104966 100644
--- a/lnst/Controller/Machine.py
+++ b/lnst/Controller/Machine.py
@@ -158,6 +158,11 @@ class Machine(object):
#connection to the slave was closed
if not self._msg_dispatcher.get_connection(self._id):
+ #we still need to remove virtual interfaces
+ if deconfigure:
+ for iface in reversed(self._interfaces):
+ if isinstance(iface, VirtualInterface):
+ iface.cleanup()
return
self._rpc_call("kill_cmds")
9 years, 6 months
[lnst] SlavePool: fix copy-paste error
by Jiří Pírko
commit da39f3f59e42e076c722be5c41d8b6c289cb7c9d
Author: Ondrej Lichtner <olichtne(a)redhat.com>
Date: Mon Sep 16 14:29:13 2013 +0200
SlavePool: fix copy-paste error
I forgot to change the parameters to a function call that I copied from
a different function. This commit fixes that.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
Signed-off-by: Jiri Pirko <jiri(a)resnulli.us>
lnst/Controller/SlavePool.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/lnst/Controller/SlavePool.py b/lnst/Controller/SlavePool.py
index 24724be..d83de40 100644
--- a/lnst/Controller/SlavePool.py
+++ b/lnst/Controller/SlavePool.py
@@ -725,6 +725,6 @@ class SetupMapper:
if self._map_setup_virt(new_template, new_pool):
return True
- self._machine_map.discard((machine, possible_match))
+ self._machine_map.discard((machine_id, pm_id))
return False
9 years, 6 months
[lnst] man-pages: Updating CLI Options and Links
by Jiří Pírko
commit b7517865b02ec43640349eb21777622896b6bbf7
Author: Radek Pazdera <rpazdera(a)redhat.com>
Date: Mon Sep 16 13:50:45 2013 +0200
man-pages: Updating CLI Options and Links
The URL's was changed from fedorahosted to GitHub in both pages. Apart
from that I updated CLI options description on the lnst-ctl page
(Issue #5) and also added a description of return values (Issue #24).
Signed-off-by: Radek Pazdera <rpazdera(a)redhat.com>
Signed-off-by: Jiri Pirko <jiri(a)resnulli.us>
install/lnst-ctl.1.in | 25 +++++++++++++++++++------
install/lnst-slave.1.in | 6 +++---
2 files changed, 22 insertions(+), 9 deletions(-)
---
diff --git a/install/lnst-ctl.1.in b/install/lnst-ctl.1.in
index d29ebab..fd5c64b 100644
--- a/install/lnst-ctl.1.in
+++ b/install/lnst-ctl.1.in
@@ -26,8 +26,12 @@ is a script used for managing slaves. It reads a recipe XML file as an
input and executes tests on the specified slave machines.
.SH OPTIONS
.TP
-.B \-c, \-\-cleanup
-Cleanup all slave machines berfore executing the recipes.
+.BI "\-c, \-\-config" =file
+Load a custom configuration file in addition to
+.I /etc/lnst-ctl.conf
+and
+.I ~/lnst/lnst-ctl.conf
+that are loaded by default.
.TP
.B \-d, \-\-debug
Toggle emitting debugging messages.
@@ -85,6 +89,7 @@ is set to
will only try to match the configuration in the recipe with its local
pools and print the resulting match, in case it was successful or an
appropriate error message, in case it was not.
+
.SH CONFIGURATION
.B lnst-ctl
will look for configuration in the following locations:
@@ -97,12 +102,20 @@ For further description of file format or configuration options available,
please refer to the configuration file itself, where each option is
documented.
+.SH EXIT STATUS
+.B lnst-ctl
+will terminate with one of the following statuses:
+
+ 0 All tests passed, no errors encountered
+ 1 At least one test failed
+ 2 There was an error during the execution
+
.SH INTERNET RESOURCES
-Project Wiki: https://fedorahosted.org/lnst/
+Project Homepage: http://lnst-project.org/
.br
-Documentation: https://fedorahosted.org/lnst/wiki/Documentation
+Online Documentation: https://github.com/jpirko/lnst/wiki#learn
.br
-Git Source Tree: http://git.fedorahosted.org/cgit/lnst.git/
+Git Source Tree: https://github.com/jpirko/lnst
Mailing List: <lnst-developers(a)lists.fedorahosted.org>
.SH AUTHORS
@@ -118,6 +131,6 @@ Mailing List: <lnst-developers(a)lists.fedorahosted.org>
.SH COPYRIGHT
Copyright (C) 2011\-2013 Red Hat, Inc.
-LNST is distributed under GNU General Public License version 2. See
+LNST is distributed under the GNU General Public License version 2. See
the file "COPYING" in the source distribution for information on terms &
conditions for accessing and otherwise using LNST.
diff --git a/install/lnst-slave.1.in b/install/lnst-slave.1.in
index 276f6a3..ebaa1eb 100644
--- a/install/lnst-slave.1.in
+++ b/install/lnst-slave.1.in
@@ -77,11 +77,11 @@ The cache is fully under control of the
daemon and is managed automatically. Making any modifications by hand is
not recommended.
.SH INTERNET RESOURCES
-Project Wiki: https://fedorahosted.org/lnst/
+Project Homepage: http://lnst-project.org/
.br
-Documentation: https://fedorahosted.org/lnst/wiki/Documentation
+Online Documentation: https://github.com/jpirko/lnst/wiki#learn
.br
-Git Source Tree: http://git.fedorahosted.org/cgit/lnst.git/
+Git Source Tree: https://github.com/jpirko/lnst
Mailing List: <lnst-developers(a)lists.fedorahosted.org>
.SH AUTHORS
9 years, 6 months
[lnst] README: Renaming and Updating the Readme File
by Jiří Pírko
commit baddda0702c378f4e881d53b651c5aac69e01bb7
Author: Radek Pazdera <rpazdera(a)redhat.com>
Date: Mon Sep 16 13:50:44 2013 +0200
README: Renaming and Updating the Readme File
In order to parse them correctly, GitHub requires a *.md extension to
the readme file. I also updated some information in the README.
Signed-off-by: Radek Pazdera <rpazdera(a)redhat.com>
Signed-off-by: Jiri Pirko <jiri(a)resnulli.us>
README => README.md | 21 ++++++++++++---------
1 files changed, 12 insertions(+), 9 deletions(-)
---
diff --git a/README b/README.md
similarity index 63%
rename from README
rename to README.md
index c4dd633..3c10f72 100644
--- a/README
+++ b/README.md
@@ -1,7 +1,7 @@
# LNST - Linux Network Stack Test #
-Linux Network Stack Test is a tool that supports development and execution of
-automated and portable network tests. For detailed description of the
+Linux Network Stack Test is a tool that supports development and execution
+of automated and portable network tests. For detailed description of the
architecture of LNST please refer to project website (link listed on
Internet Resources bellow).
@@ -10,8 +10,10 @@ Internet Resources bellow).
LNST can be installed using python's distutils.
- $ su
- # ./setup.py install
+```bash
+su
+./setup.py install
+```
## Authors
@@ -25,14 +27,15 @@ LNST can be installed using python's distutils.
## Internet Resources
-* Project Wiki: https://fedorahosted.org/lnst/
-* Documentation: https://fedorahosted.org/lnst/wiki/Documentation
-* Git Source Tree: http://git.fedorahosted.org/cgit/lnst.git/
-* Mailing List: lnst-developers(a)lists.fedorahosted.org
+* Project Wiki: https://github.com/jpirko/lnst/wiki
+* Documentation: https://github.com/jpirko/lnst/wiki#learn
+* Git Source Tree: https://github.com/jpirko/lnst
+* Mailing List: <lnst-developers(a)lists.fedorahosted.org>
+
## License
-Copyright (C) 2012 Red Hat, Inc.
+**Copyright (C) 2011-2013 Red Hat, Inc.**
LNST is distributed under GNU General Public License version 2. See the file
"COPYING" in the source distribution for information on terms & conditions
9 years, 6 months
[lnst] lnst-ctl: Rearranging Help
by Jiří Pírko
commit 4b25ba793e766ef752e44c645d7a78675c40b5b9
Author: Radek Pazdera <rpazdera(a)redhat.com>
Date: Mon Sep 16 13:50:43 2013 +0200
lnst-ctl: Rearranging Help
The help message was stuffed into a too small space. I made the lines
longer and also arranged the options in an alphabetical order.
Signed-off-by: Radek Pazdera <rpazdera(a)redhat.com>
Signed-off-by: Jiri Pirko <jiri(a)resnulli.us>
lnst-ctl | 18 ++++++++----------
1 files changed, 8 insertions(+), 10 deletions(-)
---
diff --git a/lnst-ctl b/lnst-ctl
index c01762a..a51b2d6 100755
--- a/lnst-ctl
+++ b/lnst-ctl
@@ -35,20 +35,18 @@ def usage(retval=0):
print "ACTION = [ run | config_only | match_setup ]"
print ""
print "OPTIONS"
+ print " -a, --define-alias name=value define top-level alias"
+ print " -A, --override-alias name=value define top-level alias that " \
+ "will override any other definitions in the recipe"
+ print " -c, --config=FILE load additional config file"
print " -d, --debug emit debugging messages"
- print " -p, --packet-capture capture and log all ongoing\n" \
- " network communication during\n" \
- " the test"
print " -h, --help print this message"
print " -m, --no-colours disable coloured terminal output"
- print " -o, --disable-pool-checks don't check the availability of\n"\
- " machines in the pool"
- print " -c, --config=FILE load additional config file\n"
+ print " -o, --disable-pool-checks don't check the availability of " \
+ "machines in the pool"
+ print " -p, --packet-capture capture and log all ongoing " \
+ "network communication during the test"
print " -x, --result=FILE file to write xml_result"
- print " -a, --define-alias name=value define top-level alias"
- print " -A, --override-alias name=value define top-level alias that\n" \
- " will override any other\n"\
- " definitions in the recipe"
sys.exit(retval)
def store_alias(alias_def, aliases_dict):
9 years, 6 months