
If metadata is not valid dictionary then glance-api throws 'internal server' error. Validating metadata JSON file using jsonschema library at configuration stage and caching metadata and using it directly when new image being added. Metadata JSON file requires 'id' and 'mountpoint' keys to be 'string'. If value of 'id' and 'mountpoint' are not string then it will raise ValidationError error. After getting exception during json data validation, 'BadStoreConfiguration' exception will be raised. If metadata file is list of dicts containing multiple mountpoints then returned image metadata as dict containing exact mountpoint where image is stored. If image path do not starts with any of the 'mountpoint' provided in metadata JSON file then error is logged and empty dictionary is returned to glance api. DocImpact: Metadata JSON schema file should be valid object. This JSON object should contain keys 'id', 'mountpoint' and value of both keys should be string. Example of valid metadata JSON: 1. If there is only one mountpoint- { "id": "f0781415-cf81-47cd-8860-b83f9c2a415c", "mountpoint": "/var/lib/glance/images/" } 2. If there are more than one mountpoints- [ { "id": "f0781415-cf81-47cd-8860-b83f9c2a415c", "mountpoint": "/var/lib/glance/images1/" }, { "id": "asd81415-cf81-47cd-8860-b83f9c2a415c", "mountpoint": "/var/lib/glance/images2/" } ] Change-Id: I76b0a0de54e909fb0ec90bd7f9972da76a2501eb Closes-Bug: 1401778
Glance Store Library
Glance's stores library
Description
Languages
Python
100%