From: Ondrej Lichtner <olichtne(a)redhat.com>
This patch set brings a few fixes to the smoke tests that were recently
implemented but were not fully tested because lnst wasn't fully working at the
time.
Additionally the smoke tests revealed a bug with team configuration that I fixed
in this patchset.
Finally I added some functionality to the SlavePool class so that it only uses
machines that are online. I added this because I added two more machines to my
pool and had to modify my recipes to specifically match the second pair of
machines.
If there are any issues contact me.
Ondrej Lichtner (4):
NetConfigDevice: fix team configuration
conf-vlan.xml: fix id and xml error
conf-team.xml: fix slave ids, remove hwaddr
SlavePool: test connection to slave machines
lnst/Controller/NetTestController.py | 2 +-
lnst/Controller/SlavePool.py | 16 +++++++++++++++-
lnst/Slave/NetConfigDevice.py | 8 +++++---
recipes/smoke/lib/conf-team.xml | 5 ++---
recipes/smoke/lib/conf-vlan.xml | 4 ++--
5 files changed, 25 insertions(+), 10 deletions(-)
--
1.7.11.7
Show replies by date
From: Ondrej Lichtner <olichtne(a)redhat.com>
The interface for teamdctl application has changed and the team
configuration executed by lnst slaves wasn't working.
This commit fixes that.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
---
lnst/Slave/NetConfigDevice.py | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/lnst/Slave/NetConfigDevice.py b/lnst/Slave/NetConfigDevice.py
index cd8a69e..c781e83 100644
--- a/lnst/Slave/NetConfigDevice.py
+++ b/lnst/Slave/NetConfigDevice.py
@@ -271,16 +271,18 @@ class NetConfigDeviceTeam(NetConfigDeviceGeneric):
port_netdev = self._config[slaveid]
port_name = port_netdev["name"]
teamd_port_config = get_option(port_netdev, "teamd_port_config")
+ dbus_option = "-D" if self._should_enable_dbus() else ""
if teamd_port_config:
teamd_port_config = prepare_json_str(teamd_port_config)
- exec_cmd("teamdctl %s PortConfigUpdate %s \"%s\"" %
(dev_name, port_name, teamd_port_config))
+ exec_cmd("teamdctl %s %s port config update %s \"%s\"" %
(dbus_option, dev_name, port_name, teamd_port_config))
NetConfigDevice(port_netdev, self._config).down()
- exec_cmd("teamdctl %s PortAdd %s" % (dev_name, port_name))
+ exec_cmd("teamdctl %s %s port add %s" % (dbus_option, dev_name,
port_name))
def slave_del(self, slaveid):
dev_name = self._netdev["name"]
port_name = self._config[slaveid]["name"]
- exec_cmd("teamdctl %s PortRemove %s" % (dev_name, port_name))
+ dbus_option = "-D" if self._should_enable_dbus() else ""
+ exec_cmd("teamdctl %s %s port remove %s" % (dbus_option, dev_name,
port_name))
type_class_mapping = {
"eth": NetConfigDeviceEth,
--
1.7.11.7
From: Ondrej Lichtner <olichtne(a)redhat.com>
The conf-vlan.xml file contained a mismatched interface tag, and the
referenced slave id was wrong.
This commit fixes that.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
---
recipes/smoke/lib/conf-vlan.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/recipes/smoke/lib/conf-vlan.xml b/recipes/smoke/lib/conf-vlan.xml
index 7b1b657..872c4b4 100644
--- a/recipes/smoke/lib/conf-vlan.xml
+++ b/recipes/smoke/lib/conf-vlan.xml
@@ -1,11 +1,11 @@
<netconfig>
<interface id="if-1" phys_id="dev-1"
type="eth"/>
- <interface id="testiface" type="vlan"/>
+ <interface id="testiface" type="vlan">
<options>
<option name="vlan_tci" value="10"/>
</options>
<slaves>
- <slave id="1"/>
+ <slave id="if-1"/>
</slaves>
<addresses>
<address value="{$testip}"/>
--
1.7.11.7
From: Ondrej Lichtner <olichtne(a)redhat.com>
Team configuration was referencing wrong slave ids.
The hwaddr option was causing problems for networks where multiple teams
were used. All of these interfaces used the same config file meaning
there were multiple interfaces with the same hwaddr.
This commit fixes both issues.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
---
recipes/smoke/lib/conf-team.xml | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/recipes/smoke/lib/conf-team.xml b/recipes/smoke/lib/conf-team.xml
index 05c050a..08bc7d5 100644
--- a/recipes/smoke/lib/conf-team.xml
+++ b/recipes/smoke/lib/conf-team.xml
@@ -5,14 +5,13 @@
<options>
<option name="teamd_config">
{
- "hwaddr": "00:11:22:33:44:55",
"runner": {"name": "roundrobin"}
}
</option>
</options>
<slaves>
- <slave id="1"/>
- <slave id="2"/>
+ <slave id="if-1"/>
+ <slave id="if-2"/>
</slaves>
<addresses>
<address value="{$testip}"/>
--
1.7.11.7
From: Ondrej Lichtner <olichtne(a)redhat.com>
This commit adds a new functionality to the SlavePool class. Until now
we have used all configuration files located in the pool directory and
used them in our matching algorithm. This however won't work correctly
if some machines are turned off. In this case the matching algorithm
uses the first configuration that matches even if it contains a machine
that is turned off which will result in a failure state. Even though
there exists a match that is fully available.
This commit adds code to the SlavePool initialization where we test
connectability of each machine being added to the pool and skip machines
that are turned off.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
---
lnst/Controller/NetTestController.py | 2 +-
lnst/Controller/SlavePool.py | 16 +++++++++++++++-
2 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/lnst/Controller/NetTestController.py b/lnst/Controller/NetTestController.py
index 645ed78..ffa2bf8 100644
--- a/lnst/Controller/NetTestController.py
+++ b/lnst/Controller/NetTestController.py
@@ -51,7 +51,7 @@ class NetTestController:
self._msg_dispatcher = MessageDispatcher()
sp = SlavePool(config.get_option('environment', 'pool_dirs'),
- check_process_running("libvirtd"))
+ check_process_running("libvirtd"), config)
self._slave_pool = sp
self._recipe = recipe = {}
diff --git a/lnst/Controller/SlavePool.py b/lnst/Controller/SlavePool.py
index 8470190..c98bb24 100644
--- a/lnst/Controller/SlavePool.py
+++ b/lnst/Controller/SlavePool.py
@@ -19,6 +19,7 @@ import re
import copy
from xml.dom import minidom
from lnst.Common.XmlProcessing import XmlDomTreeInit
+from lnst.Common.NetUtils import test_tcp_connection
from lnst.Controller.NetTestParse import SlaveMachineParse
class SlavePool:
@@ -35,7 +36,8 @@ class SlavePool:
_allow_virtual = False
- def __init__(self, pool_dirs, allow_virtual=False):
+ def __init__(self, pool_dirs, allow_virtual=False, config=None):
+ self._config = config
self._allow_virtual = allow_virtual
for pool_dir in pool_dirs:
self.add_dir(pool_dir)
@@ -64,8 +66,20 @@ class SlavePool:
slavemachine = dom.getElementsByTagName("slavemachine")[0]
parser.parse(slavemachine)
+
+ hostname = machine["params"]["hostname"]
+ if "rpcport" in machine:
+ port = machine["params"]["rpcport"]
+ else:
+ port = self._config.get_option('environment', 'rpcport')
+ logging.info("Querying slave machine %s." % machine_id)
+ if not test_tcp_connection(hostname, port):
+ return
+
if 'libvirt_domain' not in machine['params'] \
or self._allow_virtual:
+ logging.info("Adding slave machine %s to slave pool."
+ % machine_id)
self._pool[machine_id] = machine
else:
logging.warning("libvirtd not found- Machine Pool skipping "\
--
1.7.11.7