I have recently hit several bugs during testing refactored recipe parsing.
Namely following: 1. Corrupted netdevice names
If bond set up was left after config_only and nettestslave instance was killed and restarted then inconsistent device names were read (e.g. in bond mode 0 all devices had the same MAC address and t_bond0 was incorrectly identified instead of e.g. eth0)
2. Bonding module is not loaded
If config_only run was performed with independent slaves running continuously the netconfigs from previous run were used resulting in inconsistent set of used netdevices (e.g. slave saw a bond device in used netdevice types and therefore bonding module was not loaded)
This patch set resolves these problems and makes cleanup more robust and proper.
I have tested the patchset on RHEL6.
--- NetTest/NetTestController.py | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/NetTest/NetTestController.py b/NetTest/NetTestController.py index 6c047d3..4e34c90 100644 --- a/NetTest/NetTestController.py +++ b/NetTest/NetTestController.py @@ -114,6 +114,11 @@ class NetTestController:
info["configured_interfaces"] = []
+ rpc = self._get_machinerpc(machine_id) + + if self._docleanup: + rpc.machine_cleanup() + def _init_slave_session(self, machine_id): info = self._get_machineinfo(machine_id) hostname = info["hostname"] @@ -145,9 +150,6 @@ class NetTestController: logging.error("Handshake error with machine %s", hostname) raise Exception("Hanshake error")
- if self._docleanup: - rpc.machine_cleanup() - info["rpc"] = rpc
def _init_slave_logging(self, machine_id):
--- NetConfig/NetConfigDevNames.py | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/NetConfig/NetConfigDevNames.py b/NetConfig/NetConfigDevNames.py index 1619b7e..1220480 100644 --- a/NetConfig/NetConfigDevNames.py +++ b/NetConfig/NetConfigDevNames.py @@ -39,6 +39,9 @@ class NetConfigDevNames: scan.append({"name": d, "hwaddr": addr}) return scan
+ def rescan_netdevs(self): + self._scan = self._scan_netdevs() + def assign_name_by_scan(self, dev_id, netdev): if (not "hwaddr" in netdev or "name" in netdev): # name was previously assigned
--- NetConfig/NetConfig.py | 6 ++++++ NetTest/NetTestSlave.py | 1 + 2 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/NetConfig/NetConfig.py b/NetConfig/NetConfig.py index 3561205..57903cd 100644 --- a/NetConfig/NetConfig.py +++ b/NetConfig/NetConfig.py @@ -150,3 +150,9 @@ class NetConfig: device = NetConfigDevice(netdev, self._config) device.slave_del(slave_dev_id) return True + + def cleanup(self): + tmp = copy.deepcopy(self._config) + for dev_id in tmp: + del self._config[dev_id] + self._devnames.rescan_netdevs() diff --git a/NetTest/NetTestSlave.py b/NetTest/NetTestSlave.py index 1746452..12440f7 100644 --- a/NetTest/NetTestSlave.py +++ b/NetTest/NetTestSlave.py @@ -111,6 +111,7 @@ class NetTestSlaveXMLRPC:
def machine_cleanup(self): NetConfigDeviceAllCleanup() + self._netconfig.cleanup() return True
class MySimpleXMLRPCServer(Server):
lnst-developers@lists.fedorahosted.org