-
Notifications
You must be signed in to change notification settings - Fork 223
Add support for AN NIC without a linked synthetic device #4074
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Handle enable/disable test cases Handle PCI NIC count
| # Try to find the PCI slot for this NIC by checking its device path | ||
| result = self._node.execute( | ||
| f"readlink -f /sys/class/net/{nic_name}/device", | ||
| shell=True, | ||
| ) | ||
| if result.exit_code == 0 and result.stdout.strip(): | ||
| # Extract PCI slot from device path | ||
| # Path format: /sys/devices/.../XXXX:XX:XX.X/net/nicname | ||
| match = self.__pci_slot_pattern.search(result.stdout) | ||
| if match: | ||
| pci_slot = match.group(1) | ||
| # Get the module name for this PCI device | ||
| try: | ||
| module_name = lspci.get_used_module(pci_slot) | ||
| if module_name: | ||
| nic.pci_slot = pci_slot | ||
| # For standalone PCI NICs, set module_name directly | ||
| # (no lower_module_name since there's no lower device) | ||
| nic.module_name = module_name | ||
| self._node.log.debug( | ||
| f"Associated unpaired NIC {nic_name} " | ||
| f"with PCI slot {pci_slot} (module: {module_name})" | ||
| ) | ||
| else: | ||
| self._node.log.debug( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure if this is the right place for this code.
If it is the right place, is it sufficient to just move the below code to a tool?
result = self._node.execute(
f"readlink -f /sys/class/net/{nic_name}/device",
shell=True,
)
# Path format: /sys/devices/.../XXXX:XX:XX.X/net/nicname
match = self.__pci_slot_pattern.search(result.stdout)
if match:
pci_slot = match.group(1)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, use tool is always better.
No description provided.