Adds a Class DynamicWorkloadMin

This patch support running dynamic workloads for only VM scenarios
and avoids running other dynamic workloads scenario.

Change-Id: If46822a435495f78d04dda48c73cc97082110721
This commit is contained in:
Asma Syed Hameed 2021-12-07 15:59:57 +05:30
parent a6e6d31f87
commit f78191c1f5
3 changed files with 162 additions and 0 deletions

View File

@ -617,3 +617,26 @@ workloads:
# by default, and have to be included separately.
workloads: all
file: rally/rally-plugins/dynamic-workloads/dynamic_workload.yml
- name: dynamic-workloads-min
enabled: false
type: rally
rally_deployment: overcloud
concurrency:
- 1
times: 1
scenarios:
- name: dynamic-workload-min
enabled: false
# smallest image name and smallest flavor name are used for
# vm dynamic scenarios.
smallest_image_name: cirros
smallest_flavor_name: m1.xtiny
ext_net_id:
num_create_vms: 10
num_delete_vms: 5
num_vms_to_create_with_fip: 10
num_vms_to_migrate: 5
num_stop_start_vms: 5
workloads: all
file: rally/rally-plugins/dynamic-workloads/dynamic_workload_min.yml

View File

@ -0,0 +1,81 @@
# 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.task import scenario
from rally.task import types
from rally.task import validation
import vm
@types.convert(smallest_image={"type": "glance_image"}, smallest_flavor={"type": "nova_flavor"})
@validation.add(
"image_valid_on_flavor", flavor_param="smallest_flavor", image_param="smallest_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"],
"keypair@openstack": {},
"allow_ssh@openstack": None,
},
name="BrowbeatPlugin.dynamic_workload_min",
platform="openstack",
)
class DynamicWorkloadMin(vm.VMDynamicScenario):
def run(
self, smallest_image, smallest_flavor, ext_net_id, num_vms_to_create_with_fip,
num_create_vms, num_vms_to_migrate, num_stop_start_vms, num_delete_vms,
workloads="all", router_create_args=None, network_create_args=None,
subnet_create_args=None, **kwargs):
workloads_list = workloads.split(",")
self.security_group = self.create_sec_group_with_icmp_ssh()
self.log_info("security group {} created for this iteration".format(self.security_group))
router_create_args["name"] = self.generate_random_name()
router_create_args["tenant_id"] = self.context["tenant"]["id"]
router_create_args.setdefault(
"external_gateway_info", {"network_id": ext_net_id, "enable_snat": True}
)
self.router = self._create_router(router_create_args)
self.log_info("router {} created for this iteration".format(self.router))
self.keypair = self.context["user"]["keypair"]
self.ext_net_name = self.clients("neutron").show_network(ext_net_id)["network"][
"name"]
if workloads == "all" or "create_delete_servers" in workloads_list:
self.boot_servers(smallest_image, smallest_flavor, num_create_vms,
subnet_create_args=subnet_create_args)
self.delete_random_servers(num_delete_vms)
if(workloads == "all" or "migrate_servers" in workloads_list or
"swap_floating_ips_between_servers" in workloads_list or
"stop_start_servers" in workloads_list):
self.boot_servers_with_fip(smallest_image, smallest_flavor, ext_net_id,
num_vms_to_create_with_fip,
network_create_args, subnet_create_args, **kwargs)
if workloads == "all" or "migrate_servers" in workloads_list:
self.migrate_servers_with_fip(num_vms_to_migrate)
if workloads == "all" or "swap_floating_ips_between_servers" in workloads_list:
self.swap_floating_ips_between_servers()
if workloads == "all" or "stop_start_servers" in workloads_list:
self.stop_start_servers_with_fip(num_stop_start_vms)

View File

@ -0,0 +1,58 @@
{% set smallest_image_name = smallest_image_name or 'cirros' %}
{% set smallest_flavor_name = smallest_flavor_name or 'm1.xtiny' %}
{% set num_create_vms = num_create_vms or 2 %}
{% set num_delete_vms = num_delete_vms or 1 %}
{% set num_vms_to_create_with_fip = num_vms_to_create_with_fip or 1 %}
{% set num_vms_to_migrate = num_vms_to_migrate or 1 %}
{% set num_stop_start_vms = num_stop_start_vms or 1 %}
{% set workloads = workloads or 'all' %}
{% set user = user or 'cirros' %}
{% 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.dynamic_workload_min:
-
args:
floating: True
smallest_flavor:
name: '{{smallest_flavor_name}}'
smallest_image:
name: '{{smallest_image_name}}'
ext_net_id: '{{ext_net_id}}'
network_create_args: {}
router_create_args: {}
subnet_create_args: {}
num_create_vms: {{num_create_vms}}
num_delete_vms: {{num_delete_vms}}
num_vms_to_create_with_fip: {{num_vms_to_create_with_fip}}
num_vms_to_migrate: {{num_vms_to_migrate}}
num_stop_start_vms: {{num_stop_start_vms}}
workloads: '{{workloads}}'
runner:
concurrency: {{concurrency}}
times: {{times}}
type: "constant"
context:
users:
tenants: 1
users_per_tenant: 1
quotas:
neutron:
network: -1
port: -1
router: -1
subnet: -1
floatingip: -1
security_group: -1
security_group_rule: -1
trunk: -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}}