From 543b1f39066c210cf0e9f6966b691fc79212ea99 Mon Sep 17 00:00:00 2001 From: Mark Goddard Date: Tue, 2 Jul 2024 11:53:01 +0100 Subject: [PATCH] Backport fix ups for Yoga --- glance/async_/flows/plugins/image_conversion.py | 5 ++++- glance/tests/unit/common/test_format_inspector.py | 2 +- glance/tests/unit/v2/test_tasks_resource.py | 4 ++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/glance/async_/flows/plugins/image_conversion.py b/glance/async_/flows/plugins/image_conversion.py index 90a846ace7..bd0b7993d4 100644 --- a/glance/async_/flows/plugins/image_conversion.py +++ b/glance/async_/flows/plugins/image_conversion.py @@ -89,7 +89,10 @@ def _execute(self, action, file_path, **kwargs): 'target': target_format} self.dest_path = dest_path - source_format = action.image_disk_format + # Backport fixup due to lack of + # Ic51c5fd87caf04d38aeaf758ad2d0e2f28098e4d in Yoga: + #source_format = action.image_disk_format + source_format = action._image.disk_format inspector_cls = format_inspector.get_inspector(source_format) if not inspector_cls: # We cannot convert from disk_format types that qemu-img doesn't diff --git a/glance/tests/unit/common/test_format_inspector.py b/glance/tests/unit/common/test_format_inspector.py index 491c5636c3..4c503f3303 100644 --- a/glance/tests/unit/common/test_format_inspector.py +++ b/glance/tests/unit/common/test_format_inspector.py @@ -76,7 +76,7 @@ def _create_img(self, fmt, size, subformat=None, options=None, suffix='.%s' % fmt) self._created_files.append(fn) subprocess.check_output( - 'qemu-img create -f %s %s %i' % (fmt, fn, size), + 'qemu-img create -f %s %s %s %i' % (fmt, opt, fn, size), shell=True) return fn diff --git a/glance/tests/unit/v2/test_tasks_resource.py b/glance/tests/unit/v2/test_tasks_resource.py index 754612b11f..15562724b7 100644 --- a/glance/tests/unit/v2/test_tasks_resource.py +++ b/glance/tests/unit/v2/test_tasks_resource.py @@ -415,8 +415,8 @@ def test_create_with_wrong_import_form(self): "non-local source of image data.") else: supported = ['http', ] - msg = ("The given uri is not valid. Please specify a " - "valid uri from the following list of supported uri " + msg = ("The given URI is not valid. Please specify a " + "valid URI from the following list of supported URI " "%(supported)s") % {'supported': supported} self.assertEqual(msg, final_task.message)