Class: Radfish::PciInfo
- Inherits:
-
Object
- Object
- Radfish::PciInfo
- Defined in:
- lib/radfish/pci_info.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
Instance Method Summary collapse
-
#devices ⇒ Object
Get all PCI devices.
-
#devices_by_manufacturer(manufacturer) ⇒ Object
Find PCI devices by manufacturer.
-
#initialize(client) ⇒ PciInfo
constructor
A new instance of PciInfo.
-
#mellanox_devices ⇒ Object
Find Mellanox devices.
-
#network_controllers ⇒ Object
Get network controllers.
-
#nics_with_slots ⇒ Object
Get NICs with PCI slot information.
Constructor Details
#initialize(client) ⇒ PciInfo
Returns a new instance of PciInfo.
7 8 9 10 |
# File 'lib/radfish/pci_info.rb', line 7 def initialize(client) @client = client @cache = {} end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
5 6 7 |
# File 'lib/radfish/pci_info.rb', line 5 def client @client end |
Instance Method Details
#devices ⇒ Object
Get all PCI devices
13 14 15 |
# File 'lib/radfish/pci_info.rb', line 13 def devices @cache[:devices] ||= @client.adapter.pci_devices end |
#devices_by_manufacturer(manufacturer) ⇒ Object
Find PCI devices by manufacturer
23 24 25 |
# File 'lib/radfish/pci_info.rb', line 23 def devices_by_manufacturer(manufacturer) devices.select { |d| d.manufacturer&.match?(/#{manufacturer}/i) } end |
#mellanox_devices ⇒ Object
Find Mellanox devices
28 29 30 |
# File 'lib/radfish/pci_info.rb', line 28 def mellanox_devices devices_by_manufacturer('Mellanox') end |
#network_controllers ⇒ Object
Get network controllers
33 34 35 |
# File 'lib/radfish/pci_info.rb', line 33 def network_controllers devices.select { |d| d.device_class&.match?(/NetworkController/i) } end |
#nics_with_slots ⇒ Object
Get NICs with PCI slot information
18 19 20 |
# File 'lib/radfish/pci_info.rb', line 18 def nics_with_slots @cache[:nics_with_slots] ||= @client.adapter.nics_with_pci_info end |