Skip to content
Permalink
Browse files

Merge "scenario to create vms on single network"

  • Loading branch information...
Zuul authored and openstack-gerrit committed Jun 10, 2019
2 parents 7285b2f + 4c4d46a commit b416679d443b563518e3dd4739ea2ba40783e0d6
@@ -221,6 +221,13 @@ workloads:
image_name: cirros
flavor_name: m1.tiny
file: rally/rally-plugins/netcreate-boot/netcreate_nova_boot.yml
- name: netcreate-boot-one-network
enabled: true
enable_dhcp: true
num_vms: 4
image_name: cirros
flavor_name: m1.tiny
file: rally/rally-plugins/netcreate-boot/netcreate_nova_boot_vms_on_single_network.yml
- name: netcreate-boot-ping
enabled: true
image_name: cirros
@@ -0,0 +1,40 @@
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from rally_openstack import consts
from rally_openstack.scenarios.nova import utils as nova_utils
from rally_openstack.scenarios.neutron import utils as neutron_utils
from rally.task import scenario
from rally.task import types
from rally.task import validation


@types.convert(image={"type": "glance_image"}, flavor={"type": "nova_flavor"})
@validation.add("image_valid_on_flavor", flavor_param="flavor", image_param="image")
@validation.add("required_services",services=[consts.Service.NEUTRON, consts.Service.NOVA])
@validation.add("required_platform", platform="openstack", users=True)
@scenario.configure(context={"cleanup@openstack": ["neutron", "nova"]},
name="BrowbeatPlugin.create_vms_on_network", platform="openstack")
class CreateVMsOnSingleNetwork(neutron_utils.NeutronScenario,
nova_utils.NovaScenario):

def run(self, image, flavor, num_vms=1, network_create_args=None,
subnet_create_args=None, port_create_args=None, **kwargs):

network = self._create_network(network_create_args or {})
self._create_subnet(network, subnet_create_args or {})

for i in range(num_vms):
kwargs["nics"] = []
port = self._create_port(network, port_create_args or {})
kwargs["nics"].append({'port-id': port['port']['id']})
self._boot_server(image, flavor, **kwargs)
@@ -0,0 +1,42 @@
{% set image_name = image_name or 'cirros' %}
{% set flavor_name = flavor_name or 'm1.xtiny' %}
{% set enable_dhcp = enable_dhcp or true %}
{% set num_vms = num_vms or 1 %}
{% set sla_max_avg_duration = sla_max_avg_duration or 60 %}
{% set sla_max_failure = sla_max_failure or 0 %}
{% set sla_max_seconds = sla_max_seconds or 60 %}
---
BrowbeatPlugin.create_vms_on_network:
-
args:
flavor:
name: '{{flavor_name}}'
image:
name: '{{image_name}}'
network_create_args: {}
subnet_create_args: {'enable_dhcp': '{{enable_dhcp}}'}
port_create_args: {}
num_vms: {{num_vms}}
runner:
concurrency: {{concurrency}}
times: {{times}}
type: 'constant'
context:
users:
tenants: 1
users_per_tenant: 8
quotas:
neutron:
network: -1
port: -1
router: -1
subnet: -1
nova:
instances: -1
cores: -1
ram: -1
sla:
max_avg_duration: {{sla_max_avg_duration}}
max_seconds_per_iteration: {{sla_max_seconds}}
failure_rate:
max: {{sla_max_failure}}

0 comments on commit b416679

Please sign in to comment.
You can’t perform that action at this time.