From: Ondrej Lichtner <olichtne(a)redhat.com>
This method generates a description of the slave machine that the object
represents, this includes information about configured Interfaces of
this machine.
The commit also updates the ControllerAPI method get_configuration, that
now uses the Machine get_configuration method to create a complete
configuration description of the entire test environment.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
---
lnst/Controller/Machine.py | 13 +++++++++++++
lnst/Controller/Task.py | 8 ++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/lnst/Controller/Machine.py b/lnst/Controller/Machine.py
index 4ce24cc..a7c5ea9 100644
--- a/lnst/Controller/Machine.py
+++ b/lnst/Controller/Machine.py
@@ -74,6 +74,19 @@ class Machine(object):
self._namespaces = []
self._bg_cmds = {}
+ def get_configuration(self):
+ configuration = {}
+ configuration["id"] = self._id
+ configuration["hostname"] = self._hostname
+ configuration["kernel_release"] =
self._slave_desc["kernel_release"]
+ configuration["redhat_release"] =
self._slave_desc["redhat_release"]
+
+ configuration["interfaces"] = {}
+ for i in self._interfaces:
+ if not isinstance(i, UnusedInterface):
+ configuration["interface_"+i.get_id()] = i.get_config()
+ return configuration
+
def _add_interface(self, if_id, if_type, cls):
if if_id != None:
for iface in self._interfaces:
diff --git a/lnst/Controller/Task.py b/lnst/Controller/Task.py
index e8db95f..c3a430f 100644
--- a/lnst/Controller/Task.py
+++ b/lnst/Controller/Task.py
@@ -115,7 +115,11 @@ class ControllerAPI(object):
return self._perf_repo_api
def get_configuration(self):
- return self._ctl._recipe["machines"]
+ machines = self._ctl._machines
+ configuration = {}
+ for m_id, m in machines.items():
+ configuration["machine_"+m_id] = m.get_configuration()
+ return configuration
def get_mapping(self):
match = self._ctl.get_pool_match()
@@ -537,7 +541,7 @@ class PerfRepoResult(object):
def set_configuration(self, configuration=None):
if configuration is None:
configuration = ctl.get_configuration()
- for pair in list_to_dot(configuration, "configuration.",
"machine"):
+ for pair in dict_to_dot(configuration, "configuration."):
self._testExecution.add_parameter(pair[0], pair[1])
def set_mapping(self, mapping=None):
--
2.1.0