From 81c91f0ec258c77cfc7ac1cec6f2f1e2feaa5efa Mon Sep 17 00:00:00 2001 From: Rajat Dhasmana Date: Tue, 4 Jan 2022 05:26:12 -0500 Subject: [PATCH] Fix: Schema validation of volume list detail When doing the attachment of volume with glance host, the "server_id" field of volume attachment response is null which is not handled in the schema validation of list volume with detail. This caused a failure in one of the tempest volume test "test_unmanage_manage_volume" where we do a list volume with detail request and one volume (probably from other test running in parallel) existed with an active attachment to the glance host[2]. We can see that the "server_id" field of the attached volume is null[3]. The "server_id" field is only present when doing the attachment with nova. This patch allows the "server_id" to be "string" as well as "null" type to handle both nova and glance usecase. [1] https://86aa517b6cb393144dd6-d78b0c94e26e635eac828273888f290f.ssl.cf5.rackcdn.com/822731/1/check/glance-multistore-cinder-import/e52281e/testr_results.html [2] Body: b'{"volumes": [{"id": "e11beb8b-e170-4c5c-945b-e854c01f85ab", "status": "in-use",... , "attachments": [{"id": "e11beb8b-e170-4c5c-945b-e854c01f85ab", "attachment_id": "5132d152-54c3-4aa6-90e8-f13d2d1d0028", "volume_id": "e11beb8b-e170-4c5c-945b-e854c01f85ab", "server_id": null, "host_name": "ubuntu-focal-inmotion-iad3-0027876140", "device": "glance_store",... [3] "server_id": null Closes-Bug: #1956340 Change-Id: I92d4d49bf5fe52f3417555260e0771397f18334d --- tempest/lib/api_schema/response/volume/volumes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tempest/lib/api_schema/response/volume/volumes.py b/tempest/lib/api_schema/response/volume/volumes.py index ffcf488b59..4f445263c0 100644 --- a/tempest/lib/api_schema/response/volume/volumes.py +++ b/tempest/lib/api_schema/response/volume/volumes.py @@ -21,7 +21,7 @@ attachments = { 'items': { 'type': 'object', 'properties': { - 'server_id': {'type': 'string', 'format': 'uuid'}, + 'server_id': {'type': ['string', 'null'], 'format': 'uuid'}, 'attachment_id': {'type': 'string', 'format': 'uuid'}, 'attached_at': parameter_types.date_time_or_null, 'host_name': {'type': ['string', 'null']},