Restore ability to pass kwargs to glance _create_image

This was unintentionally removed in 067af09a. This restores that
ability, and adds both unit and functional tests for it.

Change-Id: I98e25c9d4fdecb26e8fb84df3460738e61aec9d6
This commit is contained in:
Chris St. Pierre 2016-02-17 11:15:40 -06:00
parent 620fb7da7c
commit 53b01a17f7
3 changed files with 33 additions and 3 deletions

View File

@ -1,3 +1,4 @@
{%- set cirros_image_url = "http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img" %}
{% set image_name = "^(cirros.*uec|TestVM)$" %}
---
Authenticate.validate_nova:
@ -525,6 +526,33 @@
sla:
failure_rate:
max: 0
-
args:
flavor:
name: "m1.tiny"
image:
name: "rally-named-image-from-context"
runner:
type: "constant"
times: 5
concurrency: 2
context:
users:
tenants: 1
users_per_tenant: 2
roles:
- admin
images:
image_url: "{{ cirros_image_url }}"
image_type: "qcow2"
image_container: "bare"
images_per_tenant: 1
image_name: "rally-named-image-from-context"
image_args:
is_public: True
sla:
failure_rate:
max: 0
NovaHypervisors.list_hypervisors:
-

View File

@ -42,7 +42,7 @@ class GlanceScenario(scenario.OpenStackScenario):
"""
client = glance_wrapper.wrap(self._clients.glance, self)
return client.create_image(container_format, image_location,
disk_format)
disk_format, **kwargs)
@atomic.action_timer("glance.delete_image")
def _delete_image(self, image):

View File

@ -48,11 +48,13 @@ class GlanceScenarioTestCase(test.ScenarioTestCase):
clients=self.scenario_clients)
return_image = scenario._create_image("container_format",
image_location.name,
"disk_format")
"disk_format",
fakearg="fakearg")
self.assertEqual(self.image, return_image)
mock_wrap.assert_called_once_with(scenario._clients.glance, scenario)
mock_wrap.return_value.create_image.assert_called_once_with(
"container_format", image_location.name, "disk_format")
"container_format", image_location.name, "disk_format",
fakearg="fakearg")
self._test_atomic_action_timer(scenario.atomic_actions(),
"glance.create_image")