diff --git a/openstack/image/v2/_proxy.py b/openstack/image/v2/_proxy.py index 6c6b50249..448778311 100644 --- a/openstack/image/v2/_proxy.py +++ b/openstack/image/v2/_proxy.py @@ -332,6 +332,8 @@ class Proxy(proxy.Proxy): **image_kwargs, ) else: + properties = image_kwargs.pop('properties', {}) + image_kwargs.update(self._make_v2_image_params(meta, properties)) image_kwargs['name'] = name image = self._create(_image.Image, **image_kwargs) diff --git a/openstack/tests/functional/image/v2/test_image.py b/openstack/tests/functional/image/v2/test_image.py index 5c46448a1..7b7829c8d 100644 --- a/openstack/tests/functional/image/v2/test_image.py +++ b/openstack/tests/functional/image/v2/test_image.py @@ -27,11 +27,6 @@ class TestImage(base.BaseImageTest): name=TEST_IMAGE_NAME, disk_format='raw', container_format='bare', - # TODO(mordred): This is not doing what people think it is doing. - # This is EPICLY broken. However, rather than fixing it as it is, - # we need to just replace the image upload code with the stuff - # from shade. Figuring out mapping the crap-tastic arbitrary - # extra key-value pairs into Resource is going to be fun. properties={ 'description': 'This is not an image', }, diff --git a/openstack/tests/unit/image/v2/test_proxy.py b/openstack/tests/unit/image/v2/test_proxy.py index 9752eb7f9..23816cc1f 100644 --- a/openstack/tests/unit/image/v2/test_proxy.py +++ b/openstack/tests/unit/image/v2/test_proxy.py @@ -96,7 +96,7 @@ class TestImage(TestImageProxy): ) self.assertIn('filename and data are mutually exclusive', str(exc)) - def test_image_create_minimal(self): + def test_image_create(self): self.verify_create( self.proxy.create_image, _image.Image, @@ -105,12 +105,16 @@ class TestImage(TestImageProxy): 'disk_format': 'fake_dformat', 'container_format': 'fake_cformat', 'allow_duplicates': True, + 'is_protected': True, }, expected_kwargs={ 'name': 'fake', 'disk_format': 'fake_dformat', 'container_format': 'fake_cformat', - 'properties': mock.ANY, + 'is_protected': True, + 'owner_specified.openstack.md5': '', + 'owner_specified.openstack.object': 'images/fake', + 'owner_specified.openstack.sha256': '', }, ) @@ -187,9 +191,7 @@ class TestImage(TestImageProxy): meta={}, properties={ self.proxy._IMAGE_MD5_KEY: '144c9defac04969c7bfad8efaa8ea194', - self.proxy._IMAGE_SHA256_KEY: 'b5d54c39e66671c9731b9f471e585' - 'd8262cd4f54963f0c93082d8dcf33' - '4d4c78', + self.proxy._IMAGE_SHA256_KEY: 'b5d54c39e66671c9731b9f471e585d8262cd4f54963f0c93082d8dcf334d4c78', # noqa: E501 self.proxy._IMAGE_OBJECT_KEY: 'bare/fake', }, timeout=3600,