Make create_image use **kwargs

As we discussed on
http://lists.openstack.org/pipermail/openstack-dev/2015-July/068864.html
All http POST/PUT methods need to contain **kwargs as their arguments.
This patch makes create_image use **kwargs.

NOTE: We cannot make update_image use **kwargs because the API requires
a list body, not dict body.

Partially implements blueprint consistent-service-method-names

Change-Id: Ic525e341712149699644ba39cafa5f91a700737f
diff --git a/tempest/api/image/base.py b/tempest/api/image/base.py
index da0ce83..c3205ce 100644
--- a/tempest/api/image/base.py
+++ b/tempest/api/image/base.py
@@ -70,8 +70,10 @@
         container_format = kwargs.pop('container_format')
         disk_format = kwargs.pop('disk_format')
 
-        image = cls.client.create_image(name, container_format,
-                                        disk_format, **kwargs)
+        image = cls.client.create_image(name=name,
+                                        container_format=container_format,
+                                        disk_format=disk_format,
+                                        **kwargs)
         # Image objects returned by the v1 client have the image
         # data inside a dict that is keyed against 'image'.
         if 'image' in image:
@@ -156,7 +158,7 @@
 
     def _create_image(self):
         name = data_utils.rand_name('image')
-        image = self.os_img_client.create_image(name,
+        image = self.os_img_client.create_image(name=name,
                                                 container_format='bare',
                                                 disk_format='raw')
         image_id = image['id']
diff --git a/tempest/api/image/v2/test_images_negative.py b/tempest/api/image/v2/test_images_negative.py
index 71c8c7a..485942e 100644
--- a/tempest/api/image/v2/test_images_negative.py
+++ b/tempest/api/image/v2/test_images_negative.py
@@ -90,10 +90,12 @@
     def test_register_with_invalid_container_format(self):
         # Negative tests for invalid data supplied to POST /images
         self.assertRaises(lib_exc.BadRequest, self.client.create_image,
-                          'test', 'wrong', 'vhd')
+                          name='test', container_format='wrong',
+                          disk_format='vhd')
 
     @test.attr(type=['negative'])
     @test.idempotent_id('70c6040c-5a97-4111-9e13-e73665264ce1')
     def test_register_with_invalid_disk_format(self):
         self.assertRaises(lib_exc.BadRequest, self.client.create_image,
-                          'test', 'bare', 'wrong')
+                          name='test', container_format='bare',
+                          disk_format='wrong')
diff --git a/tempest/api/telemetry/base.py b/tempest/api/telemetry/base.py
index bbd01f0..8b617ac 100644
--- a/tempest/api/telemetry/base.py
+++ b/tempest/api/telemetry/base.py
@@ -77,7 +77,7 @@
     @classmethod
     def create_image(cls, client):
         body = client.create_image(
-            data_utils.rand_name('image'), container_format='bare',
+            name=data_utils.rand_name('image'), container_format='bare',
             disk_format='raw', visibility='private')
         # TODO(jswarren) Move ['image'] up to initial body value assignment
         # once both v1 and v2 glance clients include the full response
diff --git a/tempest/services/image/v2/json/images_client.py b/tempest/services/image/v2/json/images_client.py
index 44062ea..72b203a 100644
--- a/tempest/services/image/v2/json/images_client.py
+++ b/tempest/services/image/v2/json/images_client.py
@@ -55,6 +55,11 @@
         return self._http
 
     def update_image(self, image_id, patch):
+        """Update an image.
+
+        Available params: see http://developer.openstack.org/
+                              api-ref-image-v2.html#updateImage-v2
+        """
         data = json.dumps(patch)
         headers = {"Content-Type": "application/openstack-images-v2.0"
                                    "-json-patch"}
@@ -63,21 +68,13 @@
         body = json.loads(body)
         return service_client.ResponseBody(resp, body)
 
-    def create_image(self, name, container_format, disk_format, **kwargs):
-        params = {
-            "name": name,
-            "container_format": container_format,
-            "disk_format": disk_format,
-        }
+    def create_image(self, **kwargs):
+        """Create an image.
 
-        for option in kwargs:
-            value = kwargs.get(option)
-            if isinstance(value, dict) or isinstance(value, tuple):
-                params.update(value)
-            else:
-                params[option] = value
-
-        data = json.dumps(params)
+        Available params: see http://developer.openstack.org/
+                              api-ref-image-v2.html#createImage-v2
+        """
+        data = json.dumps(kwargs)
         resp, body = self.post('v2/images', data)
         self.expected_success(201, resp.status)
         body = json.loads(body)