Skip to content

Conversation

@adityagesh
Copy link
Collaborator

No description provided.

adityagesh and others added 2 commits October 23, 2025 17:08
Handle enable/disable test cases
Handle PCI NIC count
Comment on lines 529 to 553
# 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(
Copy link
Collaborator Author

@adityagesh adityagesh Oct 27, 2025

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)

Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants