Add support for multi-store import

This change adds support for providing multiple target
stores where image can be imported.

Co-authored-by: Erno Kuvaja <jokke@usr.fi>
Co-authored-by: Abhishek Kekane <akekane@redhat.com>

bp: import-multi-stores
Change-Id: I8730364263f1afd5d11fd56939851bda73a892bb
This commit is contained in:
Erno Kuvaja
2019-12-18 10:30:54 +00:00
committed by Abhishek Kekane
parent 23fb691dfb
commit c23d86738f
4 changed files with 277 additions and 11 deletions
+10 -1
View File
@@ -318,13 +318,22 @@ class Controller(object):
@utils.add_req_id_to_object()
def image_import(self, image_id, method='glance-direct', uri=None,
backend=None):
backend=None, stores=None, allow_failure=True,
all_stores=None):
"""Import Image via method."""
headers = {}
url = '/v2/images/%s/import' % image_id
data = {'method': {'name': method}}
if stores:
data['stores'] = stores
if allow_failure:
data['all_stores_must_succeed'] = 'false'
if backend is not None:
headers['x-image-meta-store'] = backend
if all_stores:
data['all_stores'] = 'true'
if allow_failure:
data['all_stores_must_succeed'] = 'false'
if uri:
if method == 'web-download':