Skip to content

Commit f583f32

Browse files
Zuulopenstack-gerrit
authored andcommitted
Merge "Fix port listing for trunks case"
2 parents 8937d23 + dc868dc commit f583f32

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

openstack_dashboard/api/neutron.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1873,6 +1873,8 @@ def port_list_with_trunk_types(request, **params):
18731873
trunk_filters = {}
18741874
if 'tenant_id' in params:
18751875
trunk_filters['tenant_id'] = params['tenant_id']
1876+
elif 'project_id' in params:
1877+
trunk_filters['project_id'] = params['project_id']
18761878
trunks = networkclient(request).trunks(**trunk_filters)
18771879
parent_ports = set(t['port_id'] for t in trunks)
18781880
# Create a dict map for child ports (port ID to trunk info)

openstack_dashboard/api/rest/neutron.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,9 @@ def get(self, request):
138138
a port.
139139
"""
140140
# https://opendev.org/openstack/neutron/src/branch/master/neutron/tests/unit/extensions/v2attributes.py
141-
project_id = request.user.project_id
142-
result = api.neutron.port_list_with_trunk_types(request,
143-
project_id=project_id,
144-
**request.GET.dict())
141+
params = request.GET.dict()
142+
params.setdefault("project_id", request.user.project_id)
143+
result = api.neutron.port_list_with_trunk_types(request, **params)
145144
return {'items': [n.to_dict() for n in result]}
146145

147146

0 commit comments

Comments
 (0)