Abhijeet Malawade 6b9cfa2951 Validate metadata JSON file
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
2015-01-29 05:50:01 -08:00
2014-09-13 09:24:36 +02:00
2015-01-29 05:50:01 -08:00
2015-01-29 05:50:01 -08:00
2014-09-17 16:05:17 +00:00
2014-09-17 16:05:17 +00:00
2014-02-10 10:55:11 +01:00
2014-01-24 18:30:46 +01:00
2014-10-28 18:45:21 +02:00
2014-01-24 18:30:46 +01:00
2015-01-29 05:50:01 -08:00
2014-01-24 18:30:46 +01:00
2014-12-24 15:57:29 +08:00

Glance Store Library

Glance's stores library

Description
Glance stores library
Readme 14 MiB
Languages
Python 100%