From 4d4cf1559cf393a2a10a458f83209cbeb2756e49 Mon Sep 17 00:00:00 2001 From: Brian Rosmaita Date: Mon, 30 Jul 2018 11:54:27 -0400 Subject: [PATCH] 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 --- glance_store/backend.py | 9 +++++++++ glance_store/multi_backend.py | 10 ++++++++++ 2 files changed, 19 insertions(+) diff --git a/glance_store/backend.py b/glance_store/backend.py index cffcf19b..5e53f6ef 100644 --- a/glance_store/backend.py +++ b/glance_store/backend.py @@ -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): diff --git a/glance_store/multi_backend.py b/glance_store/multi_backend.py index fec5bf68..9f0e507b 100644 --- a/glance_store/multi_backend.py +++ b/glance_store/multi_backend.py @@ -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 "