summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVishvananda Ishaya <vishvananda@gmail.com>2011-02-07 22:05:45 -0800
committerVishvananda Ishaya <vishvananda@gmail.com>2011-02-07 22:05:45 -0800
commit976420e608140e449db5748e57cb18fab74b6d43 (patch)
tree3f5bb2b244e52f8cffb2b7a7af690fec6708a02f
parentd86f1af6326d4276e9cbfb3274c211ff3f5629cb (diff)
downloadnova-976420e608140e449db5748e57cb18fab74b6d43.tar.gz
nova-976420e608140e449db5748e57cb18fab74b6d43.tar.xz
nova-976420e608140e449db5748e57cb18fab74b6d43.zip
use route -n instead of route to avoid chopped names
-rw-r--r--nova/network/linux_net.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/nova/network/linux_net.py b/nova/network/linux_net.py
index 69389b333..b66ca1973 100644
--- a/nova/network/linux_net.py
+++ b/nova/network/linux_net.py
@@ -215,10 +215,10 @@ def ensure_bridge(bridge, interface, net_attrs, set_ip=False):
# NOTE(vish): This will break if there is already an ip on the
# interface, so we move any ips to the bridge
gateway = None
- out, err = _execute("sudo route")
+ out, err = _execute("sudo route -n")
for line in out.split("\n"):
fields = line.split()
- if fields and fields[0] == "default" and fields[-1] == interface:
+ if fields and fields[0] == "0.0.0.0" and fields[-1] == interface:
gateway = fields[1]
out, err = _execute("sudo ip addr show dev %s scope global" %
interface)
@@ -229,7 +229,7 @@ def ensure_bridge(bridge, interface, net_attrs, set_ip=False):
_execute("sudo ip addr del %s dev %s" % (params, fields[-1]))
_execute("sudo ip addr add %s dev %s" % (params, bridge))
if gateway:
- _execute("sudo route add default gw %s" % gateway)
+ _execute("sudo route add 0.0.0.0 gw %s" % gateway)
out, err = _execute("sudo brctl addif %s %s" %
(bridge, interface),
check_exit_code=False)