Read device PCIID instead of subsystem one
For some devices like Virtio network device [1af4:1000], there is
invalid PCIID in /sys/class/net.
Change-Id: I3bc514c2d57e3a7669c418e49830491041cb8f52
Closes-Bug: #1655733
(cherry picked from commit 0a306b1dc7
)
This commit is contained in:
parent
f7169a9314
commit
5e119e08c3
8
agent
8
agent
|
@ -511,9 +511,9 @@ class NodeAgent
|
||||||
DEFAULT_SRIOV
|
DEFAULT_SRIOV
|
||||||
end
|
end
|
||||||
|
|
||||||
def nic_pci_id(int)
|
def nic_pci_id(bus_info)
|
||||||
vendor = File.read("/sys/class/net/#{int}/device/vendor").chomp.gsub(/^0x/, '')
|
vendor = File.read("/sys/bus/pci/devices/#{bus_info}/vendor").chomp.gsub(/^0x/, '')
|
||||||
device = File.read("/sys/class/net/#{int}/device/device").chomp.gsub(/^0x/, '')
|
device = File.read("/sys/bus/pci/devices/#{bus_info}/device").chomp.gsub(/^0x/, '')
|
||||||
"#{vendor}:#{device}"
|
"#{vendor}:#{device}"
|
||||||
rescue
|
rescue
|
||||||
""
|
""
|
||||||
|
@ -701,7 +701,7 @@ class NodeAgent
|
||||||
# Getting SR-IOV info
|
# Getting SR-IOV info
|
||||||
int_meta[:interface_properties][:sriov] = sriov_info(int, int_meta[:bus_info])
|
int_meta[:interface_properties][:sriov] = sriov_info(int, int_meta[:bus_info])
|
||||||
# Get PCI-ID
|
# Get PCI-ID
|
||||||
int_meta[:interface_properties][:pci_id] = nic_pci_id(int)
|
int_meta[:interface_properties][:pci_id] = nic_pci_id(int_meta[:bus_info])
|
||||||
# Get numa node
|
# Get numa node
|
||||||
int_meta[:interface_properties][:numa_node] = nic_numa_node(int_meta[:bus_info])
|
int_meta[:interface_properties][:numa_node] = nic_numa_node(int_meta[:bus_info])
|
||||||
# Get maximum queues
|
# Get maximum queues
|
||||||
|
|
Loading…
Reference in New Issue