This issue is found in (Backup and Snapshot APIs)
On master before merging patch[1][2], name and description with leading and trailing spaces get
removed in the method "validate_name_and_description" which is under
"https://github.com/openstack/cinder/blob/master/cinder/api/openstack/wsgi.py#L1253-L1264".
After applying schema validation, name and description is not removing leading and trailing spaces
and as it is storing in DB. IMO, it should be fixed.
Steps to reproduce:
1. curl command:
curl -g -i -X POST http://10.232.48.206/volume/v3/63759ee0b57249539af42d95a58032df/backups -H "User-Agent: python-cinderclient" -H "Content-Type: application/json" -H "X-OpenStack-Request-ID: req-3510f84a-51d4-49ec-9d69-0c34f8ffa8dc" -H "Accept: application/json" -H "X-Auth-Token: f517a81cd25a4788a01dd60f76cd6435" -d '{"backup": {"force": true, "description": null, "snapshot_id": null, "incremental": false, "volume_id": "1ae283da-b8cf-44cd-bcc0-751b85c445a6", "container": null, "name": " test", "description": " description "}}'
2. output:
202 Accepted
{"backup": {"id": "04f2abba-cc0b-45a5-9a26-8a88c4d67a12", "links": [{"href": "http://10.232.48.206/volume/v3/63759ee0b57249539af42d95a58032df/backups/04f2abba-cc0b-45a5-9a26-8a88c4d67a12", "rel": "self"}, {"href": "http://10.232.48.206/volume/63759ee0b57249539af42d95a58032df/backups/04f2abba-cc0b-45a5-9a26-8a88c4d67a12", "rel": "bookmark"}], "name": " test"}}
3. curl command:
curl -g -i -X POST http://10.232.48.198/volume/v3/5fe3b884c656498b922d8551c86cb0b0/snapshots -H "X-Auth-Token: 9c754d726df149eb837e4a6c26572117" -H "Accept: application/json" -H "Content-Type: application/json" -H "User-Agent: python-cinderclient" -d '{"snapshot": {"volume_id": "daf9e961-d6dd-41f8-9cb6-4bba0fce8a1c", "name": " abc ", "description": " test_desc "}}'
4. output:
202 Accepted
{"snapshot": {"id": "875e8050-5a53-4a5c-b2a4-d5c372b6b1c8", "name": " abc ", "volume_id": "daf9e961-d6dd-41f8-9cb6-4bba0fce8a1c", "size": 1, "status": "creating", "updated_at": null, "created_at": "2018-01-10T07:29:44.351225", "description": " test_desc ", "metadata": {}}}
[1]https://review.openstack.org/#/c/530098/
[2]https://review.openstack.org/#/c/520991/
Fix proposed to branch: master /review. openstack. org/534184
Review: https:/