[lnst] remove file SlaveUtils
by Jiří Pírko
commit 4abb52cadfd80a89b0df88451210510398de2643
Author: Ondrej Lichtner <olichtne(a)redhat.com>
Date: Tue Nov 20 15:06:05 2012 +0100
remove file SlaveUtils
This file contains only a single function that is no longer used after
the previous commit. I am therefore removing it. It might be brought
back later when the wrapper script is being created but for now we don't
need it.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
lnst/Common/SlaveUtils.py | 43 -------------------------------------------
1 files changed, 0 insertions(+), 43 deletions(-)
11 years, 5 months
[lnst] lnst-ctl: remove remote_exec option
by Jiří Pírko
commit d78ef076d1b9af50c71e4e58ca3ada31241e5b1a
Author: Ondrej Lichtner <olichtne(a)redhat.com>
Date: Tue Nov 20 15:06:04 2012 +0100
lnst-ctl: remove remote_exec option
This commit removes the lnst-ctl argument for remote execution of the
slave application. This option is handy for developers but would cause
problems when the application is installed as a package. The
functionality will be probably replaced by a wrapper script later.
The removal of this option makes a few changes in the NetTestController
file as well.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
lnst-ctl | 22 ++++++++--------------
lnst/Controller/NetTestController.py | 27 +--------------------------
2 files changed, 9 insertions(+), 40 deletions(-)
---
diff --git a/lnst-ctl b/lnst-ctl
index 5608c01..00413fd 100755
--- a/lnst-ctl
+++ b/lnst-ctl
@@ -36,17 +36,14 @@ def usage():
" network communication during\n" \
" the test"
print " -h, --help print this message"
- print " -e, --remoteexec transfer and execute\n" \
- " application on slaves"
print " -c, --cleanup perform config cleanup\n" \
" machines"
print " -x, --result=FILE file to write xml_result"
sys.exit()
-def process_recipe(action, file_path, remoteexec, cleanup, res_serializer,
+def process_recipe(action, file_path, cleanup, res_serializer,
packet_capture, config):
- nettestctl = NetTestController(file_path,
- remoteexec=remoteexec, cleanup=cleanup,
+ nettestctl = NetTestController(file_path, cleanup=cleanup,
res_serializer=res_serializer, config=config)
if action == "run":
return nettestctl.run_recipe(packet_capture)
@@ -68,14 +65,14 @@ def print_summary(summary):
logging.info("*%s* %s" % (res, recipe_file))
logging.info("=====================================================")
-def get_recipe_result(args, file_path, remoteexec, cleanup,
+def get_recipe_result(args, file_path, cleanup,
res_serializer, packet_capture, config):
res_serializer.add_recipe(file_path)
Logs.set_logging_root_path(file_path)
res = None
try:
- res = process_recipe(args, file_path, remoteexec, cleanup,
+ res = process_recipe(args, file_path, cleanup,
res_serializer, packet_capture, config)
except NetTestError as err:
logging.error(err)
@@ -89,8 +86,8 @@ def main():
try:
opts, args = getopt.getopt(
sys.argv[1:],
- "dhr:ecx:p",
- ["debug", "help", "recipe=", "remoteexec", "cleanup", "result=",
+ "dhr:cx:p",
+ ["debug", "help", "recipe=", "cleanup", "result=",
"packet_capture"]
)
except getopt.GetoptError as err:
@@ -117,7 +114,6 @@ def main():
debug = 0
recipe_path = None
- remoteexec = False
cleanup = False
result_path = None
packet_capture = False
@@ -126,8 +122,6 @@ def main():
debug += 1
elif opt in ("-h", "--help"):
usage()
- elif opt in ("-e", "--remoteexec"):
- remoteexec = True
elif opt in ("-c", "--cleanup"):
cleanup = True
elif opt in ("-x", "--result"):
@@ -160,13 +154,13 @@ def main():
if re.match(r'^.*\.xml$', recipe_file):
logging.info("Processing recipe file \"%s\"" % recipe_file)
summary.append(get_recipe_result(action, recipe_file,
- remoteexec, cleanup,
+ cleanup,
res_serializer,
packet_capture,
config))
Logs.set_logging_root_path(clean=False)
else:
- summary.append(get_recipe_result(action, recipe_path, remoteexec,
+ summary.append(get_recipe_result(action, recipe_path,
cleanup, res_serializer,
packet_capture,
config))
diff --git a/lnst/Controller/NetTestController.py b/lnst/Controller/NetTestController.py
index b6af5ae..340cdea 100644
--- a/lnst/Controller/NetTestController.py
+++ b/lnst/Controller/NetTestController.py
@@ -22,7 +22,6 @@ from pprint import pprint, pformat
from lnst.Common.Logs import Logs, log_exc_traceback
from lnst.Common.SshUtils import scp_from_remote
from lnst.Common.XmlRpc import ServerProxy, ServerException
-from lnst.Common.SlaveUtils import prepare_client_session
from lnst.Common.NetUtils import MacPool
from lnst.Common.VirtUtils import VirtNetCtl, VirtDomainCtl, BridgeCtl
from lnst.Common.Utils import wait_for, md5sum, dir_md5sum, create_tar_archive
@@ -38,9 +37,8 @@ def ignore_event(**kwarg):
pass
class NetTestController:
- def __init__(self, recipe_path, remoteexec=False, cleanup=False,
+ def __init__(self, recipe_path, cleanup=False,
res_serializer=None, config=None):
- self._remoteexec = remoteexec
self._docleanup = cleanup
self._res_serializer = res_serializer
self._remote_capture_files = {}
@@ -240,9 +238,6 @@ class NetTestController:
domain_ctl = VirtDomainCtl(info["libvirt_domain"])
info["virt_domain_ctl"] = domain_ctl
- if self._remoteexec and not "session" in info:
- self._init_slave_session(machine_id)
-
if not "rpc" in info:
self._init_slave_logging(machine_id)
self._init_slave_rpc(machine_id)
@@ -294,23 +289,6 @@ class NetTestController:
if self._docleanup:
self._rpc_call(machine_id, 'machine_cleanup')
- def _init_slave_session(self, machine_id):
- info = self._get_machineinfo(machine_id)
- hostname = info["hostname"]
- if "rootpass" in info:
- passwd = info["rootpass"]
- else:
- passwd = ''
- logging.info("Executing nettestslave on machine %s", hostname)
-
- port = "22"
- login = "root"
- rpc_port = self._config.get_option('environment', 'rpcport')
- session = prepare_client_session(hostname, port, login, passwd,
- "lnst-slave -p %s" % rpc_port)
- session.add_kill_handler(self._session_die)
- info["session"] = session
-
def _init_slave_rpc(self, machine_id):
info = self._get_machineinfo(machine_id)
hostname = info["hostname"]
@@ -379,9 +357,6 @@ class NetTestController:
return
for machine_id in self._recipe["machines"]:
info = self._get_machineinfo(machine_id)
- if self._remoteexec and "session" in info:
- info["session"].kill()
- info["session"].wait()
def _prepare(self):
# All the perparations are made within the recipe parsing
11 years, 5 months
[lnst] add folder install with template files
by Jiří Pírko
commit 9454f5ac8708aef02ca164e02d02eff311e2df6b
Author: Ondrej Lichtner <olichtne(a)redhat.com>
Date: Tue Nov 20 15:06:03 2012 +0100
add folder install with template files
This commit adds the folder install/ which will contain template files
used during the package instalation. Currently it contains two files:
install/lnst-ctl.conf.in
which contains the template for the lnst-ctl.conf file with comments
on all of the options,
install/lnst-slave.conf.in
which contains the template for the lnst-slave.conf file with comments
on all of the options.
These files can contain macros in the format of @name_of_macro@ that
will be replaced by values during the instalation to create the final
configuration files that should be installed.
The functionality for transforming these template files will be added
later.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
install/lnst-ctl.conf.in | 45 ++++++++++++++++++++++++++++++++++++++++++++
install/lnst-slave.conf.in | 27 ++++++++++++++++++++++++++
2 files changed, 72 insertions(+), 0 deletions(-)
---
diff --git a/install/lnst-ctl.conf.in b/install/lnst-ctl.conf.in
new file mode 100644
index 0000000..a06d3ca
--- /dev/null
+++ b/install/lnst-ctl.conf.in
@@ -0,0 +1,45 @@
+#This file is used for system-wide controller configuration. It serves mainly
+#to set the default values which will be used when no user configuration is
+#found. Users should set their own configuration in the file
+# $HOME$/.lnst/lnst-ctl.conf which will be automatically created when it
+#doesn't exist.
+
+#The section environment contains generic options mostly related to the
+#machine the controller is being run on.
+[environment]
+
+#mac_pool_range is used to specify the range of mac addresses that
+#will be used when creating new devices in virtual machines.
+#The option accepts two valid mac addresses separated by white spaces.
+mac_pool_range = 52:54:01:00:00:01 52:54:01:FF:FF:FF
+
+#The rpcport options specifies the default port we will be connecting to, when
+#connecting to slave rpc servers.
+#The option accepts a single integer value.
+rpcport = 9999
+
+#machine_pool_dirs specifies where the controller should look for specifications
+#of machines that can be used for matching templates inside recipes. This
+#option accepts a variable number of directory paths separated by white spaces.
+#It is also important to note that you can use the operator += to add to the
+#list of directories. If the operator = is used, the previous list is replaced.
+machine_pool_dirs =
+
+#test_tool_dirs specifies where the controller looks for custom tools that
+#are used in tests. Every tool has it's own subdirectory in one of the
+#directories in this list. The option behaves the same way as the option
+#machine_pool_dirs, it accepts a list of directory paths and both operators,
+# += and = can be used
+test_tool_dirs = @test_tool_dirs@
+
+#test_module_dirs specifies where the controller looks for custom test modules
+#the test modules need to be named Test<name>.py otherwise they won't be
+#recognized. The behaviour of the option is the same as test_tool_dirs, it
+#accepts a list of directory paths and both operators, += and = can be used.
+test_module_dirs = @test_module_dirs@
+
+#log_dir option redirects the location of where logs are stored. Every run of
+#the application creates its own timestamped subdirectory in the path specified
+#in this option. The option accepts one directory path that will be created if
+#it doesn't exist. You cannot use the operator += here.
+log_dir = @log_dir@
diff --git a/install/lnst-slave.conf.in b/install/lnst-slave.conf.in
new file mode 100644
index 0000000..c4b379f
--- /dev/null
+++ b/install/lnst-slave.conf.in
@@ -0,0 +1,27 @@
+#This file is used for system-wide slave configuration. It is the main
+#configuration file for the slave. The slave is run as a daemon with root
+#privileges so there is no user specific configuration
+
+#The section cache contains configuration regarding how the cache is used.
+#The cache is used for test_modules and test_tools that are transfered to
+#slave machines from the controller.
+[cache]
+
+#cache_dir option specifies where the slave shoud store the transfered files.
+#The option accepts one directory path.
+cache_dir = @cache_dir@
+
+#expiration_period specifies for how long we keep the files stored. If a file
+#has not been used for longer than the specified duration it will be removed
+#during the next test execution
+expiration_period = 7days
+
+#The section environment currently only contains one option. In the future it
+#might be used for more options
+[environment]
+
+#log_dir option redirects the location of where logs are stored. Every run of
+#a test creates its own timestamped subdirectory in the path specified
+#in this option.
+#The option accepts one directory path that will be created if it doesn't exist.
+log_dir = @log_dir@
11 years, 5 months
[lnst] Config: slave log_dir option
by Jiří Pírko
commit 258e5de10df010e6372bdc43721bc55b429f138b
Author: Ondrej Lichtner <olichtne(a)redhat.com>
Date: Tue Nov 20 15:06:02 2012 +0100
Config: slave log_dir option
This commit adds the option to redirect the directory where slaves
locally store their logs. The option is named 'log_dir' and is placed in
the section 'environment' same as for the controller configuration.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
lnst-slave | 2 +-
lnst-slave.conf | 2 ++
lnst/Common/Config.py | 8 ++++++++
3 files changed, 11 insertions(+), 1 deletions(-)
---
diff --git a/lnst-slave b/lnst-slave
index 3a66c2f..4244209 100755
--- a/lnst-slave
+++ b/lnst-slave
@@ -72,7 +72,7 @@ def main():
elif opt in ("-p", "--port"):
port = int(arg)
- Logs(debug, True)
+ Logs(debug, True, log_folder=config.get_option('environment', 'log_dir'))
logging.info("Started")
if port:
diff --git a/lnst-slave.conf b/lnst-slave.conf
index 924d0c7..5689819 100644
--- a/lnst-slave.conf
+++ b/lnst-slave.conf
@@ -1,3 +1,5 @@
[cache]
cache_dir = ./cache
expiration_period = 7days
+[environment]
+log_dir = ./Logs
diff --git a/lnst/Common/Config.py b/lnst/Common/Config.py
index d49a2d9..3d65048 100644
--- a/lnst/Common/Config.py
+++ b/lnst/Common/Config.py
@@ -74,6 +74,14 @@ class Config():
"name" : "log_dir"}
def slave_scheme(self):
+ self.options['environment'] = dict()
+ self.options['environment']['log_dir'] = {\
+ "value" : os.path.abspath(os.path.join(
+ os.path.dirname(sys.argv[0]), './Logs')),
+ "additive" : False,
+ "action" : self.optionPath,
+ "name" : "log_dir"}
+
self.options['cache'] = dict()
self.options['cache']['dir'] = {\
"value" : os.path.abspath(os.path.join(
11 years, 5 months
[lnst] Config: controller log dir
by Jiří Pírko
commit c3fed6be24202f188f93f8bd5d2d6eb97a848155
Author: Ondrej Lichtner <olichtne(a)redhat.com>
Date: Tue Nov 20 15:06:01 2012 +0100
Config: controller log dir
This patch moves the option 'path' in section 'log' to section
'environment' and renames the option to 'log_dir'. The section 'log' is
removed as it only contained one option.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
lnst-ctl | 2 +-
lnst-ctl.conf | 3 +--
lnst/Common/Config.py | 14 ++++++--------
3 files changed, 8 insertions(+), 11 deletions(-)
---
diff --git a/lnst-ctl b/lnst-ctl
index af9badb..5608c01 100755
--- a/lnst-ctl
+++ b/lnst-ctl
@@ -136,7 +136,7 @@ def main():
packet_capture = True
- Logs(debug, log_folder=config.get_option('log', 'path'))
+ Logs(debug, log_folder=config.get_option('environment', 'log_dir'))
if not args:
logging.error("No action command passed")
diff --git a/lnst-ctl.conf b/lnst-ctl.conf
index cb4ee11..389434c 100644
--- a/lnst-ctl.conf
+++ b/lnst-ctl.conf
@@ -4,5 +4,4 @@ rpcport = 9999
machine_pool_dirs =
test_tool_dirs = ./test_tools
test_module_dirs = ./test_modules
-[log]
-path = ./Logs
+log_dir = ./Logs
diff --git a/lnst/Common/Config.py b/lnst/Common/Config.py
index 61e7354..d49a2d9 100644
--- a/lnst/Common/Config.py
+++ b/lnst/Common/Config.py
@@ -40,14 +40,6 @@ class Config():
raise ConfigError(msg)
def controller_scheme(self):
- self.options['log'] = dict()
- self.options['log']['path'] = {\
- "value" : os.path.abspath(os.path.join(
- os.path.dirname(sys.argv[0]), './Logs')),
- "additive" : False,
- "action" : self.optionPath,
- "name" : "path"}
-
self.options['environment'] = dict()
self.options['environment']['mac_pool_range'] = {\
"value" : ['52:54:01:00:00:01', '52:54:01:FF:FF:FF'],
@@ -74,6 +66,12 @@ class Config():
"additive" : True,
"action" : self.optionDirList,
"name" : "test_module_dirs"}
+ self.options['environment']['log_dir'] = {\
+ "value" : os.path.abspath(os.path.join(
+ os.path.dirname(sys.argv[0]), './Logs')),
+ "additive" : False,
+ "action" : self.optionPath,
+ "name" : "log_dir"}
def slave_scheme(self):
self.options['cache'] = dict()
11 years, 5 months
[lnst] NetTestCommand import fix
by Jiří Pírko
commit 3ad1e549edeeebdcb20eb41a1851fc1d333989f9
Author: Ondrej Lichtner <olichtne(a)redhat.com>
Date: Tue Nov 20 15:06:00 2012 +0100
NetTestCommand import fix
NetTestCommand module is being incorrectly imported after the
restructurization of the project tree. This patch fixes that.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
lnst/Controller/NetTestResultSerializer.py | 2 +-
test_modules/TestMulticast.py | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/lnst/Controller/NetTestResultSerializer.py b/lnst/Controller/NetTestResultSerializer.py
index 3505a33..499a076 100644
--- a/lnst/Controller/NetTestResultSerializer.py
+++ b/lnst/Controller/NetTestResultSerializer.py
@@ -12,7 +12,7 @@ jpirko(a)redhat.com (Jiri Pirko)
"""
from xml.dom.minidom import getDOMImplementation
-from lnst.Controller.NetTestCommand import str_command
+from lnst.Common.NetTestCommand import str_command
def serialize_obj(obj, dom, el, upper_name="unnamed"):
if isinstance(obj, dict):
diff --git a/test_modules/TestMulticast.py b/test_modules/TestMulticast.py
index 91a9d53..25422f6 100644
--- a/test_modules/TestMulticast.py
+++ b/test_modules/TestMulticast.py
@@ -13,7 +13,7 @@ rpazdera(a)redhat.com (Radek Pazdera)
import logging
import re
from lnst.Common.TestsCommon import TestGeneric
-from lnst.Controller.NetTestCommand import CommandException
+from lnst.Common.NetTestCommand import CommandException
from lnst.Common.ExecCmd import exec_cmd
class TestMulticast(TestGeneric):
11 years, 5 months
[lnst] Remove reset_resource_table from machine_cleanup code
by Jiří Pírko
commit f5146f34ce65029252951de2215ba2e1ce6a3159
Author: Jan Tluka <jtluka(a)redhat.com>
Date: Mon Nov 19 16:06:45 2012 +0100
Remove reset_resource_table from machine_cleanup code
Remove the unwanted reset_resource_table (which additionally has wrong name,
should be clear_resource_table) from machine_cleanup code. The bug
resulted in empty resource table and the test execution failed on first
command in command sequence.
Signed-off-by: Jan Tluka <jtluka(a)redhat.com>
lnst/Slave/NetTestSlave.py | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)
---
diff --git a/lnst/Slave/NetTestSlave.py b/lnst/Slave/NetTestSlave.py
index e198662..28cca22 100644
--- a/lnst/Slave/NetTestSlave.py
+++ b/lnst/Slave/NetTestSlave.py
@@ -150,7 +150,6 @@ class NetTestSlaveXMLRPC:
NetConfigDeviceAllCleanup()
self._netconfig.cleanup()
self._command_context.cleanup()
- self.reset_resource_table()
self._cache.del_old_entries()
return True
11 years, 5 months
[PATCH 1/7] NetTestCommand import fix
by Ondrej Lichtner
From: Ondrej Lichtner <olichtne(a)redhat.com>
NetTestCommand module is being incorrectly imported after the
restructurization of the project tree. This patch fixes that.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
---
lnst/Controller/NetTestResultSerializer.py | 2 +-
test_modules/TestMulticast.py | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/lnst/Controller/NetTestResultSerializer.py b/lnst/Controller/NetTestResultSerializer.py
index 3505a33..499a076 100644
--- a/lnst/Controller/NetTestResultSerializer.py
+++ b/lnst/Controller/NetTestResultSerializer.py
@@ -12,7 +12,7 @@ jpirko(a)redhat.com (Jiri Pirko)
"""
from xml.dom.minidom import getDOMImplementation
-from lnst.Controller.NetTestCommand import str_command
+from lnst.Common.NetTestCommand import str_command
def serialize_obj(obj, dom, el, upper_name="unnamed"):
if isinstance(obj, dict):
diff --git a/test_modules/TestMulticast.py b/test_modules/TestMulticast.py
index 91a9d53..25422f6 100644
--- a/test_modules/TestMulticast.py
+++ b/test_modules/TestMulticast.py
@@ -13,7 +13,7 @@ rpazdera(a)redhat.com (Radek Pazdera)
import logging
import re
from lnst.Common.TestsCommon import TestGeneric
-from lnst.Controller.NetTestCommand import CommandException
+from lnst.Common.NetTestCommand import CommandException
from lnst.Common.ExecCmd import exec_cmd
class TestMulticast(TestGeneric):
--
1.7.11.7
11 years, 5 months
[PATCH] Remove reset_resource_table from machine_cleanup code
by Jan Tluka
Remove the unwanted reset_resource_table (which additionally has wrong name,
should be clear_resource_table) from machine_cleanup code. The bug
resulted in empty resource table and the test execution failed on first
command in command sequence.
Signed-off-by: Jan Tluka <jtluka(a)redhat.com>
---
lnst/Slave/NetTestSlave.py | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)
diff --git a/lnst/Slave/NetTestSlave.py b/lnst/Slave/NetTestSlave.py
index e198662..28cca22 100644
--- a/lnst/Slave/NetTestSlave.py
+++ b/lnst/Slave/NetTestSlave.py
@@ -150,7 +150,6 @@ class NetTestSlaveXMLRPC:
NetConfigDeviceAllCleanup()
self._netconfig.cleanup()
self._command_context.cleanup()
- self.reset_resource_table()
self._cache.del_old_entries()
return True
--
1.7.7.6
11 years, 5 months
[PATCH] Fix module import bug
by Jan Tluka
Fix the path in import of NetTestCommand module
Signed-off-by: Jan Tluka <jtluka(a)redhat.com>
---
lnst/Controller/NetTestResultSerializer.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lnst/Controller/NetTestResultSerializer.py b/lnst/Controller/NetTestResultSerializer.py
index 3505a33..499a076 100644
--- a/lnst/Controller/NetTestResultSerializer.py
+++ b/lnst/Controller/NetTestResultSerializer.py
@@ -12,7 +12,7 @@ jpirko(a)redhat.com (Jiri Pirko)
"""
from xml.dom.minidom import getDOMImplementation
-from lnst.Controller.NetTestCommand import str_command
+from lnst.Common.NetTestCommand import str_command
def serialize_obj(obj, dom, el, upper_name="unnamed"):
if isinstance(obj, dict):
--
1.7.7.6
11 years, 5 months