Merge "Fix routes disappeared by shared routers with different tenants"

This commit is contained in:
Jenkins 2015-06-30 15:06:40 +00:00 committed by Gerrit Code Review
commit fdd4f41671
2 changed files with 5 additions and 3 deletions

View File

@ -1318,10 +1318,12 @@ class NsxVPluginV2(agents_db.AgentDbMixin,
for route in routes:
for port in ports:
for ip in port['fixed_ips']:
subnet = self.get_subnet(context, ip['subnet_id'])
subnet = self.get_subnet(context.elevated(),
ip['subnet_id'])
if netaddr.all_matching_cidrs(
route['nexthop'], [subnet['cidr']]):
net = self.get_network(context, subnet['network_id'])
net = self.get_network(context.elevated(),
subnet['network_id'])
route['network_id'] = net['id']
if net.get(ext_net_extn.EXTERNAL):
route['external'] = True

View File

@ -83,7 +83,7 @@ class RouterSharedDriver(router_driver.RouterBaseDriver):
routes = self.plugin._get_extra_routes_by_router_id(
context, router_id)
filters = {'device_id': [router_id]}
ports = self.plugin.get_ports(context, filters)
ports = self.plugin.get_ports(context.elevated(), filters)
self.plugin._add_network_info_for_routes(context, routes, ports)
all_routes.extend(routes)
if not nexthop: