Add docstrings for parameter translation
On some APIs, the argument disk_config is translated to
OS-DCF:diskConfig as the parameter name. So this patch
adds docstrings for explaing it. In addition, this replaces
del with dict.pop() for code cleanup.
Partially implements blueprint consistent-service-method-names
Change-Id: If24590632b984b6ba35477027fcd6a5e40a9335a
diff --git a/tempest/services/compute/json/servers_client.py b/tempest/services/compute/json/servers_client.py
index dc33502..976d14f 100644
--- a/tempest/services/compute/json/servers_client.py
+++ b/tempest/services/compute/json/servers_client.py
@@ -256,11 +256,14 @@
return self.action(server_id, 'reboot', None, type=reboot_type)
def rebuild_server(self, server_id, image_ref, **kwargs):
- """Rebuilds a server with a new image."""
+ """Rebuilds a server with a new image.
+ Most parameters except the following are passed to the API without
+ any changes.
+ :param disk_config: The name is changed to OS-DCF:diskConfig
+ """
kwargs['imageRef'] = image_ref
if 'disk_config' in kwargs:
- kwargs['OS-DCF:diskConfig'] = kwargs['disk_config']
- del kwargs['disk_config']
+ kwargs['OS-DCF:diskConfig'] = kwargs.pop('disk_config')
if self.enable_instance_password:
rebuild_schema = schema.rebuild_server_with_admin_pass
else:
@@ -269,11 +272,14 @@
rebuild_schema, **kwargs)
def resize_server(self, server_id, flavor_ref, **kwargs):
- """Changes the flavor of a server."""
+ """Changes the flavor of a server.
+ Most parameters except the following are passed to the API without
+ any changes.
+ :param disk_config: The name is changed to OS-DCF:diskConfig
+ """
kwargs['flavorRef'] = flavor_ref
if 'disk_config' in kwargs:
- kwargs['OS-DCF:diskConfig'] = kwargs['disk_config']
- del kwargs['disk_config']
+ kwargs['OS-DCF:diskConfig'] = kwargs.pop('disk_config')
return self.action(server_id, 'resize', None, **kwargs)
def confirm_resize(self, server_id, **kwargs):