Add option arguments of scenarios of floating ip creation

In some cases, we must specify a network for floating ip creation.
e.g: more one extenal network and the first extenal network cannot
route to the vm.

Change-Id: I704612ef8f0129fafb16f9468f38383d47d587ab
This commit is contained in:
chenhb 2017-11-30 19:38:55 +08:00 committed by Andrey Kurilin
parent ac5121edf9
commit d48d9f89c8
5 changed files with 111 additions and 4 deletions

15
rally/plugins/openstack/scenarios/nova/servers.py Executable file → Normal file
View File

@ -915,16 +915,19 @@ class BootAndRebuildServer(utils.NovaScenario):
platform="openstack")
class BootAndAssociateFloatingIp(utils.NovaScenario):
def run(self, image, flavor, **kwargs):
def run(self, image, flavor, create_floating_ip_args=None, **kwargs):
"""Boot a server and associate a floating IP to it.
:param image: image to be used to boot an instance
:param flavor: flavor to be used to boot an instance
:param create_floating_ip_args: Optional additional arguments for
floating ip creation
:param kwargs: Optional additional arguments for server creation
"""
create_floating_ip_args = create_floating_ip_args or {}
server = self._boot_server(image, flavor, **kwargs)
address = network_wrapper.wrap(self.clients, self).create_floating_ip(
tenant_id=server.tenant_id)
tenant_id=server.tenant_id, **create_floating_ip_args)
self._associate_floating_ip(server, address["ip"])
@ -1095,7 +1098,7 @@ class BootServerFromVolumeSnapshot(utils.NovaScenario,
platform="openstack")
class BootServerAssociateAndDissociateFloatingIP(utils.NovaScenario):
def run(self, image, flavor, **kwargs):
def run(self, image, flavor, create_floating_ip_args=None, **kwargs):
"""Boot a server associate and dissociate a floating IP from it.
The scenario first boot a server and create a floating IP. then
@ -1104,11 +1107,15 @@ class BootServerAssociateAndDissociateFloatingIP(utils.NovaScenario):
:param image: image to be used to boot an instance
:param flavor: flavor to be used to boot an instance
:param create_floating_ip_args: Optional additional arguments for
floating ip creation
:param kwargs: Optional additional arguments for server creation
"""
create_floating_ip_args = create_floating_ip_args or {}
server = self._boot_server(image, flavor, **kwargs)
address = network_wrapper.wrap(self.clients, self).create_floating_ip(
tenant_id=server.tenant_id)
tenant_id=server.tenant_id, **create_floating_ip_args)
self._associate_floating_ip(server, address["ip"])
self._dissociate_floating_ip(server, address["ip"])

View File

@ -27,6 +27,36 @@
"max": 0
}
}
},
{
"runner": {
"type": "constant",
"concurrency": 1,
"times": 1
},
"args": {
"flavor": {
"name": "{{flavor_name}}"
},
"image": {
"name": "^cirros.*-disk$"
},
"create_floating_ip_args": {
"ext_network": "ext_network_name"
}
},
"context": {
"users": {
"users_per_tenant": 1,
"tenants": 1
},
"network": {}
},
"sla": {
"failure_rate": {
"max": 0
}
}
}
]
}

View File

@ -19,3 +19,23 @@
sla:
failure_rate:
max: 0
-
args:
flavor:
name: "{{flavor_name}}"
image:
name: "^cirros.*-disk$"
create_floating_ip_args:
ext_network: "ext_network_name"
runner:
type: "constant"
times: 1
concurrency: 1
context:
users:
tenants: 1
users_per_tenant: 1
network: {}
sla:
failure_rate:
max: 0

View File

@ -27,6 +27,36 @@
"max": 0
}
}
},
{
"runner": {
"type": "constant",
"concurrency": 2,
"times": 5
},
"args": {
"flavor": {
"name": "{{flavor_name}}"
},
"image": {
"name": "^cirros.*-disk$"
},
"create_floating_ip_args": {
"ext_network": "ext_network_name"
}
},
"context": {
"users": {
"users_per_tenant": 2,
"tenants": 3
},
"network": {}
},
"sla": {
"failure_rate": {
"max": 0
}
}
}
]
}

View File

@ -19,4 +19,24 @@
sla:
failure_rate:
max: 0
-
args:
flavor:
name: "{{flavor_name}}"
image:
name: "^cirros.*-disk$"
create_floating_ip_args:
ext_network: "ext_network_name"
runner:
type: "constant"
times: 5
concurrency: 2
context:
users:
tenants: 3
users_per_tenant: 2
network: {}
sla:
failure_rate:
max: 0