Dynamic Workloads : Add stress-ng

This patch adds the stress-ng workload to dynamic workloads.
Multiple client VMs are created in each iteration and stress-ng
is run on the client VMs from a jumphost created on the same network.

Depends-On: https://review.opendev.org/c/x/browbeat/+/860226
Depends-On: https://review.opendev.org/c/x/browbeat/+/860202
Change-Id: I16bb8e1d2760e0b433cdc0fb469b6cb65ca70b82
This commit is contained in:
Sanjay Chari 2022-10-06 13:29:10 +05:30
parent 865e85a277
commit b050cd3ae2
4 changed files with 96 additions and 12 deletions

View File

@ -718,6 +718,21 @@ workloads:
e2e_kube_burner_workload: poddensity
ocp_kubeconfig_paths:
- /home/stack/.kube/config
# Run stress_ng inside VMs. To run this, the following steps have to be performed before running browbeat.yml to install browbeat.
# 1. In ansible/install/group_vars/all.yml
# (i) Set install_browbeat_workloads to true
# (ii) Fill browbeat_network
# (iii) Enable the stress_ng workload
stress_ng_username: centos
stress_ng_image_name: browbeat-stress-ng
stress_ng_flavor_name: m1.small
stress_ng_ssh_timeout: 120
stress_ng_num_clients: 2
stress_ng_cpu: 4
stress_ng_io: 2
stress_ng_vm: 1
stress_ng_vm_bytes: '1G'
stress_ng_timeout: '60s'
# External networks with /23 ranges will be created by dynamic workloads.
# All these external networks will share the first 16 bits.
cidr_prefix: "172.31"
@ -728,7 +743,8 @@ workloads:
# workloads can contain a single workload(Eg. : create_delete_servers),
# or a comma separated string(Eg. : create_delete_servers,migrate_servers).
# Currently supported workloads : create_delete_servers, migrate_servers
# swap_floating_ips_between_servers, stop_start_servers, create_loadbalancers,
# swap_floating_ips_between_servers, stop_start_servers,
# boot_clients_and_run_stress_ng_on_clients, create_loadbalancers,
# delete_loadbalancers, delete_members_random_lb, pod_fip_simulation,
# add_subports_to_random_trunks, delete_subports_from_random_trunks,
# swap_floating_ips_between_random_subports,

View File

