Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/dictionary/en-custom.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ baseimg
baseurl
bashrc
bd
benchmarking
bgp
blockquote
bmaas
Expand Down Expand Up @@ -326,6 +327,7 @@ kerberos
keycloak
keypair
keyring
keystoneapi
keystoneauth
keystoneauth1
keytab
Expand Down
35 changes: 19 additions & 16 deletions hooks/playbooks/manila_create_default_resources.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,37 @@
---

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see you're now making changes here in hooks/playbooks/manila_create_default_resources.yml. Most (if not all) of these changes are, to me, outside the scope of adding a rally role. I think if you want these changes merged, they would be better submitted as a separate pr.

If I'm missing something and there is some meaningful logic change happening here, I apologize! But if that is the case, I think

  1. we should minimize the noisy style changes happening here and leave those to a separate pr
  2. keep any meaningful logic changes that might be happening here to a separate commit

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@michburk
The changes to manila_create_default_resources.yml are required for running Manila workload Rally tests. Rally's bundled manila.yaml workload hardcodes a share type named dhss_true, so that share type must exist before Rally runs. Rather than adding a duplicate playbook (rally_manila_prerequisites.yaml) that does the same thing as the existing one, I generalized manila_create_default_resources.yml to accept the share type name and extra specs as overridable variables.

I can separate this into a different PR, but since it's a minor change that is already done and directly tied to making Manila Rally workloads work, I'm not sure it's worth the overhead of an additional PR.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry if this is a dumb question, but which changes were required to enable this? Couldn't you already pass different values for share_type_name or extra_specs?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And by all means if there are meaningful changes that need to happen to this playbook that enable it to be used with your rally role, that's a fine thing to include in this pr. I'm just confused because these changes all appear to be aesthetic. Sorry again if I'm missing something obvious 😵‍💫

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No worries, thanks for the feedback!

Good catch, technically you could already override share_type_name and extra_specs via extra_vars with the original names, since extra_vars has the highest precedence.

The rename to _ prefix was driven by ansible-lint compliance: this project enforces a var_naming_pattern that requires variables to either follow the cifmw__ pattern or start with _.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, so which changes to this hook are necessary to get your rally role working? If there are changes that are necessary for your rally role, then I think they should be part of this pr, but maybe in a second commit. If there are no necessary changes for your rally role, I don't think it makes sense to include these changes in a set of changes that is focused on adding a rally role.

Ideally, if we want to do some style refactoring, we can do that in not only a separate commit from a commit that is focused on adding the rally role, but in also in a separate pr.

And for the record I am a little wary of changing the 'interface' for this hook. Modifying the names of the 'parameter vars' like share_type_name -> _share_type_name could break a consumer elsewhere that's expecting the old name. Fwiw I've searched around on hound and haven't found any instances where this could cause a problem, but I like to err on the side of caution.

Sorry if I'm being pedantic about separating commits and/or prs, I'm just trying to keep operations like git bisect and git revert in mind. If just one part of a big set of changes is broken, we can track down and revert just the exact troublesome set of changes, and not have to revert massive chunks of functionality.

- name: Create Manila resources needed for tempest run
- name: Create Manila share type
hosts: "{{ cifmw_target_hook_host | default('localhost') }}"
gather_facts: false
vars:
share_type_name: "default"
driver_handles_share_servers: "False"
extra_specs:
_share_type_name: "default"
_driver_handles_share_servers: "False"
_extra_specs:
snapshot_support: "True"
create_share_from_snapshot_support: "True"
tasks:
- name: Create share type default for manila tempest plugin tests
- name: Create share type
environment:
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
PATH: "{{ cifmw_path }}"
ansible.builtin.command: |
oc -n {{ namespace }} exec -it pod/openstackclient \
-- openstack share type create {{ share_type_name }} {{ driver_handles_share_servers }}
ansible.builtin.command: >-
oc -n {{ namespace }} rsh openstackclient
openstack share type create {{ _share_type_name }} {{ _driver_handles_share_servers }}
register: _manila_share_creation
failed_when: >-
( ( _manila_share_creation.rc | int ) != 0 )
and not ( "HTTP 409" in _manila_share_creation.stderr )

