Merge "feature: Add fixed ip filter in list_recycle_servers"
This commit is contained in:
@@ -324,6 +324,13 @@ def list_recycle_servers(
|
||||
uuid: Optional[str] = Query(
|
||||
None, description="Filter the list of recycle servers by the given recycle server UUID."
|
||||
),
|
||||
ip: Optional[str] = Query(
|
||||
None,
|
||||
description=(
|
||||
"Filter the list of recycle servers by the given IP address "
|
||||
"(only fixed, not floating). Also passed to Nova API if supported."
|
||||
),
|
||||
),
|
||||
) -> schemas.RecycleServersResponse:
|
||||
all_projects = all_projects or False
|
||||
if all_projects:
|
||||
@@ -365,6 +372,8 @@ def list_recycle_servers(
|
||||
"project_id": project_id,
|
||||
"uuid": uuid,
|
||||
}
|
||||
if ip is not None:
|
||||
search_opts["ip"] = ip
|
||||
if not all_projects:
|
||||
search_opts["project_id"] = profile.project.id
|
||||
servers = nova.list_servers(
|
||||
|
@@ -126,6 +126,7 @@ class TestListRecycleServersReal:
|
||||
project_name=None,
|
||||
name=None,
|
||||
uuid=None,
|
||||
ip="10.0.0.5",
|
||||
)
|
||||
|
||||
# Assertions
|
||||
@@ -140,6 +141,7 @@ class TestListRecycleServersReal:
|
||||
assert call_args[1]["search_opts"]["deleted"] is True
|
||||
assert call_args[1]["search_opts"]["all_tenants"] is True
|
||||
assert call_args[1]["search_opts"]["project_id"] == "test-project-id"
|
||||
assert call_args[1]["search_opts"]["ip"] == "10.0.0.5"
|
||||
|
||||
# Verify other services were called
|
||||
mock_glance.list_images.assert_called()
|
||||
|
18
swagger.json
18
swagger.json
@@ -791,6 +791,24 @@
|
||||
},
|
||||
"description": "Filter the list of recycle servers by the given recycle server UUID."
|
||||
},
|
||||
{
|
||||
"name": "ip",
|
||||
"in": "query",
|
||||
"required": false,
|
||||
"schema": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
],
|
||||
"description": "Filter the list of recycle servers by the given IP address (only fixed, not floating). Also passed to Nova API if supported.",
|
||||
"title": "Ip"
|
||||
},
|
||||
"description": "Filter the list of recycle servers by the given IP address (only fixed, not floating). Also passed to Nova API if supported."
|
||||
},
|
||||
{
|
||||
"name": "X-Openstack-Request-Id",
|
||||
"in": "header",
|
||||
|
Reference in New Issue
Block a user