aboutsummaryrefslogtreecommitdiffstats
path: root/os_net_config
diff options
context:
space:
mode:
authorJaganathan Palanisamy <jpalanis@redhat.com>2017-01-19 03:00:33 -0500
committerJaganathan Palanisamy <jpalanis@redhat.com>2017-01-27 02:09:36 -0500
commitd1db332350a894e48a74a3b6b658d3d3c8d13c4a (patch)
treeb336b6f094df5f5a075e4670901ec589401731b9 /os_net_config
parent81d2a7d8715527ba5bb6c79cb7e4e379745c8feb (diff)
Network service is failing with DPDK
Network service is failing and not started when interface is binded with dpdk driver and interface config file is available. In such case, removing config file for the interface which is binded with dpdk driver. Change-Id: Id445fbfe7abdd54c2ea522960224c7f0e412dd30 Closes-Bug: #1657661
Diffstat (limited to 'os_net_config')
-rw-r--r--os_net_config/impl_ifcfg.py11
-rw-r--r--os_net_config/tests/test_impl_ifcfg.py7
2 files changed, 18 insertions, 0 deletions
diff --git a/os_net_config/impl_ifcfg.py b/os_net_config/impl_ifcfg.py
index 6c44c88..dfaf051 100644
--- a/os_net_config/impl_ifcfg.py
+++ b/os_net_config/impl_ifcfg.py
@@ -34,6 +34,13 @@ def ifcfg_config_path(name):
return "/etc/sysconfig/network-scripts/ifcfg-%s" % name
+def remove_ifcfg_config(ifname):
+ if re.match('[\w-]+$', ifname):
+ ifcfg_file = ifcfg_config_path(ifname)
+ if os.path.exists(ifcfg_file):
+ os.remove(ifcfg_file)
+
+
# NOTE(dprince): added here for testability
def bridge_config_path(name):
return ifcfg_config_path(name)
@@ -584,6 +591,8 @@ class IfcfgNetConfig(os_net_config.NetConfig):
# Bind the dpdk interface
utils.bind_dpdk_interfaces(ifname, ovs_dpdk_port.driver, self.noop)
+ if not self.noop:
+ remove_ifcfg_config(ifname)
data = self._add_common(ovs_dpdk_port)
logger.debug('ovs dpdk port data: %s' % data)
@@ -602,6 +611,8 @@ class IfcfgNetConfig(os_net_config.NetConfig):
# checks are added at the object creation stage.
ifname = dpdk_port.members[0].name
utils.bind_dpdk_interfaces(ifname, dpdk_port.driver, self.noop)
+ if not self.noop:
+ remove_ifcfg_config(ifname)
data = self._add_common(ovs_dpdk_bond)
logger.debug('ovs dpdk bond data: %s' % data)
diff --git a/os_net_config/tests/test_impl_ifcfg.py b/os_net_config/tests/test_impl_ifcfg.py
index 9621b8c..78d19cb 100644
--- a/os_net_config/tests/test_impl_ifcfg.py
+++ b/os_net_config/tests/test_impl_ifcfg.py
@@ -935,6 +935,13 @@ class TestIfcfgNetConfigApply(base.TestCase):
return self.temp_ifcfg_file.name
self.stubs.Set(impl_ifcfg, 'ifcfg_config_path', test_ifcfg_path)
+ def test_remove_ifcfg_config(name):
+ ifcfg_file = self.temp_ifcfg_file.name
+ if os.path.exists(ifcfg_file):
+ os.remove(ifcfg_file)
+ self.stubs.Set(impl_ifcfg, 'remove_ifcfg_config',
+ test_remove_ifcfg_config)
+
def test_routes_path(name):
return self.temp_route_file.name
self.stubs.Set(impl_ifcfg, 'route_config_path', test_routes_path)