- name: Update default share type properties
- name: Prepare extra spec options string
when: _extra_specs is mapping and _extra_specs | length > 0
ansible.builtin.set_fact:
# convert dict to 'k=v ...' format
_extra_spec_opt: "{%- for k, v in _extra_specs.items() -%}{{ k }}={{ v }} {% endfor -%}"

- name: Update share type properties
when: _extra_spec_opt is defined
environment:
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
PATH: "{{ cifmw_path }}"
vars:
# convert dict to 'k=v ...' format
extra_spec_opt: "{%- for k, v in extra_specs.items() -%}{{ k }}={{ v }} {% endfor -%}"
when: extra_spec_opt | length > 0
ansible.builtin.command: |
oc -n {{ namespace }} exec -it pod/openstackclient \
-- openstack share type set {{ share_type_name }} --extra-specs {{ extra_spec_opt }}
ansible.builtin.command: >-
oc -n {{ namespace }} rsh openstackclient
openstack share type set {{ _share_type_name }} --extra-specs {{ _extra_spec_opt }}
56 changes: 56 additions & 0 deletions hooks/playbooks/rally_cinder_prerequisites.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
---
- name: Ensure Cinder Rally prerequisites exist
hosts: "{{ cifmw_target_hook_host | default('localhost') }}"
gather_facts: false
environment:
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
PATH: "{{ cifmw_path }}"
tasks:
- name: Create m1.tiny flavor if missing
ansible.builtin.shell: |
set -xe -o pipefail
oc -n {{ namespace }} rsh openstackclient \
openstack flavor show m1.tiny &>/dev/null || \
oc -n {{ namespace }} rsh openstackclient \
openstack flavor create m1.tiny \
--ram 512 --disk 1 --vcpus 1 --public

- name: Create lvmdriver-1 volume type if missing
ansible.builtin.shell: |
set -xe -o pipefail
oc -n {{ namespace }} rsh openstackclient \
openstack volume type show lvmdriver-1 &>/dev/null || \
oc -n {{ namespace }} rsh openstackclient \
openstack volume type create lvmdriver-1 --public

- name: Check if cirros image already exists
ansible.builtin.shell: |
set -e -o pipefail
oc -n {{ namespace }} rsh openstackclient \
openstack image list -f value -c Name | grep -q '^cirros'
register: _cirros_image_exists
failed_when: false

- name: Download cirros image to hypervisor
when: _cirros_image_exists.rc != 0
ansible.builtin.get_url:
url: "https://github.com/cirros-dev/cirros/releases/download/0.6.2/cirros-0.6.2-x86_64-disk.img"
dest: "/tmp/cirros-0.6.2-x86_64-disk.img"
mode: "0644"

- name: Copy cirros image to openstackclient pod
when: _cirros_image_exists.rc != 0
ansible.builtin.command: >-
oc cp /tmp/cirros-0.6.2-x86_64-disk.img
{{ namespace }}/openstackclient:/home/cloud-admin/cirros-0.6.2-x86_64-disk.img

- name: Upload cirros image for Rally if missing
when: _cirros_image_exists.rc != 0
ansible.builtin.shell: |
set -xe -o pipefail
oc -n {{ namespace }} rsh openstackclient \
openstack image create cirros-0.6.2-x86_64-disk \
--disk-format qcow2 \
--container-format bare \
--file /home/cloud-admin/cirros-0.6.2-x86_64-disk.img \
--public
11 changes: 11 additions & 0 deletions hooks/playbooks/rally_run.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
- name: Run Rally benchmarks
hosts: "{{ cifmw_target_hook_host | default('localhost') }}"
gather_facts: false
environment:
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
PATH: "{{ cifmw_path }}"
tasks:
- name: Run rally role
ansible.builtin.include_role:
name: rally
7 changes: 7 additions & 0 deletions roles/rally/OWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# See the OWNERS docs at https://www.kubernetes.dev/docs/guide/owners/

