diff options
Diffstat (limited to 'resources/libraries/python/DUTSetup.py')
-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 " |