diff --git a/browbeat-config.yaml b/browbeat-config.yaml index 39c25e5bb..83097a998 100644 --- a/browbeat-config.yaml +++ b/browbeat-config.yaml @@ -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: create-aggregate-nova-boot + enabled: true + image_name: cirro5 + flavor_name: m1.tiny-cirros + num_availability_zones: 3 + num_vms_per_az: 10 + file: rally/rally-plugins/nova/create_aggregate_add_host_boot.yml + - name: simple-plugins enabled: false type: rally diff --git a/rally/rally-plugins/nova/create_aggregate_add_host_boot.py b/rally/rally-plugins/nova/create_aggregate_add_host_boot.py new file mode 100644 index 000000000..b33137fa0 --- /dev/null +++ b/rally/rally-plugins/nova/create_aggregate_add_host_boot.py @@ -0,0 +1,57 @@ +# 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.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={ "admin_cleanup@openstack": ["nova"], "cleanup@openstack": ["nova"]}, + name="BrowbeatPlugin.create_aggregate_add_host_boot_servers", platform="openstack") +class CreateAggregateAddHostNovaBoot(nova_utils.NovaScenario): + + def run(self, image, flavor, num_availability_zones, metadata, num_vms_per_az, **kwargs): + list_aggregates = self._list_aggregates() + aggregates = [] + for az in range(0, num_availability_zones): + az_name = "region" + str(az) + if az_name in list_aggregates: + aggregates.append(az_name) + else: + aggregates.append(self._create_aggregate(az_name)) + + hosts = self._list_hypervisors() + host_names = [] + for i in range(len(hosts)): + for aggregate in aggregates: + if (hosts[i].state == "up" and hosts[i].status == "enabled" + and (hosts[i].id not in aggregate.hosts) and + (hosts[i].service["host"] not in host_names)): + host_names.append(hosts[i].service["host"]) + if not host_names: + raise exceptions.RallyException("Could not find an available hosts") + else: + for j in range(len(host_names)): + k = j % len(aggregates) + self._aggregate_set_metadata(aggregates[k], metadata) + self._aggregate_add_host(aggregates[k], host_names[j]) + + for i in range(num_vms_per_az): + for availability_zone in aggregates: + kwargs["availability-zone"] = availability_zone + self._boot_server(image, flavor, **kwargs) diff --git a/rally/rally-plugins/nova/create_aggregate_add_host_boot.yml b/rally/rally-plugins/nova/create_aggregate_add_host_boot.yml new file mode 100644 index 000000000..f48d7de50 --- /dev/null +++ b/rally/rally-plugins/nova/create_aggregate_add_host_boot.yml @@ -0,0 +1,42 @@ +{% set image_name = image_name or 'cirros' %} +{% set flavor_name = flavor_name or 'm1.xtiny' %} +{% set num_availability_zones = num_availability_zones or 3 %} +{% 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.create_aggregate_add_host_boot_servers: + - + args: + flavor: + name: '{{flavor_name}}' + image: + name: '{{image_name}}' + num_availability_zones: {{num_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}}