Skip to content
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

utils_sriov.get_pf_info() cannot get iface name due to prefix '0000:' #3565

Open
nluu-ampere opened this issue Nov 21, 2022 · 0 comments
Open

Comments

@nluu-ampere
Copy link

Hi,
I got the issue with this code when run sriov test!

    status, output = utils_misc.cmd_status_output(
        "lspci |awk '/Ethernet/ {print $1}'", shell=True, session=session)
    if status or not output:
        raise exceptions.TestError("Unable to get Ethernet controllers. status: %s,"
                                   "stdout: %s." % (status, output))
    for pci in output.split():
        _, output = utils_misc.cmd_status_output("lspci -v -s %s" % pci,
                                                 shell=True,
                                                 session=session)
        if re.search("SR-IOV", output):
            pf_driver = re.search('driver in use: (.*)', output)[1]
            tmp_info = {'driver': pf_driver, 'pci_id': '0000:%s' % pci}

            iface_name = get_iface_name('0000:%s' % pci, session=session)

This code work when command "lspci |awk '/Ethernet/ {print $1}'" return pcie bus with short format like 02:00.0 Ethernet ... mean domain numbers are omitted since they are all equal to zero!
but, on my system return output with the domain numbers are highlighted.
eg:

lspci  | grep Ethernet
0000:01:00.0 Ethernet controller: Mellanox Technologies MT27710 Family [ConnectX-4 Lx]
0000:01:00.1 Ethernet controller: Mellanox Technologies MT27710 Family [ConnectX-4 Lx]

I suggest using -D in command lspci and remove prefix 0000:

Thanks,

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

No branches or pull requests

1 participant