NIC mapping maps DPDK NICs twice if they are already configured when os-net-config runs a second time
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
os-net-config |
Triaged
|
Medium
|
Dan Sneddon |
Bug Description
When os-net-config runs for the first time there is no entry in /sys/net for the DPDK NICs, so we look in /var/lib/
If os-net-config has been run before and the DPDK NICs are already active, there is an entry in /sys/net and also an entry in /var/lib/
For example, in the following log you can see that p2p1, p2p2, p3p1, and p3p2 are each added to the list of active NICs twice:
Jan 11 12:03:14 hostname os-collect-config: [2021/01/11 11:58:07 AM] [INFO] Active nics are ['em1', 'em2', 'p1p1', 'p1p2', 'p2p1', 'p2p1', 'p2p2', 'p2p2', 'p3p1', 'p3p1', 'p3p2',
'p3p2']
Jan 11 12:03:14 cpt0-dpdk-dell-tovb os-collect-config: [2021/01/11 11:58:07 AM] [INFO] nic2 mapped to: em2
Jan 11 12:03:14 cpt0-dpdk-dell-tovb os-collect-config: [2021/01/11 11:58:07 AM] [INFO] nic3 mapped to: p1p1
Jan 11 12:03:14 cpt0-dpdk-dell-tovb os-collect-config: [2021/01/11 11:58:07 AM] [INFO] nic4 mapped to: p1p2
Jan 11 12:03:14 cpt0-dpdk-dell-tovb os-collect-config: [2021/01/11 11:58:07 AM] [INFO] nic7 mapped to: p2p2
Jan 11 12:03:14 cpt0-dpdk-dell-tovb os-collect-config: [2021/01/11 11:58:07 AM] [INFO] nic5 mapped to: p2p1
Jan 11 12:03:14 cpt0-dpdk-dell-tovb os-collect-config: [2021/01/11 11:58:07 AM] [INFO] nic1 mapped to: em1
Jan 11 12:03:14 cpt0-dpdk-dell-tovb os-collect-config: [2021/01/11 11:58:07 AM] [INFO] nic11 mapped to: p3p2
Jan 11 12:03:14 cpt0-dpdk-dell-tovb os-collect-config: [2021/01/11 11:58:07 AM] [INFO] nic9 mapped to: p3p1
In order to fix this problem, we should check to see if a NIC name exists in the list of active NICs before adding it in utils._
241 # Adding nics which are bound to DPDK as it will not be found in '/sys'
242 # after it is bound to DPDK driver.
243 contents = get_file_
244 if contents:
245 dpdk_map = yaml.safe_
246 for item in dpdk_map:
247 # If the DPDK drivers are bound to a VF, the same needs
248 # to be skipped for the NIC ordering
249 nic = item['name']
250 if _is_vf(
251 logger.info("%s is a VF, skipping it for NIC ordering" % nic)
252 elif _is_embedded_
253 logger.info("%s is an embedded DPDK bound nic" % nic)
254 embedded_
255 else:
256 logger.info("%s is an DPDK bound nic" % nic)
257 nics.append(nic) # <-- Check needed here
Minor correction, the active NICs appear in /sys/class/net, not in /sys/net.