approvers:
- ciops-team

reviewers:
- ciops-team
95 changes: 95 additions & 0 deletions roles/rally/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# rally
Role to setup and run Rally benchmarking tests against an OpenStack deployment.

Rally is run inside the `quay.io/airshipit/xrally-openstack` container via podman.
OpenStack credentials are discovered automatically from the Kubernetes KeystoneAPI resource,
or can be supplied directly via `cifmw_rally_os_*` variables.

## Prerequisites
- `oc` CLI available and pointing to the target OpenStack cluster (used for credential and CA discovery).
- `cifmw_openstack_namespace` must be set to the OpenStack namespace (typically `openstack`).

### Manila prerequisites

If running Manila benchmarks, the `dhss_true` share type must exist before Rally runs.
Use `manila_create_default_resources.yml` with `_share_type_name` and `_extra_specs` overrides:

```yaml
pre_tests_80_manila_share_type:
type: playbook
source: manila_create_default_resources.yml
extra_vars:
_share_type_name: dhss_true
_extra_specs: {}
```

## Privilege escalation
become - Required to install podman and fix artifact directory ownership after the container run.

## Parameters

* `cifmw_rally_artifacts_basedir`: (String) Directory where all Rally artifacts are stored.
Default: `{{ cifmw_basedir }}/tests/rally`
* `cifmw_rally_registry`: (String) Container registry. Default: `quay.io`
* `cifmw_rally_namespace`: (String) Registry namespace. Default: `airshipit`
* `cifmw_rally_container`: (String) Container image name. Default: `xrally-openstack`
* `cifmw_rally_image`: (String) Full image reference. Composed from registry/namespace/container.
* `cifmw_rally_image_tag`: (String) Container image tag. Default: `3.0.0`
* `cifmw_rally_dry_run`: (Boolean) Skip actual container execution. Default: `false`
* `cifmw_rally_remove_container`: (Boolean) Remove container after run. Default: `true`
* `cifmw_rally_fail_on_task_failure`: (Boolean) Fail the play if Rally exits non-zero. Default: `true`
* `cifmw_rally_deployment_name`: (String) Rally deployment name. Default: `cifmw`
* `cifmw_rally_concurrency`: (Integer) Concurrency passed to the Rally task via `--task-args`. Default: `1`
* `cifmw_rally_task_file`: (String) Absolute path to a custom Rally task YAML on the host.
Mutually exclusive with `cifmw_rally_openstack_tests`. Default: `""`
* `cifmw_rally_task_extra_args`: (String) Extra arguments passed verbatim to `rally task start`. Default: `""`
* `cifmw_rally_dns_servers`: (List) DNS servers used inside the Rally container. Default: `["192.168.122.10"]`
* `cifmw_rally_os_auth_url`: (String) OpenStack auth URL. Auto-discovered from KeystoneAPI if unset.
* `cifmw_rally_os_username`: (String) OpenStack username. Default: `admin`
* `cifmw_rally_os_password`: (String) OpenStack password. Auto-discovered from Kubernetes secret if unset.
* `cifmw_rally_os_project_name`: (String) OpenStack project. Default: `admin`
* `cifmw_rally_os_user_domain_name`: (String) User domain. Default: `Default`
* `cifmw_rally_os_project_domain_name`: (String) Project domain. Default: `Default`
* `cifmw_rally_os_region_name`: (String) OpenStack region. Default: `regionOne`
* `cifmw_rally_runs`: (List) List of run definitions for sequential multi-run mode.
When empty (default), the role runs once using the top-level `cifmw_rally_*` variables.
When non-empty, the role loops over the list; each entry may override any `cifmw_rally_*`
variable for that run and **must** include a `name` key used to namespace artifacts.
Default: `[]`

