Add NM_CONTROLLED=no to each interface configuration

In order to allow os-net-config to coexist with NetworkManager, this
patch adds NM_CONTROLLED=no to the top of each interface configuration.
This ensures that NetworkManager will not mess with interfaces that are
configured by os-net-config.

Change-Id: I9d226e032eb1cb411b6ea617936f4425c7fd2c74
This commit is contained in:
Dan Sneddon 2015-05-14 10:58:10 -07:00
parent b0536cb24b
commit afcd514b7c
2 changed files with 8 additions and 0 deletions

View File

@ -72,6 +72,7 @@ class IfcfgNetConfig(os_net_config.NetConfig):
data += "DEVICE=%s\n" % base_opt.name
data += "ONBOOT=yes\n"
data += "HOTPLUG=no\n"
data += "NM_CONTROLLED=no\n"
if isinstance(base_opt, objects.Vlan):
data += "VLAN=yes\n"
if base_opt.device:

View File

@ -29,6 +29,7 @@ _BASE_IFCFG = """# This file is autogenerated by os-net-config
DEVICE=em1
ONBOOT=yes
HOTPLUG=no
NM_CONTROLLED=no
"""
_NO_IP = _BASE_IFCFG + "BOOTPROTO=none\n"
@ -65,6 +66,7 @@ _OVS_BRIDGE_DHCP = """# This file is autogenerated by os-net-config
DEVICE=br-ctlplane
ONBOOT=yes
HOTPLUG=no
NM_CONTROLLED=no
DEVICETYPE=ovs
TYPE=OVSBridge
OVSBOOTPROTO=dhcp
@ -84,6 +86,7 @@ _BASE_VLAN = """# This file is autogenerated by os-net-config
DEVICE=vlan5
ONBOOT=yes
HOTPLUG=no
NM_CONTROLLED=no
VLAN=yes
PHYSDEV=em1
"""
@ -107,6 +110,7 @@ _OVS_BOND_DHCP = """# This file is autogenerated by os-net-config
DEVICE=bond0
ONBOOT=yes
HOTPLUG=no
NM_CONTROLLED=no
DEVICETYPE=ovs
TYPE=OVSBond
OVSBOOTPROTO=dhcp
@ -254,6 +258,7 @@ class TestIfcfgNetConfig(base.TestCase):
DEVICE=em2
ONBOOT=yes
HOTPLUG=no
NM_CONTROLLED=no
BOOTPROTO=none
"""
self.assertEqual(em2_config, self.get_interface_config('em2'))
@ -269,12 +274,14 @@ BOOTPROTO=none
DEVICE=em1
ONBOOT=yes
HOTPLUG=no
NM_CONTROLLED=no
BOOTPROTO=none
"""
em2_config = """# This file is autogenerated by os-net-config
DEVICE=em2
ONBOOT=yes
HOTPLUG=no
NM_CONTROLLED=no
BOOTPROTO=none
DEFROUTE=no
"""