Change location metadata key 'backend' to 'store'
As a part of vocabulary correction, changed the location metadata key name from 'backend' to 'store'. Modified corresponding tests as well. bp:multi-store-vocabulary-correction Change-Id: Iae3503cba6be362b372e1fc3e75c2ddb1e99b763
This commit is contained in:
parent
4915fb8793
commit
0e55ad71a8
@ -1045,7 +1045,7 @@ class ResponseSerializer(wsgi.JSONResponseSerializer):
|
||||
if locations:
|
||||
stores = []
|
||||
for loc in locations:
|
||||
backend = loc['metadata'].get('backend')
|
||||
backend = loc['metadata'].get('store')
|
||||
if backend:
|
||||
stores.append(backend)
|
||||
|
||||
@ -1238,10 +1238,13 @@ def get_base_properties():
|
||||
'readOnly': True,
|
||||
'description': _('An image file url'),
|
||||
},
|
||||
'backend': {
|
||||
'stores': {
|
||||
'type': 'string',
|
||||
'readOnly': True,
|
||||
'description': _('Backend store to upload image to'),
|
||||
'description': _('Store in which image data resides. Only '
|
||||
'present when the operator has enabled multiple '
|
||||
'stores. May be a comma-separated list of store '
|
||||
'identifiers.'),
|
||||
},
|
||||
'schema': {
|
||||
'type': 'string',
|
||||
|
@ -47,7 +47,7 @@ def safe_delete_from_backend(context, image_id, location):
|
||||
|
||||
try:
|
||||
if CONF.enabled_backends:
|
||||
backend = location['metadata'].get('backend')
|
||||
backend = location['metadata'].get('store')
|
||||
ret = store_api.delete(location['url'],
|
||||
backend,
|
||||
context=context)
|
||||
|
@ -67,7 +67,7 @@ class ImageRepoProxy(glance.domain.proxy.Repo):
|
||||
for location in image.locations:
|
||||
if CONF.enabled_backends:
|
||||
self.store_api.set_acls_for_multi_store(
|
||||
location['url'], location['metadata'].get('backend'),
|
||||
location['url'], location['metadata'].get('store'),
|
||||
public=public, read_tenants=member_ids,
|
||||
context=self.context
|
||||
)
|
||||
@ -127,7 +127,7 @@ def _check_location_uri(context, store_api, store_utils, uri,
|
||||
def _check_image_location(context, store_api, store_utils, location):
|
||||
backend = None
|
||||
if CONF.enabled_backends:
|
||||
backend = location['metadata'].get('backend')
|
||||
backend = location['metadata'].get('store')
|
||||
|
||||
_check_location_uri(context, store_api, store_utils, location['url'],
|
||||
backend=backend)
|
||||
@ -139,7 +139,7 @@ def _set_image_size(context, image, locations):
|
||||
for location in locations:
|
||||
if CONF.enabled_backends:
|
||||
size_from_backend = store.get_size_from_uri_and_backend(
|
||||
location['url'], location['metadata'].get('backend'),
|
||||
location['url'], location['metadata'].get('store'),
|
||||
context=context)
|
||||
else:
|
||||
size_from_backend = store.get_size_from_backend(
|
||||
@ -496,7 +496,7 @@ class ImageProxy(glance.domain.proxy.Image):
|
||||
self.image.image_id)
|
||||
except crypto_exception.InvalidSignature:
|
||||
if CONF.enabled_backends:
|
||||
self.store_api.delete(location, loc_meta.get('backend'),
|
||||
self.store_api.delete(location, loc_meta.get('store'),
|
||||
context=self.context)
|
||||
else:
|
||||
self.store_api.delete_from_backend(location,
|
||||
@ -524,7 +524,7 @@ class ImageProxy(glance.domain.proxy.Image):
|
||||
err = None
|
||||
for loc in self.image.locations:
|
||||
try:
|
||||
backend = loc['metadata'].get('backend')
|
||||
backend = loc['metadata'].get('store')
|
||||
if CONF.enabled_backends:
|
||||
data, size = self.store_api.get(
|
||||
loc['url'], backend, offset=offset,
|
||||
|
@ -59,7 +59,7 @@ def _calc_required_size(context, image, locations):
|
||||
try:
|
||||
if CONF.enabled_backends:
|
||||
size_from_backend = store.get_size_from_uri_and_backend(
|
||||
location['url'], location['metadata'].get('backend'),
|
||||
location['url'], location['metadata'].get('store'),
|
||||
context=context)
|
||||
else:
|
||||
size_from_backend = store.get_size_from_backend(
|
||||
|
@ -255,7 +255,7 @@ class ScrubDBQueue(object):
|
||||
|
||||
# if multi-store is enabled then we need to pass backend
|
||||
# to delete the image.
|
||||
backend = loc['metadata'].get('backend')
|
||||
backend = loc['metadata'].get('store')
|
||||
if CONF.enabled_backends:
|
||||
ret.append((image['id'], loc['id'], uri, backend))
|
||||
else:
|
||||
|
@ -58,7 +58,7 @@ class TestSchemas(functional.FunctionalTest):
|
||||
'min_disk',
|
||||
'protected',
|
||||
'os_hidden',
|
||||
'backend'
|
||||
'stores'
|
||||
])
|
||||
self.assertEqual(expected, set(image_schema['properties'].keys()))
|
||||
|
||||
|
@ -34,7 +34,7 @@ class TestSchemasController(test_utils.BaseTestCase):
|
||||
'file', 'container_format', 'schema', 'id', 'size',
|
||||
'direct_url', 'min_ram', 'min_disk', 'protected',
|
||||
'locations', 'owner', 'virtual_size', 'os_hidden',
|
||||
'os_hash_algo', 'os_hash_value', 'backend'])
|
||||
'os_hash_algo', 'os_hash_value', 'stores'])
|
||||
self.assertEqual(expected, set(output['properties'].keys()))
|
||||
|
||||
def test_image_has_correct_statuses(self):
|
||||
|
@ -34,7 +34,7 @@ future==0.16.0
|
||||
futurist==1.2.0
|
||||
gitdb2==2.0.3
|
||||
GitPython==2.1.8
|
||||
glance-store==0.26.1
|
||||
glance-store==1.0.0
|
||||
greenlet==0.4.13
|
||||
hacking==0.12.0
|
||||
httplib2==0.9.1
|
||||
|
@ -47,7 +47,7 @@ retrying!=1.3.0,>=1.2.3 # Apache-2.0
|
||||
osprofiler>=1.4.0 # Apache-2.0
|
||||
|
||||
# Glance Store
|
||||
glance-store!=0.29.0,>=0.26.1 # Apache-2.0
|
||||
glance-store>=1.0.0 # Apache-2.0
|
||||
|
||||
|
||||
debtcollector>=1.2.0 # Apache-2.0
|
||||
|
Loading…
Reference in New Issue
Block a user