Set resource_url when getting all ports or portgroups
Since the default value resource_url is None, make sure the parameter is set to 'ports' when getting all ports. Change-Id: Id603ae5a4a802dfc8f866b15c8d327d95eba9310
This commit is contained in:
parent
097ec2f8ee
commit
2ac740e09d
@ -407,10 +407,12 @@ class PortsController(rest.RestController):
|
||||
and not uuidutils.is_uuid_like(node)):
|
||||
raise exception.NotAcceptable()
|
||||
|
||||
resource_url = 'ports'
|
||||
return self._get_ports_collection(node_uuid or node, address,
|
||||
portgroup, marker, limit, sort_key,
|
||||
sort_dir, fields=fields,
|
||||
detail=detail, project=project)
|
||||
sort_dir, resource_url=resource_url,
|
||||
fields=fields, detail=detail,
|
||||
project=project)
|
||||
|
||||
@METRICS.timer('PortsController.detail')
|
||||
@method.expose()
|
||||
|
@ -283,10 +283,12 @@ class PortgroupsController(pecan.rest.RestController):
|
||||
fields = api_utils.get_request_return_fields(fields, detail,
|
||||
_DEFAULT_RETURN_FIELDS)
|
||||
|
||||
resource_url = 'portgroups'
|
||||
return self._get_portgroups_collection(node, address,
|
||||
marker, limit,
|
||||
sort_key, sort_dir,
|
||||
fields=fields,
|
||||
resource_url=resource_url,
|
||||
detail=detail,
|
||||
project=project)
|
||||
|
||||
|
@ -1495,6 +1495,7 @@ class TestListNodes(test_api_base.BaseApiTest):
|
||||
headers=headers)
|
||||
self.assertEqual(1, len(data['portgroups']))
|
||||
self.assertIn('next', data)
|
||||
self.assertIn('portgroups', data['next'])
|
||||
|
||||
def test_portgroups_subresource_link(self):
|
||||
node = obj_utils.create_test_node(self.context)
|
||||
@ -1533,6 +1534,7 @@ class TestListNodes(test_api_base.BaseApiTest):
|
||||
data = self.get_json('/nodes/%s/ports?limit=1' % node.uuid)
|
||||
self.assertEqual(1, len(data['ports']))
|
||||
self.assertIn('next', data)
|
||||
self.assertIn('ports', data['next'])
|
||||
|
||||
def test_ports_subresource_noid(self):
|
||||
node = obj_utils.create_test_node(self.context)
|
||||
|
@ -0,0 +1,6 @@
|
||||
---
|
||||
fixes:
|
||||
- |
|
||||
Fixes an issue where clients would get a 404 due to the port and
|
||||
portgroups pagination breaking at max_limit due to an uninitialised
|
||||
resource_url.
|
Loading…
Reference in New Issue
Block a user