Boots server on the specified availability zone

In browbeat-config.yaml
availability_zones: list, specify the availability zones
num_vms_per_az: no.of vms per availability zone

Change-Id: I83ffe1d9b9a7001ecae7e28f0a91e1883a100f69
This commit is contained in:
Asma Syed Hameed 2023-07-17 17:13:21 +05:30
parent 99512c928e
commit f77abb4a71
3 changed files with 101 additions and 0 deletions

View File

@ -407,6 +407,22 @@ workloads:
file: rally/octavia/octavia-create-delete-pools.yml
sla_max_failure: 0
- name: availability-zone-boot-servers
enabled: false
type: rally
rally_deployment: overcloud
concurrency:
- 1
times: 1
scenarios:
- name: nova-boot-on-specified-az
enabled: false
image_name: cirro5
flavor_name: m1.tiny-cirros
availability_zones: []
num_vms_per_az: 10
file: rally/rally-plugins/nova/boot-server-with-specified-availability-zone.yml
- name: simple-plugins
enabled: false
type: rally

View File

@ -0,0 +1,44 @@
# 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 import exceptions
from rally_openstack.common import consts
from rally_openstack.task.scenarios.nova import utils as nova_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.NOVA])
@validation.add("required_platform", platform="openstack", users=True)
@scenario.configure(context={"cleanup@openstack": ["nova"]},
name="BrowbeatPlugin.boot_server_with_specified_availbility_zone",
platform="openstack")
class NovaBootWithSpecifiedAvailabilityZone(nova_utils.NovaScenario):
def run(self, image, flavor, availability_zones, num_vms_per_az, **kwargs):
"""Boot a server on the specified availability zones
:param image: image ID or instance for server creation
:param flavor: flavor ID or flavor name
:param availability_zones: list, availability zones name
:param num_vms_per_az: int, number of vm's per availability zone
:param kwargs: other optional parameters to initialize the server
"""
if availability_zones:
for _ in range(num_vms_per_az):
for availability_zone in availability_zones:
kwargs["availability-zone"] = availability_zone
self._boot_server(image, flavor, **kwargs)
else:
raise exceptions.RallyException("Availiability zones not specified")

View File

@ -0,0 +1,41 @@
{% set image_name = image_name or 'cirros' %}
{% set flavor_name = flavor_name or 'm1.xtiny' %}
{% set num_vms_per_az = num_vms_per_az or 10 %}
{% 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.boot_server_with_specified_availbility_zone:
-
args:
flavor:
name: '{{flavor_name}}'
image:
name: '{{image_name}}'
availability_zones: {{availability_zones}}
num_vms_per_az: {{num_vms_per_az}}
metadata:
test_metadata: "true"
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}}