diff --git a/rally-jobs/rally-mos.yaml b/rally-jobs/rally-mos.yaml index b74c3f92..093246d2 100644 --- a/rally-jobs/rally-mos.yaml +++ b/rally-jobs/rally-mos.yaml @@ -1,4 +1,5 @@ --- +{%- set cirros_image_url = "http://download.cirros-cloud.net/0.3.5/cirros-0.3.5-x86_64-disk.img" %} {%- set keystone_version = keystone_version|default("v2.0") %} {% if keystone_version == "v2.0" %} @@ -835,3 +836,24 @@ sla: failure_rate: max: 100 + + GlanceImages.create_and_update_image: + - + args: + image_location: "{{ cirros_image_url }}" + container_format: "bare" + disk_format: "qcow2" + runner: + type: "constant" + times: 4 + concurrency: 2 + context: + users: + tenants: 2 + users_per_tenant: 2 + api_versions: + glance: + version: 1 + sla: + failure_rate: + max: 100 diff --git a/rally/plugins/openstack/services/image/glance_v1.py b/rally/plugins/openstack/services/image/glance_v1.py index 1f234045..1a65d184 100644 --- a/rally/plugins/openstack/services/image/glance_v1.py +++ b/rally/plugins/openstack/services/image/glance_v1.py @@ -93,7 +93,7 @@ class GlanceV1Service(service.Service, glance_common.GlanceMixin): """ image_name = image_name or self.generate_random_name() - return self._clients.glance("1").images.update(image_id=image_id, + return self._clients.glance("1").images.update(image_id, name=image_name, min_disk=min_disk, min_ram=min_ram) diff --git a/tests/unit/plugins/openstack/services/image/test_glance_v1.py b/tests/unit/plugins/openstack/services/image/test_glance_v1.py index ca68c8a3..fbf0a650 100755 --- a/tests/unit/plugins/openstack/services/image/test_glance_v1.py +++ b/tests/unit/plugins/openstack/services/image/test_glance_v1.py @@ -78,36 +78,24 @@ class GlanceV1ServiceTestCase(test.TestCase): self.gc.images.create.assert_called_once_with(**call_args) self.assertEqual(image, self.mock_wait_for_status.mock.return_value) - def test_update_image(self): + @ddt.data({"image_name": None}, + {"image_name": "test_image_name"}) + @ddt.unpack + def test_update_image(self, image_name): image_id = "image_id" - image_name1 = self.name_generator.return_value - image_name2 = "image_name" min_disk = 0 min_ram = 0 + expected_image_name = image_name or self.name_generator.return_value - # case: image_name is None: - call_args1 = {"image_id": image_id, - "name": image_name1, - "min_disk": min_disk, - "min_ram": min_ram} - image1 = self.service.update_image(image_id=image_id, - image_name=None, - min_disk=min_disk, - min_ram=min_ram) - self.assertEqual(self.gc.images.update.return_value, image1) - self.gc.images.update.assert_called_once_with(**call_args1) - - # case: image_name is not None: - call_args2 = {"image_id": image_id, - "name": image_name2, - "min_disk": min_disk, - "min_ram": min_ram} - image2 = self.service.update_image(image_id=image_id, - image_name=image_name2, - min_disk=min_disk, - min_ram=min_ram) - self.assertEqual(self.gc.images.update.return_value, image2) - self.gc.images.update.assert_called_with(**call_args2) + image = self.service.update_image(image_id=image_id, + image_name=image_name, + min_disk=min_disk, + min_ram=min_ram) + self.assertEqual(self.gc.images.update.return_value, image) + self.gc.images.update.assert_called_once_with(image_id, + name=expected_image_name, + min_disk=min_disk, + min_ram=min_ram) @ddt.data({"status": "activate", "is_public": True, "owner": "owner"}, {"status": "activate", "is_public": False, "owner": "owner"},