aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Prince <dprince@redhat.com>2014-07-03 14:12:01 -0400
committerDan Prince <dprince@redhat.com>2014-07-03 14:12:01 -0400
commitb3318a4c54e685733bff9e5a09c00a6cce50241d (patch)
tree9670eca958477193d8dec9d8b8960bd46dbde3e9
parent7546d736d6883ee705c2b4dd1b1463d81386b2e7 (diff)
ENI: bring up bridges first on Debian
We should bring up the interfaces on boot in the same order with which we bring them up in this tool.
-rw-r--r--os_net_config/impl_eni.py12
-rw-r--r--os_net_config/tests/test_impl_eni.py2
2 files changed, 9 insertions, 5 deletions
diff --git a/os_net_config/impl_eni.py b/os_net_config/impl_eni.py
index f676a7e..b600fd9 100644
--- a/os_net_config/impl_eni.py
+++ b/os_net_config/impl_eni.py
@@ -149,15 +149,19 @@ class ENINetConfig(os_net_config.NetConfig):
def apply(self):
new_config = ""
- for interface_name, iface_data in self.interfaces.iteritems():
- route_data = self.routes.get(interface_name)
- iface_data += (route_data or '')
- new_config += iface_data
+ # write out bridges first. This ensures that an ifup -a
+ # on reboot brings them up first
for bridge_name, bridge_data in self.bridges.iteritems():
route_data = self.routes.get(bridge_name)
bridge_data += (route_data or '')
new_config += bridge_data
+
+ for interface_name, iface_data in self.interfaces.iteritems():
+ route_data = self.routes.get(interface_name)
+ iface_data += (route_data or '')
+ new_config += iface_data
+
if (utils.diff(_network_config_path(), new_config)):
for interface in self.interfaces.keys():
processutils.execute('/sbin/ifdown', interface,
diff --git a/os_net_config/tests/test_impl_eni.py b/os_net_config/tests/test_impl_eni.py
index a3656bf..28c9c98 100644
--- a/os_net_config/tests/test_impl_eni.py
+++ b/os_net_config/tests/test_impl_eni.py
@@ -198,4 +198,4 @@ class TestENINetConfigApply(base.TestCase):
self.provider.addBridge(bridge)
self.provider.apply()
iface_data = utils.get_file_data(self.temp_config_file.name)
- self.assertEqual((_OVS_PORT_IFACE + _OVS_BRIDGE_DHCP), iface_data)
+ self.assertEqual((_OVS_BRIDGE_DHCP + _OVS_PORT_IFACE), iface_data)