aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpmikus <peter.mikus@protonmail.ch>2024-06-25 10:51:59 +0200
committerPeter Mikus <peter.mikus@protonmail.ch>2024-06-25 09:01:51 +0000
commitfa782f5839ed708095e0b652514888972b42faa2 (patch)
treebd8785336c741172c529fdfa2d1ae6a17c5e8d29
parentf5275f845fed64aaf8f86913e289b31b410837f2 (diff)
feat(core): Add option to disable sriov check
Signed-off-by: pmikus <peter.mikus@protonmail.ch> Change-Id: Ie8dbdf8b231dcbbbf2c90ad0f16d6b48fbdd8c5c
-rw-r--r--resources/libraries/python/DUTSetup.py8
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 "