Make 'device' optional in volume attach response schema

Volume attachment for server can return with no 'device' or as None
in response. It is optional on those APIs.

List and Show API does not include the 'device' in response if no
mountpoint for volume attachment.

{
    "volumeAttachments": [
        {
            "id": "a26887c6-c47b-4654-abb5-dfadf7d3f803",
            "serverId": "4d8c3732-a248-40ed-bebc-539a6ffd25c0",
            "volumeId": "a26887c6-c47b-4654-abb5-dfadf7d3f803"
        }
    ]
}

ref-https://github.com/openstack/nova/blob/240b3507e218c3f8d59e12dd067790eafec1e969/nova/api/openstack/compute/volumes.py#L223-L224

Create API includes 'device' but with None value.
{
    "volumeAttachment": {
        "device": null,
        "id": "a26887c6-c47b-4654-abb5-dfadf7d3f803",
        "serverId": "0c92f3f6-c253-4c9b-bd43-e880a8d2eb0a",
        "volumeId": "a26887c6-c47b-4654-abb5-dfadf7d3f803"
    }
}

One example will be when server is in shelved offload state where server
is not on any host so there will not be any mountpoint for attached volume.

This commit makes that element optional in response schema too.

Change-Id: I377307bb92583f84c4fa147aa608ca27615f0f8b
Related-Bug: #1554440
1 file changed