Get number of maximum queues for NIC

It's needed for configure multiq for dpdk

Change-Id: Iffa1a6c872b46230de6e9ab3b8f34cb727661571
Partial-Bug: #1643920
This commit is contained in:
Mikhail 2016-12-26 18:05:19 +04:00
parent b0ee75ca91
commit 8ed8caf30a
1 changed files with 22 additions and 0 deletions

22
agent
View File

@ -581,6 +581,26 @@ class NodeAgent
end
end
def _get_max_queues(ifname)
data = `ethtool -l #{ifname}`
# Example of output to parse:
# Channel parameters for ens4f0:
# Pre-set maximums:
# RX: 0
# TX: 0
# Other: 1
# Combined: 63
# Current hardware settings:
# RX: 0
# TX: 0
# Other: 1
# Combined: 40
return nil if $?.to_i != 0
return data.scan(/Pre-set maximums:.*?Combined:\s*(\d+)/m).join.to_i
rescue
return nil
end
def _detailed
detailed_meta = {
:system => _system_info,
@ -684,6 +704,8 @@ class NodeAgent
int_meta[:interface_properties][:pci_id] = nic_pci_id(int)
# Get numa node
int_meta[:interface_properties][:numa_node] = nic_numa_node(int_meta[:bus_info])
# Get maximum queues
int_meta[:interface_properties][:max_queues] = _get_max_queues(int)
detailed_meta[:interfaces] << int_meta
end
rescue Exception => e