commit d2b69ec4633db32f6ad2cac1302fe31397a977e6
Author: Ondrej Lichtner <olichtne(a)redhat.com>
Date: Fri Feb 14 11:34:55 2014 +0100
NetTestSlave: rescan devices on hello
There seems to be a bug on older kernels (2.6.32 in RHEL6.5) that
results in the RTM_NEWLINK netlink message being sent after the
RTM_DELLINK message when a device is removed. This causes the slave to
first delete the device from the database and subsequently add it again
even though it doesn't exist in the kernel anymore. Newer kernels don't
have this problem.
This commit fixes the behaviour by adding a call of the rescan_devices
method to the "hello" method. I also made the rescan_devices method
public.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
Signed-off-by: Jiri Pirko <jiri(a)resnulli.us>
lnst/Slave/InterfaceManager.py | 5 +++--
lnst/Slave/NetTestSlave.py | 2 ++
2 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/lnst/Slave/InterfaceManager.py b/lnst/Slave/InterfaceManager.py
index aa818fd..94153ed 100644
--- a/lnst/Slave/InterfaceManager.py
+++ b/lnst/Slave/InterfaceManager.py
@@ -33,7 +33,7 @@ class InterfaceManager(object):
self._nl_socket = IPRSocket()
self._nl_socket.bind()
- self._rescan_devices()
+ self.rescan_devices()
def map_if(self, if_id, if_index):
if if_id in self._id_mapping:
@@ -50,7 +50,8 @@ class InterfaceManager(object):
def get_nl_socket(self):
return self._nl_socket
- def _rescan_devices(self):
+ def rescan_devices(self):
+ self._devices = {}
devs = scan_netdevs()
for dev in devs:
if dev['index'] not in self._devices:
diff --git a/lnst/Slave/NetTestSlave.py b/lnst/Slave/NetTestSlave.py
index 52679ee..50ccf13 100644
--- a/lnst/Slave/NetTestSlave.py
+++ b/lnst/Slave/NetTestSlave.py
@@ -69,6 +69,8 @@ class SlaveMethods:
self._cache.del_old_entries()
self.reset_file_transfers()
+ self._if_manager.rescan_devices()
+
date = datetime.datetime.now().strftime("%Y-%m-%d_%H:%M:%S")
self._log_ctl.set_recipe(recipe_path, expand=date)
sleep(1)
Show replies by date