Check to ensure active DPDK NICs only mapped once

This change ensures that active DPDK NICs are only added
to the list of mapped NICs once, and avoids duplicate entries.

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/os-net-config/dpdk_mapping.yaml for the list of
DPDK NICs and add them to the NIC mapping list.

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/os-net-config/dpdk_mapping.yaml for the NIC.
This results in the same NIC being added to the list of active
NICs twice.

Change-Id: Idbee49ce02d000043d0fa8e398aeb82f032c32aa
Closes-Bug: #1912409
(cherry picked from commit ba93c36044)
This commit is contained in:
Dan Sneddon 2021-01-19 13:51:13 -08:00
parent 17c2abc9a5
commit 92e2b77586
1 changed files with 4 additions and 2 deletions

View File

@ -251,10 +251,12 @@ def _ordered_nics(check_active):
logger.info("%s is a VF, skipping it for NIC ordering" % nic)
elif _is_embedded_nic(nic):
logger.info("%s is an embedded DPDK bound nic" % nic)
embedded_nics.append(nic)
if nic not in embedded_nics:
embedded_nics.append(nic)
else:
logger.info("%s is an DPDK bound nic" % nic)
nics.append(nic)
if nic not in nics:
nics.append(nic)
else:
logger.info("No DPDK mapping available in path (%s)" %
_DPDK_MAPPING_FILE)