Allow storage drivers to add metadata to locations

This patches allows a storage system to add metadata to a location.
For example, if a location is a file:// URL the storage system may
wish to add information about it like the following:
{'FS': Gluster, 'mountpoint': '/usr/local/', 'namespace': 'abc-efg-xyz'}
Such information can be useful to a client with access to the direct
URL (often times the URL alone cannot encode enough information).

With this change when new data is added to the store a dictionary
is returned along with URL.  That dictionary is then stored in the
DB with the URL.  It is up to each store to determine what is in this
metadata dictionary.  Possible way to do so are with a configuration
file.  This patch does not included storage systems (other than tests)
that set this information.

If the API service is configured with the follow options:

    show_multiple_locations = True

then the location and the location information is returned with the
image information in the field 'locations'.  locations is
a list with the following format:

{'url': '<url>', 'metadata': <a storage specific dict>}

With this patch it will always be a list of one, but future patches
relating to the blueprint multiple-image-locations will allow for more.

blueprint: direct-url-meta-data
blueprint: multiple-image-locations
docimpact: show_multiple_locations

Change-Id: Ia832b8a8366bb06bfbaa53871af39a6a10b5721d
Adds missing error msg for HTTPNotFound exception

Fixes bug 1199373

Change-Id: Ie1e554bd192c90de420672e4b87c489b8ffffc85
Make db properties functions consistent with the DB API

Currently property related functions are not consistent with the
database API. As for the create operation, the API returns an
ImageProperty model instead of a dictionary and in the case of the
delete operation, the function expects a property instance instead of a
reference name.

This patch makes both calls consistent by returning a dictionary when a
property is created and receiving a property name instead of its
instance when a property needs to be deleted.

Fixes bug: #1199364
Implements blueprint registry-db-driver

Change-Id: Ibc7067cf712942610c7507f22f8895c2d531172a
Merge "Allow storage drivers to add metadata to locations"
Merge "Make db properties functions consistent with the DB API"
Adding multiple locations support to image downloading

Enable image domain object fetch data from multiple locations, allow API
client consume image from multiple backend store.

Implement bp: multiple-locations-downloading

Change-Id: I512e2b517ac0222339d61c490d620fc414dd8e7a
Signed-off-by: Zhi Yan Liu <zhiyanl@cn.ibm.com>
Add/remove/replace locations from an image

This patch modifies the PATCH /v2/images/{id} API call. Clients can add,
remove and replace locations from the set of multiple locations
associated with a given image ID in the following way:

PATCH /images/1234
[{"op": "add", "path": "/locations/-",
  "value": {"url": "scheme3://path3", "metadata": {}}}]
PATCH /images/1234
[{"op": "add", "path": "/locations/1",
  "value": {"url": "scheme4://path4", "metadata": {}}}]
PATCH /images/1234
[{"op": "remove", "path": "/locations/2"}]
PATCH /images/1234
[{"op": "replace", "path": "/locations", "value": []}]
PATCH /images/5678
[{"op": "replace", "path": "/locations",
  "value": [{"url": "scheme5://path5", "metadata": {}},
            {"url": "scheme6://path6", "metadata": {}}]}]

Glance will check location correctness when client adding, and will
remove the image content from the store when client remove a location.

Implement bp: multiple-image-locations
docimpact

Change-Id: I845646fde22e18be27929b5ec70ef8041b6fa733
Signed-off-by: Zhi Yan Liu <zhiyanl@cn.ibm.com>
Merge "Add/remove/replace locations from an image"
Merge "Adds missing error msg for HTTPNotFound exception"