We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 9aaeff1 + 39678db commit 43b9216Copy full SHA for 43b9216
1 file changed
avocado/utils/pci.py
@@ -20,7 +20,6 @@
20
Module for all PCI devices related functions.
21
"""
22
23
-
24
import errno
25
import os
26
import re
@@ -697,3 +696,19 @@ def get_cfg(dom_pci_address):
697
696
device_subvendor = re.search(r"([0-9a-e]{8})", cfg_dic["Description"])
698
cfg_dic["subvendor_device"] = device_subvendor.group()
699
return cfg_dic
+
700
701
+def is_accelerator():
702
+ """
703
+ Checks if any PCI device is of class 'accelerator'.
704
705
+ :return: True if an accelerator device is found, False otherwise.
706
+ :rtype: bool
707
708
+ for dev in os.listdir("/sys/bus/pci/devices"):
709
+ try:
710
+ if get_pci_class_name(dev) == "accelerator":
711
+ return True
712
+ except ValueError:
713
+ continue
714
+ return False
0 commit comments