- ssh = SSH()
- ssh.connect(node)
-
- for i in range(3):
- logger.trace('Try {}: Get interface driver'.format(i))
- 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}'"
- .format(cmd, node['host']))
-
- for line in stdout.splitlines():
- if len(line) == 0:
- continue
- try:
- (name, value) = line.split("\t", 1)
- except ValueError:
- if name != "Driver:":
- pass
- else:
- return None
- if name == 'Driver:':
- return value if value else None
- raise RuntimeError('Get interface driver for: {0}'
- .format(pci_addr))