Add custom cinder plugin for nova attach

Change-Id: I0c1d8d600cc2f249750891f996a37fa75227b07d
Signed-off-by: Sai Sindhur Malleni <smalleni@redhat.com>
This commit is contained in:
Sai Sindhur Malleni 2020-01-30 14:20:16 -05:00
parent e87452d2df
commit 735822463d
4 changed files with 102 additions and 0 deletions

View File

@ -34,6 +34,7 @@ rally:
- glance: rally/rally-plugins/glance
- neutron: rally/rally-plugins/neutron
- netcreate-boot: rally/rally-plugins/netcreate-boot
- cinder: rally/rally-plugins/cinder
- workloads: rally/rally-plugins/workloads
shaker:
server: 1.1.1.1
@ -257,6 +258,11 @@ workloads:
hypervisor: overcloud-compute-0.localdomain
browbeat_ssh_config: ansible/ssh-config
username: heat-admin
- name: create-vm-with-volume-list
enabled: true
image_name: centos7
flavor_name: m1.small
file: rally/rally-plugins/cinder/boot_vm_attach_volume_list.yml
# file for shaker should be one of https://opendev.org/performa/shaker/src/branch/master/shaker/scenarios/openstack
# Shaker scenarios require atleast 2 compute nodes

View File

@ -38,6 +38,7 @@ rally:
- glance: rally/rally-plugins/glance
- neutron: rally/rally-plugins/neutron
- netcreate-boot: rally/rally-plugins/netcreate-boot
- cinder: rally/rally-plugins/cinder
- workloads: rally/rally-plugins/workloads
shaker:
server: 1.1.1.1
@ -302,6 +303,11 @@ workloads:
- name: neutron-securitygroup-port
enabled: true
file: rally/rally-plugins/neutron/securitygroup_port.yml
- name: create-vm-with-volume-list
enabled: true
image_name: centos7
flavor_name: m1.small
file: rally/rally-plugins/cinder/boot_vm_attach_volume_list.yml
- name: plugin-workloads
enabled: false

View File

@ -0,0 +1,48 @@
# 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.cinder import utils as cinder_utils
from rally_openstack.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("restricted_parameters", param_names=["name", "display_name"],
subdict="create_volume_params")
@validation.add("image_valid_on_flavor", flavor_param="flavor", image_param="image")
@validation.add("required_services",services=[consts.Service.NOVA, consts.Service.CINDER])
@validation.add("required_platform", platform="openstack", users=True)
@scenario.configure(context={"cleanup@openstack": ["cinder", "nova"]},
name="BrowbeatPlugin.create_vm_with_volume", platform="openstack")
class CreateVmWithVolume(cinder_utils.CinderBasic,
nova_utils.NovaScenario):
def run(self, size, image, flavor, detailed=True,
create_volume_params=None, create_vm_params=None, **kwargs):
create_volume_params = create_volume_params or {}
if kwargs and create_vm_params:
raise ValueError("You can not set both 'kwargs' "
"and 'create_vm_params' attributes."
"Please use 'create_vm_params'.")
create_vm_params = create_vm_params or kwargs or {}
server = self._boot_server(image, flavor, **create_vm_params)
volume = self.cinder.create_volume(size, **create_volume_params)
self._attach_volume(server, volume)
self._list_servers(detailed)
self.cinder.list_volumes(detailed)

View File

@ -0,0 +1,42 @@
{% set image_name = image_name or "centos7" %}
{% set flavor_name = flavor_name or "m1.small" %}
{% 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_vm_with_volume:
-
args:
size: 1
image:
name: {{ image_name }}
flavor:
name: {{ flavor_name }}
auto_assign_nic: true
runner:
concurrency: {{ concurrency }}
times: {{ times }}
type: "constant"
context:
network:
start_cidr: "10.0.0.0/16"
networks_per_tenant: 1
users:
tenants: 2
users_per_tenant: 2
quotas:
neutron:
network: -1
port: -1
nova:
instances: -1
cores: -1
ram: -1
cinder:
gigabytes: -1
volumes: -1
sla:
max_avg_duration: {{sla_max_avg_duration}}
max_seconds_per_iteration: {{sla_max_seconds}}
failure_rate:
max: {{sla_max_failure}}