@ -31,6 +31,10 @@ import ocp_on_osp
@validation.add(
"image_valid_on_flavor", flavor_param="smallest_flavor", image_param="smallest_image"
)
@types.convert(stress_ng_image={"type": "glance_image"}, stress_ng_flavor={"type": "nova_flavor"})
@validation.add(
"image_valid_on_flavor", flavor_param="stress_ng_flavor", image_param="stress_ng_image"
)
@validation.add(
"required_services", services=[consts.Service.NEUTRON,
consts.Service.NOVA,
@ -50,16 +54,17 @@ class DynamicWorkload(vm.VMDynamicScenario, trunk.TrunkDynamicScenario,
octavia.DynamicOctaviaBase, provider_network.DynamicProviderNetworkBase,
ocp_on_osp.OcpOnOspDynamicScenario):
def run(
self, smallest_image, smallest_flavor, ext_net_id, num_vms_to_create_with_fip,
num_vms_to_migrate, num_stop_start_vms, trunk_image, trunk_flavor, num_initial_subports,
num_trunk_vms, num_add_subports, num_add_subports_trunks, num_delete_subports,
num_delete_subports_trunks, octavia_image, octavia_flavor, user, user_data_file, num_lbs,
num_pools, num_clients, delete_num_lbs, delete_num_members, num_create_vms, num_delete_vms,
provider_phys_net, iface_name, iface_mac, num_vms_provider_net, num_external_networks,
self, nova_api_version, smallest_image, smallest_flavor, ext_net_id,
num_vms_to_create_with_fip, num_vms_to_migrate, num_stop_start_vms, trunk_image,
trunk_flavor, num_initial_subports, num_trunk_vms, num_add_subports,
num_add_subports_trunks, num_delete_subports, num_delete_subports_trunks, octavia_image,
octavia_flavor, user, user_data_file, num_lbs, num_pools, num_clients, delete_num_lbs,
delete_num_members, num_create_vms, num_delete_vms, provider_phys_net, iface_name,
iface_mac, num_vms_provider_net, stress_ng_username, stress_ng_image, stress_ng_flavor,
stress_ng_ssh_timeout, stress_ng_num_clients, stress_ng_command, num_external_networks,
e2e_kube_burner_job_iterations, e2e_kube_burner_qps, e2e_kube_burner_burst,
e2e_kube_burner_workload, ocp_kubeconfig_paths, workloads="all",
router_create_args=None, network_create_args=None,
subnet_create_args=None, **kwargs):
e2e_kube_burner_workload, ocp_kubeconfig_paths, workloads="all", router_create_args=None,
network_create_args=None, subnet_create_args=None, **kwargs):
if num_external_networks > 0:
context_ext_net_id = self.context["external_networks"][((self.context["iteration"]-1)
@ -87,7 +92,8 @@ class DynamicWorkload(vm.VMDynamicScenario, trunk.TrunkDynamicScenario,
"pod_fip_simulation" in workloads_list or
"add_subports_to_random_trunks" in workloads_list or
"delete_subports_from_random_trunks" in workloads_list or
"swap_floating_ips_between_random_subports" in workloads_list):
"swap_floating_ips_between_random_subports" in workloads_list or
"boot_clients_and_run_stress_ng_on_clients" in workloads_list):
# Let this router be used by resources created by VM and trunk dynamic workloads
# in this iteration.
router_create_args["name"] = self.generate_random_name()
@ -127,6 +133,13 @@ class DynamicWorkload(vm.VMDynamicScenario, trunk.TrunkDynamicScenario,
if run_all_vm_and_trunk_workloads or "stop_start_servers" in workloads_list:
self.stop_start_servers_with_fip(num_stop_start_vms)
if(run_all_vm_and_trunk_workloads or
"boot_clients_and_run_stress_ng_on_clients" in workloads_list):
self.run_stress_ng_on_vms(stress_ng_flavor, stress_ng_username,
stress_ng_ssh_timeout, stress_ng_num_clients,
stress_ng_command, stress_ng_image,
self.ext_net_name, nova_api_version=nova_api_version)
if run_all_vm_and_trunk_workloads or "pod_fip_simulation" in workloads_list:
self.pod_fip_simulation(context_ext_net_id, trunk_image, trunk_flavor, smallest_image,
smallest_flavor, num_initial_subports, num_trunk_vms)

View File

@ -30,6 +30,16 @@
{% set e2e_kube_burner_workload = e2e_kube_burner_workload or 'poddensity' %}
{% set ocp_kubeconfig_paths = ocp_kubeconfig_paths or ['/home/stack/.kube/config'] %}
{% set cidr_prefix = cidr_prefix or '172.31' %}
{% set stress_ng_username = stress_ng_username or 'centos' %}
{% set stress_ng_image_name = stress_ng_image_name or 'browbeat-stress-ng' %}
{% set stress_ng_flavor_name = stress_ng_flavor_name or 'm1.small' %}
{% set stress_ng_ssh_timeout = stress_ng_ssh_timeout or 120 %}
{% set stress_ng_num_clients = stress_ng_num_clients or 2 %}
{% set stress_ng_cpu = stress_ng_cpu or 4 %}
{% set stress_ng_io = stress_ng_io or 2 %}
{% set stress_ng_vm = stress_ng_vm or 1 %}
{% set stress_ng_vm_bytes = stress_ng_vm_bytes or '1G' %}
{% set stress_ng_timeout = stress_ng_timeout or '60s' %}
{% set num_external_networks = num_external_networks or 16 %}
{% set router_external = router_external or True %}
{% set sla_max_avg_duration = sla_max_avg_duration or 60 %}
@ -40,6 +50,7 @@ BrowbeatPlugin.dynamic_workload:
-
args:
floating: True
nova_api_version: {{ nova_api_version }}
smallest_flavor:
name: '{{smallest_flavor_name}}'
smallest_image:
@ -83,6 +94,14 @@ BrowbeatPlugin.dynamic_workload:
iface_mac: '{{ iface_mac }}'
num_vms_provider_net: {{ num_vms_provider_net }}
ext_net_id: '{{ext_net_id}}'
stress_ng_username: '{{ stress_ng_username}}'
stress_ng_image:
name: '{{ stress_ng_image_name }}'
stress_ng_flavor:
name: '{{ stress_ng_flavor_name }}'
stress_ng_ssh_timeout: {{ stress_ng_ssh_timeout }}
stress_ng_num_clients: {{ stress_ng_num_clients }}
stress_ng_command: "stress-ng --cpu {{stress_ng_cpu}} --io {{stress_ng_io}} --vm {{stress_ng_vm}} --vm-bytes {{stress_ng_vm_bytes}} --timeout {{stress_ng_timeout}} --metrics-brief"
num_external_networks: {{ num_external_networks }}
workloads: '{{workloads}}'
runner:

View File

@ -15,8 +15,14 @@ import time
import dynamic_utils
import sys
import os
class VMDynamicScenario(dynamic_utils.NovaUtils,
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '../workloads')))
import stress_ng_utils # noqa: E402
class VMDynamicScenario(stress_ng_utils.BrowbeatStressNgUtils,
dynamic_utils.NovaUtils,
dynamic_utils.NeutronUtils,
dynamic_utils.LockUtils):
@ -272,3 +278,33 @@ class VMDynamicScenario(dynamic_utils.NovaUtils,
else:
self.log_info("Average time for start and ping : {} seconds".format(
total_time_for_start_and_ping/num_operations_completed))
def run_stress_ng_on_vms(self, flavor, username, ssh_timeout, num_clients,
command, image=None, floating_network=None, port=22,
use_floating_ip=True, nova_api_version=2.52, **kwargs):
"""Create a jumphost on network with fip and all
other vm's on the same neutron network so that jumphost
can access the other vm's and run the stress tests
:param flavor: VM flavor name
:param username: ssh username on server
:param ssh_timeout: ssh timeout in seconds
:param num_clients: no.of clients
:param command: command that runs inside the client vm's
:param image: VM image name
:param floating_network: external network name, for floating ip
:param port: ssh port for SSH connection
:param use_floating_ip: bool, floating or fixed IP for SSH connection
:param kwargs: optional args to create a VM
:param nova_api_version: api microversion of nova
"""
router = self.router
network = self._create_network({})
subnet = self._create_subnet(network, {})
self._add_interface_router(subnet["subnet"], router["router"])
kwargs["nics"] = [{"net-id": network["network"]["id"]}]
self.run_stress_ng_on_clients(flavor, username, ssh_timeout, num_clients,
command, image, floating_network, port,
use_floating_ip, "dynwklds_stressng",
nova_api_version, **kwargs)