Wrap interface function for multihash correctly

The store_add_to_backend_with_multihash() function was not wrapped
correctly so that Glance could consume the secure hash value.  This
patch adds the correct wrapping.

Closes-bug: #1784420

Change-Id: I7a94dfffb61fc212abb58c1e1aec5884474b6aa8
This commit is contained in:
Brian Rosmaita 2018-07-30 11:54:27 -04:00 committed by Abhishek Kekane
parent c369ba013f
commit 4d4cf1559c
2 changed files with 19 additions and 0 deletions

View File

@ -532,6 +532,15 @@ def add_to_backend(conf, image_id, data, size, scheme=None, context=None,
verifier)
def add_to_backend_with_multihash(conf, image_id, data, size, hashing_algo,
scheme=None, context=None, verifier=None):
if scheme is None:
scheme = conf['glance_store']['default_store']
store = get_store_from_scheme(scheme)
return store_add_to_backend_with_multihash(
image_id, data, size, hashing_algo, store, context, verifier)
def set_acls(location_uri, public=False, read_tenants=[],
write_tenants=None, context=None):

View File

@ -279,6 +279,16 @@ def add(conf, image_id, data, size, backend, context=None,
verifier)
def add_with_multihash(conf, image_id, data, size, backend, hashing_algo,
scheme=None, context=None, verifier=None):
if not backend:
backend = conf.glance_store.default_backend
store = get_store_from_store_identifier(backend)
return store_add_to_backend_with_multihash(
image_id, data, size, hashing_algo, store, context, verifier)
def _check_metadata(store, metadata):
if not isinstance(metadata, dict):
msg = (_("The storage driver %(driver)s returned invalid "