Merge "HAProxy - Add host routes to the lbaas namespace"

This commit is contained in:
Jenkins 2016-11-11 23:53:16 +00:00 committed by Gerrit Code Review
commit 42832505ed
1 changed files with 9 additions and 1 deletions

View File

@ -331,10 +331,18 @@ class HaproxyNSDriver(agent_device_driver.AgentDeviceDriver):
device = ip_lib.IPDevice(interface_name, namespace=namespace)
device.addr.wait_until_address_ready(vip_address)
# Add subnet host routes
host_routes = port.fixed_ips[0].subnet.host_routes
for host_route in host_routes:
if host_route.destination != "0.0.0.0/0":
cmd = ['route', 'add', '-net', host_route.destination,
'gw', host_route.nexthop]
ip_wrapper = ip_lib.IPWrapper(namespace=namespace)
ip_wrapper.netns.execute(cmd, check_exit_code=False)
gw_ip = port.fixed_ips[0].subnet.gateway_ip
if not gw_ip:
host_routes = port.fixed_ips[0].subnet.host_routes
for host_route in host_routes:
if host_route.destination == "0.0.0.0/0":
gw_ip = host_route.nexthop