Fix routes disappeared by shared routers with different tenants
When we try to update routes on shared edge with non-admin tenant, routes belong to other tenants would be disappeared on the edge. The patch fixed the problem by getting all relative objects with admin privilege. Change-Id: I6be20edb11f7d973b9f870aa1e9d2cb0e42ff5a2
This commit is contained in:
parent
2fb6611380
commit
0d8d92d9d5
@ -1316,10 +1316,12 @@ class NsxVPluginV2(agents_db.AgentDbMixin,
|
|||||||
for route in routes:
|
for route in routes:
|
||||||
for port in ports:
|
for port in ports:
|
||||||
for ip in port['fixed_ips']:
|
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(
|
if netaddr.all_matching_cidrs(
|
||||||
route['nexthop'], [subnet['cidr']]):
|
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']
|
route['network_id'] = net['id']
|
||||||
if net.get(ext_net_extn.EXTERNAL):
|
if net.get(ext_net_extn.EXTERNAL):
|
||||||
route['external'] = True
|
route['external'] = True
|
||||||
|
@ -83,7 +83,7 @@ class RouterSharedDriver(router_driver.RouterBaseDriver):
|
|||||||
routes = self.plugin._get_extra_routes_by_router_id(
|
routes = self.plugin._get_extra_routes_by_router_id(
|
||||||
context, router_id)
|
context, router_id)
|
||||||
filters = {'device_id': [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)
|
self.plugin._add_network_info_for_routes(context, routes, ports)
|
||||||
all_routes.extend(routes)
|
all_routes.extend(routes)
|
||||||
if not nexthop:
|
if not nexthop:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user