summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSoren Hansen <soren.hansen@rackspace.com>2010-09-27 10:39:52 +0200
committerSoren Hansen <soren.hansen@rackspace.com>2010-09-27 10:39:52 +0200
commitab2bed9ed60c5333a0f9ba3e679df9893781b72f (patch)
treef473490836ef3db5edb4a83b4006bb9f9e395095
parentcb311a3deb42094261b91467b7717f4eb3e9eaba (diff)
Apply IP configuration to bridge regardless of whether it existed before. The fixes a race condition on hosts running both compute and network where, if compute got there first, it would set up the bridge, but not do IP configuration (because that's meant to happen on the network host), and when network came around, it would see the interface already there and not configure it further.
-rw-r--r--nova/network/linux_net.py19
1 files changed, 10 insertions, 9 deletions
diff --git a/nova/network/linux_net.py b/nova/network/linux_net.py
index 41aeb5da7..9d5bd8495 100644
--- a/nova/network/linux_net.py
+++ b/nova/network/linux_net.py
@@ -118,15 +118,16 @@ def ensure_bridge(bridge, interface, net_attrs=None):
# _execute("sudo brctl setageing %s 10" % bridge)
_execute("sudo brctl stp %s off" % bridge)
_execute("sudo brctl addif %s %s" % (bridge, interface))
- if net_attrs:
- _execute("sudo ifconfig %s %s broadcast %s netmask %s up" % \
- (bridge,
- net_attrs['gateway'],
- net_attrs['broadcast'],
- net_attrs['netmask']))
- _confirm_rule("FORWARD --in-interface %s -j ACCEPT" % bridge)
- else:
- _execute("sudo ifconfig %s up" % bridge)
+
+ if net_attrs:
+ _execute("sudo ifconfig %s %s broadcast %s netmask %s up" % \
+ (bridge,
+ net_attrs['gateway'],
+ net_attrs['broadcast'],
+ net_attrs['netmask']))
+ _confirm_rule("FORWARD --in-interface %s -j ACCEPT" % bridge)
+ else:
+ _execute("sudo ifconfig %s up" % bridge)
def get_dhcp_hosts(context, network_id):