## Standalone usage (single run)

```yaml
- hosts: hypervisor
roles:
- role: rally
vars:
cifmw_rally_openstack_tests: "cinder"
cifmw_rally_concurrency: 2
cifmw_rally_fail_on_task_failure: false
```

## Usage via hook (multiple runs)

Add a `post_tests_*` hook in your job vars and define `cifmw_rally_runs`:

```yaml
post_tests_90_rally_run:
type: playbook
source: rally_run.yaml
cifmw_rally_runs:
- name: cinder
cifmw_rally_openstack_tests: "cinder"
cifmw_rally_concurrency: 1
- name: nova
cifmw_rally_openstack_tests: "nova"
cifmw_rally_concurrency: 2
cifmw_rally_fail_on_task_failure: false
```

Each run stores its artifacts under `cifmw_rally_artifacts_basedir/<name>/`.

## Custom task files

To use a custom Rally task file, set `cifmw_rally_task_file` to the absolute path of the
YAML on the hypervisor host (pre-stage it via an earlier hook if needed).
36 changes: 36 additions & 0 deletions roles/rally/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
# Copyright Red Hat, Inc.
# All Rights Reserved.
#
# 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.


# All variables intended for modification should be placed in this file.
# All variables within this role should have a prefix of "cifmw_rally"
cifmw_rally_artifacts_basedir: "{{ cifmw_basedir }}/tests/rally"
cifmw_rally_registry: "quay.io"
cifmw_rally_namespace: "airshipit"
cifmw_rally_container: "xrally-openstack"
cifmw_rally_image: "{{ cifmw_rally_registry }}/{{ cifmw_rally_namespace }}/{{ cifmw_rally_container }}"
cifmw_rally_image_tag: "3.0.0"
cifmw_rally_dry_run: false
cifmw_rally_remove_container: true
cifmw_rally_fail_on_task_failure: true
cifmw_rally_deployment_name: "cifmw"
cifmw_rally_concurrency: 1
cifmw_rally_task_file: ""
cifmw_rally_openstack_tests: ""
cifmw_rally_task_extra_args: ""
cifmw_rally_dns_servers:
- "192.168.122.10"
cifmw_rally_runs: []
29 changes: 29 additions & 0 deletions roles/rally/meta/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
# Copyright Red Hat, Inc.
# All Rights Reserved.
#
# 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.


galaxy_info:
author: CI Framework
description: CI Framework Role -- rally
company: Red Hat
license: Apache-2.0
min_ansible_version: "2.14"
namespace: cifmw
galaxy_tags:
- cifmw
- rally

dependencies: []
24 changes: 24 additions & 0 deletions roles/rally/molecule/default/converge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
# Copyright Red Hat, Inc.
# All Rights Reserved.
#
# 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.


- name: Converge
hosts: all
vars:
cifmw_rally_dry_run: true
cifmw_rally_openstack_tests: "cinder"
roles:
- role: "rally"
9 changes: 9 additions & 0 deletions roles/rally/molecule/default/molecule.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
# Mainly used to override the defaults set in .config/molecule/
# By default, it uses the "config_podman.yml" - in CI, it will use
# "config_local.yml".
log: true

provisioner:
name: ansible
log: true
28 changes: 28 additions & 0 deletions roles/rally/molecule/default/prepare.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
# Copyright Red Hat, Inc.
# All Rights Reserved.
#
# 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.


- name: Prepare
hosts: all
vars:
cifmw_basedir: "{{ ansible_user_dir }}/ci-framework-data"
cifmw_install_yamls_tasks_out: "{{ ansible_user_dir }}/zuul-jobs/roles/install_yamls_makes/tasks"
cifmw_install_yamls_defaults:
NAMESPACE: openstack
roles:
- role: test_deps
- role: ci_setup
- role: install_yamls
Loading
Loading