From 27106f56e4dc5cbdd4ef910310578a97f5670df8 Mon Sep 17 00:00:00 2001 From: Liping Mao Date: Fri, 20 May 2016 00:39:55 +0800 Subject: [PATCH] Fix run docker error on the network with host route Add ROUTE_TYPE definition in constants.py, this is used when kuryr process host route. Change-Id: I6f076ea1d8f7dafe8d459b0dc04bf6b290e2ed48 Closes-Bug: #1583692 --- kuryr/common/constants.py | 7 +++++++ kuryr/controllers.py | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/kuryr/common/constants.py b/kuryr/common/constants.py index 30f531df..37fe6f5b 100644 --- a/kuryr/common/constants.py +++ b/kuryr/common/constants.py @@ -18,6 +18,13 @@ SCHEMA = { "SUCCESS": {} } +# Routes are either given a RouteType of 0 and a value for NextHop; +# or, a RouteType of 1 and no value for NextHop, meaning a connected route. +ROUTE_TYPE = { + "NEXTHOP": 0, + "CONNECTED": 1 +} + DEVICE_OWNER = 'kuryr:container' NIC_NAME_LEN = 14 VETH_PREFIX = 'tap' diff --git a/kuryr/controllers.py b/kuryr/controllers.py index c34c3cfa..8060f770 100644 --- a/kuryr/controllers.py +++ b/kuryr/controllers.py @@ -843,10 +843,10 @@ def network_driver_join(): 'Destination': host_route['destination'] } if host_route.get('nexthop', None): - static_route['RouteType'] = const.TYPES['NEXTHOP'] + static_route['RouteType'] = const.ROUTE_TYPE['NEXTHOP'] static_route['NextHop'] = host_route['nexthop'] else: - static_route['RouteType'] = const.TYPES['CONNECTED'] + static_route['RouteType'] = const.ROUTE_TYPE['CONNECTED'] join_response['StaticRoutes'].append(static_route) return flask.jsonify(join_response)