aboutsummaryrefslogtreecommitdiffstats
path: root/os_net_config/utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'os_net_config/utils.py')
-rw-r--r--os_net_config/utils.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/os_net_config/utils.py b/os_net_config/utils.py
index b7a54bf..27e888d 100644
--- a/os_net_config/utils.py
+++ b/os_net_config/utils.py
@@ -238,6 +238,14 @@ def bind_dpdk_interfaces(ifname, driver, noop):
except processutils.ProcessExecutionError:
msg = "Failed to bind interface %s with dpdk" % ifname
raise OvsDpdkBindException(msg)
+ else:
+ # Check if the pci address is already fetched and stored.
+ # If the pci address could not be fetched from dpdk_mapping.yaml
+ # raise OvsDpdkBindException, since the interface is neither
+ # available nor bound with dpdk.
+ if not get_stored_pci_address(ifname, noop):
+ msg = "Interface %s cannot be found" % ifname
+ raise OvsDpdkBindException(msg)
else:
logger.info('Interface %(name)s bound to DPDK driver %(driver)s '
'using driverctl command' %
@@ -264,6 +272,17 @@ def get_pci_address(ifname, noop):
'ethtool' % ifname)
+def get_stored_pci_address(ifname, noop):
+ if not noop:
+ dpdk_map = _get_dpdk_map()
+ for dpdk_nic in dpdk_map:
+ if dpdk_nic['name'] == ifname:
+ return dpdk_nic['pci_address']
+ else:
+ logger.info('Fetch the PCI address of the interface %s using '
+ 'ethtool' % ifname)
+
+
# Once the interface is bound to a DPDK driver, all the references to the
# interface including '/sys' and '/proc', will be removed. And there is no
# way to identify the nic name after it is bound. So, the DPDK bound nic info