Fix: use pci/rescan to avoid occasional bind issue on Centos7 17/6717/3
authorJan Gelety <jgelety@cisco.com>
Tue, 16 May 2017 08:21:51 +0000 (10:21 +0200)
committerPeter Mikus <pmikus@cisco.com>
Wed, 17 May 2017 06:38:00 +0000 (06:38 +0000)
- 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>
resources/libraries/python/InterfaceUtil.py

index ff9ecde..e5597b9 100644 (file)
@@ -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}'"

©2016 FD.io a Linux Foundation Collaborative Project. All Rights Reserved.
Linux Foundation is a registered trademark of The Linux Foundation. Linux is a registered trademark of Linus Torvalds.
Please see our privacy policy and terms of use.