aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries/python
diff options
context:
space:
mode:
authorJan Gelety <jgelety@cisco.com>2017-05-16 10:21:51 +0200
committerPeter Mikus <pmikus@cisco.com>2017-05-17 06:38:00 +0000
commite7959d92d3cfd7c1ea917986e95d080f60ea4ea5 (patch)
treee42cecb9f33c3c9970875b85b646003a91efa36a /resources/libraries/python
parent2900b5ab54b4c10e400369ef80f115f42baaa3da (diff)
Fix: use pci/rescan to avoid occasional bind issue on Centos7
- rarelly binding of one of TG interfaces fails with "No such device" error; usage of rescan should avoid such situations Change-Id: Icbeb48ea6f8adb863e6517d4a35d6aca4238309a Signed-off-by: Jan Gelety <jgelety@cisco.com>
Diffstat (limited to 'resources/libraries/python')
-rw-r--r--resources/libraries/python/InterfaceUtil.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/resources/libraries/python/InterfaceUtil.py b/resources/libraries/python/InterfaceUtil.py
index ff9ecdede5..e5597b9065 100644
--- a/resources/libraries/python/InterfaceUtil.py
+++ b/resources/libraries/python/InterfaceUtil.py
@@ -348,8 +348,14 @@ class InterfaceUtil(object):
ssh = SSH()
ssh.connect(node)
- cmd = 'lspci -vmmks {0}'.format(pci_addr)
+ # First rescan PCI devices in the system
+ cmd = 'sh -c "echo 1 > /sys/bus/pci/rescan"'
+ (ret_code, _, _) = ssh.exec_command_sudo(cmd)
+ if int(ret_code) != 0:
+ raise RuntimeError("'{0}' failed on '{1}'"
+ .format(cmd, node['host']))
+ cmd = 'lspci -vmmks {0}'.format(pci_addr)
(ret_code, stdout, _) = ssh.exec_command(cmd)
if int(ret_code) != 0:
raise RuntimeError("'{0}' failed on '{1}'"