diff --git a/openstack/cloud/openstackcloud.py b/openstack/cloud/openstackcloud.py index 518f3788c..86d914c84 100755 --- a/openstack/cloud/openstackcloud.py +++ b/openstack/cloud/openstackcloud.py @@ -4973,12 +4973,13 @@ class _OpenStackCloudMixin(_normalize.Normalizer): self, name, filename, wait, timeout, meta, **image_kwargs): - properties = image_kwargs['properties'] + properties = image_kwargs.pop('properties', {}) md5 = properties[self._IMAGE_MD5_KEY] sha256 = properties[self._IMAGE_SHA256_KEY] container = properties[self._IMAGE_OBJECT_KEY].split('/', 1)[0] - properties = image_kwargs.pop('properties', {}) image_kwargs.update(properties) + image_kwargs.pop('disk_format', None) + image_kwargs.pop('container_format', None) self.create_container(container) self.create_object( diff --git a/openstack/tests/unit/cloud/test_image.py b/openstack/tests/unit/cloud/test_image.py index e6927a516..feba4d2c3 100644 --- a/openstack/tests/unit/cloud/test_image.py +++ b/openstack/tests/unit/cloud/test_image.py @@ -487,6 +487,7 @@ class TestImage(BaseTestImage): self.cloud.create_image( self.image_name, self.imagefile.name, wait=True, timeout=1, + disk_format='vhd', container_format='ovf', is_public=False, container=self.container_name) self.assert_calls() diff --git a/releasenotes/notes/fix-image-task-ae79502dd5c7ecba.yaml b/releasenotes/notes/fix-image-task-ae79502dd5c7ecba.yaml new file mode 100644 index 000000000..8a6513b3c --- /dev/null +++ b/releasenotes/notes/fix-image-task-ae79502dd5c7ecba.yaml @@ -0,0 +1,6 @@ +--- +fixes: + - | + Fixed a regression in image upload when the cloud uses the task + upload method. A refactor led to attempting to update the disk_format + and container_format values after the image had been imported.