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
This commit is contained in:
Rajat Dhasmana 2022-01-04 05:26:12 -05:00
parent c2f5a47cfb
commit 81c91f0ec2
1 changed files with 1 additions and 1 deletions

View File

@ -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']},