Merge "Fix: optimized upload volume in Cinder store"

This commit is contained in:
Zuul 2024-07-05 08:07:56 +00:00 committed by Gerrit Code Review
commit 610a020592
2 changed files with 12 additions and 3 deletions

View File

@ -673,7 +673,7 @@ class ImagesController(object):
json_schema_version = change.get('json_schema_version', 10)
if path_root == 'locations':
api_pol.update_locations()
self._do_add_locations(image, path[1], value)
self._do_add_locations(image, path[1], value, req.context)
else:
api_pol.update_property(path_root, value)
if ((hasattr(image, path_root) or
@ -1042,7 +1042,7 @@ class ImagesController(object):
raise webob.exc.HTTPBadRequest(
explanation=encodeutils.exception_to_unicode(ve))
def _do_add_locations(self, image, path_pos, value):
def _do_add_locations(self, image, path_pos, value, context):
if CONF.show_multiple_locations == False:
msg = _("It's not allowed to add locations if locations are "
"invisible.")
@ -1058,7 +1058,7 @@ class ImagesController(object):
updated_location = value
if CONF.enabled_backends:
updated_location = store_utils.get_updated_store_location(
[value])[0]
[value], context=context)[0]
pos = self._get_locations_op_pos(path_pos,
len(image.locations), True)

View File

@ -0,0 +1,9 @@
---
fixes:
- |
`Bug #2054575 <https://bugs.launchpad.net/glance/+bug/2054575>`_:
Fixed the issue when cinder uploads a volume to glance in the
optimized path and glance rejects the request with invalid location.
Now we convert the old location format sent by cinder into the new
location format supported by multi store, hence allowing volumes to
be uploaded in an optimized way.