diff options
author | pmikus <peter.mikus@protonmail.ch> | 2024-06-25 10:51:59 +0200 |
---|---|---|
committer | pmikus <peter.mikus@protonmail.ch> | 2024-06-25 10:51:59 +0200 |
commit | 5afe20e6d68b4a73f468b4a661c409318fe96db4 (patch) | |
tree | 53215e37aca12ae02507b54d5a16b15d408e5d99 /resources | |
parent | 1089a589b2f7abe16d1de3d0afcdca1afdd16362 (diff) |
feat(core): Add option to disable sriov check
Signed-off-by: pmikus <peter.mikus@protonmail.ch>
Change-Id: Ie8dbdf8b231dcbbbf2c90ad0f16d6b48fbdd8c5c
Diffstat (limited to 'resources')
-rw-r--r-- | resources/libraries/python/DUTSetup.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/resources/libraries/python/DUTSetup.py b/resources/libraries/python/DUTSetup.py index f9758c5f9f..b92bf1d85d 100644 --- a/resources/libraries/python/DUTSetup.py +++ b/resources/libraries/python/DUTSetup.py @@ -298,7 +298,8 @@ class DUTSetup: return sriov_numvfs @staticmethod - def set_sriov_numvfs(node, pf_pci_addr, path="devices", numvfs=0): + def set_sriov_numvfs( + node, pf_pci_addr, path="devices", numvfs=0, skip_check=True): """Init or reset SR-IOV virtual functions by setting its number on PCI device on DUT. Setting to zero removes all VFs. @@ -306,10 +307,12 @@ class DUTSetup: :param pf_pci_addr: Physical Function PCI device address. :param path: Either device or driver. :param numvfs: Number of VFs to initialize, 0 - removes the VFs. + :param skip_check: Return anyway. :type node: dict :type pf_pci_addr: str :type path: str :type numvfs: int + :type skip_check: bool :raises RuntimeError: Failed to create VFs on PCI. """ cmd = f"test -f /sys/bus/pci/{path}/{pf_pci_addr}/sriov_numvfs" @@ -320,6 +323,9 @@ class DUTSetup: # sriov is not supported and we want 0 VFs # no need to do anything return + if numvfs > 0 AND skip_check: + # we may be in VM + return raise RuntimeError( f"Can't configure {numvfs} VFs on {pf_pci_addr} device " |