aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Prince <dprince@redhat.com>2015-05-14 15:18:26 -0400
committerDan Prince <dprince@redhat.com>2015-06-03 21:44:08 -0400
commitca30a67a6d56e8f72d23003ffde477e4546a209d (patch)
treeef131b73c29e1370a466d1ba259ebe966d5658f9
parent6f2f62b73b165f1fc431cff0656d70adfe97e4a0 (diff)
Don't set OVSDHCPINTERFACES if bridge is static
Updates the ifcfg provider so that we don't set the OVSDHCPINTERFACES config setting if the interface is private. This doesn't seem to cause any functional issues but it is not required and can be confusing. Change-Id: I9d51905df87969ae1b221680e8f0b5befc7b6bfe
-rw-r--r--os_net_config/impl_ifcfg.py3
-rw-r--r--os_net_config/tests/test_impl_ifcfg.py23
2 files changed, 25 insertions, 1 deletions
diff --git a/os_net_config/impl_ifcfg.py b/os_net_config/impl_ifcfg.py
index 097552a..2411951 100644
--- a/os_net_config/impl_ifcfg.py
+++ b/os_net_config/impl_ifcfg.py
@@ -95,7 +95,8 @@ class IfcfgNetConfig(os_net_config.NetConfig):
if base_opt.members:
members = [member.name for member in base_opt.members]
self.member_names[base_opt.name] = members
- data += ("OVSDHCPINTERFACES=\"%s\"\n" % " ".join(members))
+ if base_opt.use_dhcp:
+ data += ("OVSDHCPINTERFACES=\"%s\"\n" % " ".join(members))
if base_opt.primary_interface_name:
mac = utils.interface_mac(base_opt.primary_interface_name)
ovs_extra.append("set bridge %s other-config:hwaddr=%s" %
diff --git a/os_net_config/tests/test_impl_ifcfg.py b/os_net_config/tests/test_impl_ifcfg.py
index f43faed..754fbcd 100644
--- a/os_net_config/tests/test_impl_ifcfg.py
+++ b/os_net_config/tests/test_impl_ifcfg.py
@@ -73,6 +73,18 @@ OVSBOOTPROTO=dhcp
OVSDHCPINTERFACES="em1"
"""
+_OVS_BRIDGE_STATIC = """# This file is autogenerated by os-net-config
+DEVICE=br-ctlplane
+ONBOOT=yes
+HOTPLUG=no
+NM_CONTROLLED=no
+DEVICETYPE=ovs
+TYPE=OVSBridge
+BOOTPROTO=static
+IPADDR=192.168.1.2
+NETMASK=255.255.255.0
+"""
+
_OVS_BRIDGE_DHCP_PRIMARY_INTERFACE = _OVS_BRIDGE_DHCP + \
"OVS_EXTRA=\"set bridge br-ctlplane other-config:hwaddr=a1:b2:c3:d4:e5\"\n"
@@ -195,6 +207,17 @@ class TestIfcfgNetConfig(base.TestCase):
self.assertEqual(_OVS_BRIDGE_DHCP,
self.provider.bridge_data['br-ctlplane'])
+ def test_network_ovs_bridge_static(self):
+ v4_addr = objects.Address('192.168.1.2/24')
+ interface = objects.Interface('em1')
+ bridge = objects.OvsBridge('br-ctlplane', members=[interface],
+ addresses=[v4_addr])
+ self.provider.add_interface(interface)
+ self.provider.add_bridge(bridge)
+ self.assertEqual(_OVS_INTERFACE, self.get_interface_config())
+ self.assertEqual(_OVS_BRIDGE_STATIC,
+ self.provider.bridge_data['br-ctlplane'])
+
def test_network_ovs_bridge_with_dhcp_primary_interface(self):
def test_interface_mac(name):
return "a1:b2:c3:d4:e5"