unify *_kwargs name in scenarios

When running a scenario, `kwargs` is used as default key-word arguments.
But in some scenarios, there are more and one services being called, and
we use xxx_kwargs for this case.

However, some xxx_kwargs are not unifed for same usage[0]. Unifying
these could avoid midleading for end users. Another improvement is to
add xxx_kwargs with empty settings for scenario config files.

[0] http://paste.openstack.org/show/489505/

Change-Id: I80f49be5c1cd21812d6b2d56b0f4279f0cf4f402
This commit is contained in:
Kun Huang 2016-03-07 16:45:56 +08:00
parent 83fc1db6ff
commit 9eb7f644c1
8 changed files with 16 additions and 7 deletions

View File

@ -58,7 +58,7 @@ class NovaKeypair(utils.NovaScenario):
@validation.required_openstack(users=True)
@scenario.configure(context={"cleanup": ["nova"]})
def boot_and_delete_server_with_keypair(self, image, flavor,
server_kwargs=None,
boot_server_kwargs=None,
**kwargs):
"""Boot and delete server with keypair.
@ -70,15 +70,16 @@ class NovaKeypair(utils.NovaScenario):
:param image: ID of the image to be used for server creation
:param flavor: ID of the flavor to be used for server creation
:param server_kwargs: Optional additional arguments for VM creation
:param boot_server_kwargs: Optional additional arguments for VM
creation
:param kwargs: Optional additional arguments for keypair creation
"""
server_kwargs = server_kwargs or {}
boot_server_kwargs = boot_server_kwargs or {}
keypair = self._create_keypair(**kwargs)
server = self._boot_server(image, flavor,
key_name=keypair,
**server_kwargs)
**boot_server_kwargs)
self._delete_server(server)
self._delete_keypair(keypair)

View File

@ -2,6 +2,7 @@
"CinderVolumes.create_and_update_volume": [
{
"args": {
"create_volume_kwargs": {},
"update_volume_kwargs": {
"display_name": "name_updated",
"display_description": "desc_updated"

View File

@ -5,6 +5,7 @@
update_volume_kwargs:
display_name: "name_updated"
display_description: "desc_updated"
create_volume_kwargs: {}
size: 1
runner:
type: "constant"

View File

@ -8,7 +8,8 @@
},
"image": {
"name": "^cirros.*uec$"
}
},
"boot_server_kwargs": {}
},
"runner": {
"type": "constant",

View File

@ -7,6 +7,7 @@
name: "{{flavor_name}}"
image:
name: "^cirros.*uec$"
boot_server_kwargs: {}
runner:
type: "constant"
times: 5

View File

@ -10,7 +10,9 @@
},
"flavor": {
"name": "{{flavor_name}}"
}
},
"boot_server_kwargs": {},
"create_volume_kwargs": {}
},
"runner": {
"type": "constant",

View File

@ -8,6 +8,8 @@ NovaServers.boot_server_attach_created_volume_and_live_migrate:
name: "^cirros.*uec$"
size: 10
block_migration: false
boot_server_kwargs: {}
create_volume_kwargs: {}
runner:
type: "constant"
times: 5

View File

@ -57,7 +57,7 @@ class NovaKeypairTestCase(test.ScenarioTestCase):
}
scenario.boot_and_delete_server_with_keypair(
"img", 1, server_kwargs=fake_server_args,
"img", 1, boot_server_kwargs=fake_server_args,
fake_arg1="foo", fake_arg2="bar")
scenario._create_keypair.assert_called_once_with(