Add browbeat installation support for RHOSO

Change-Id: Ibbe80770445a59ff76a58715190e2f4daed1fec0
This commit is contained in:
rajeshP524 2024-04-26 22:10:09 +05:30
parent 8485df3535
commit b02e7a0e06
9 changed files with 226 additions and 86 deletions

View File

@ -1,26 +1,15 @@
---
#
# Playbook to install Browbeat (Rally + Shaker) on undercloud
#
- hosts: localhost
tasks:
- debug:
msg: "redirecting to browbeat installation based on deployment type"
- hosts: Browbeat
remote_user: "{{ browbeat_user }}"
roles:
- common
- osp_version
- browbeat
- stockpile
- { role: browbeat-results, when: browbeat_results_in_httpd|bool}
- firewall
- rally
- shaker
- { role: flavors, when: browbeat_create_flavors|bool}
- { role: images, when: browbeat_upload_guest_images|bool}
- { role: workloads, when: install_browbeat_workloads|bool}
- { role: e2e-benchmarking, when: install_e2e_benchmarking|bool}
environment: "{{proxy_env}}"
- name: Install browbeat
import_playbook: browbeat_rhoso.yaml
vars:
rally_undercloud_enabled: false
when: is_rhoso_deployment
- hosts: Controller*, Compute*
remote_user: "{{ host_remote_user }}"
roles:
- no-sshd-dns
- name: Install browbeat
import_playbook: browbeat_rhosp.yaml
when: not is_rhoso_deployment

View File

@ -0,0 +1,18 @@
---
#
# Playbook to install Browbeat(Rally) for RHOSO
#
- hosts: localhost
gather_facts: true
vars:
ansible_user: "{{ browbeat_user }}"
ansible_python_interpreter: "{{ python_interpreter }}"
roles:
- browbeat
- { role: browbeat-results, when: browbeat_results_in_httpd|bool}
- firewall
- rally
- { role: flavors, when: browbeat_create_flavors|bool}
- { role: images, when: browbeat_upload_guest_images|bool}
environment: "{{proxy_env}}"

View File

@ -0,0 +1,26 @@
---
#
# Playbook to install Browbeat (Rally + Shaker) on undercloud
#
- hosts: Browbeat
remote_user: "{{ browbeat_user }}"
roles:
- common
- osp_version
- browbeat
- stockpile
- { role: browbeat-results, when: browbeat_results_in_httpd|bool}
- firewall
- rally
- shaker
- { role: flavors, when: browbeat_create_flavors|bool}
- { role: images, when: browbeat_upload_guest_images|bool}
- { role: workloads, when: install_browbeat_workloads|bool}
- { role: e2e-benchmarking, when: install_e2e_benchmarking|bool}
environment: "{{proxy_env}}"
- hosts: Controller*, Compute*
remote_user: "{{ host_remote_user }}"
roles:
- no-sshd-dns

View File

@ -15,6 +15,14 @@ host_remote_user: heat-admin
# Tripleo is the only installer supported currently
tripleo: true
# Set to true if the deployment is RHOSO
is_rhoso_deployment: false
python_interpreter: /usr/bin/python3.6
# Make sure clouds.yaml exists at this path for RHOSO
clouds_yaml_path: "~/.config/openstack/clouds.yaml"
home_dir: "/home/{{browbeat_user}}"
browbeat_path: "{{home_dir}}/browbeat"

View File

@ -117,37 +117,40 @@
line: 'export REQUESTS_CA_BUNDLE={{ overcloud_ca_path }}'
when: overcloud_ca_path is defined
- name: Determine if generate_tripleo_hostfile has been run
stat:
path: "{{ browbeat_path }}/ansible/hosts"
register: hosts_file_exists
- block:
- name: Determine if generate_tripleo_hostfile has been run
stat:
path: "{{ browbeat_path }}/ansible/hosts"
register: hosts_file_exists
- name: Determine if generate_tripleo_inventory has been run
stat:
path: "{{ browbeat_path }}/ansible/hosts.yml"
register: hosts_yml_file_exists
- name: Determine if generate_tripleo_inventory has been run
stat:
path: "{{ browbeat_path }}/ansible/hosts.yml"
register: hosts_yml_file_exists
- name: set either of inventory file exists
set_fact:
inventry_file: "{{ (hosts_file_exists.stat.exists and hosts_file_exists.stat.isreg) or (hosts_yml_file_exists.stat.exists and hosts_yml_file_exists.stat.isreg) }}"
- name: set either of inventory file exists
set_fact:
inventry_file: "{{ (hosts_file_exists.stat.exists and hosts_file_exists.stat.isreg) or (hosts_yml_file_exists.stat.exists and hosts_yml_file_exists.stat.isreg) }}"
- debug: msg="Hosts file is already generated. {{ inventry_file }}"
when: inventry_file
- debug:
msg: "Hosts file is already generated. {{ inventry_file }}"
when: inventry_file
- name: Generate hosts and ssh-config on Browbeat Machine - Default(stack)
shell: . {{ home_dir }}/stackrc; {{ browbeat_path }}/ansible/generate_tripleo_inventory.sh -l --user stack
when: tripleo and (not inventry_file) and ansible_user!= "zuul"
- name: Generate hosts and ssh-config on Browbeat Machine - Default(stack)
shell: . {{ home_dir }}/stackrc; {{ browbeat_path }}/ansible/generate_tripleo_inventory.sh -l --user stack
when: tripleo and (not inventry_file) and ansible_user != "zuul"
- name: Generate hosts and ssh-config on Browbeat Machine - Zuul
shell: . {{ home_dir }}/stackrc; {{ browbeat_path }}/ansible/generate_tripleo_inventory.sh -l --user zuul
when: tripleo and (not inventry_file) and ansible_user== "zuul"
- name: Generate hosts and ssh-config on Browbeat Machine - Zuul
shell: . {{ home_dir }}/stackrc; {{ browbeat_path }}/ansible/generate_tripleo_inventory.sh -l --user zuul
when: tripleo and (not inventry_file) and ansible_user == "zuul"
- name: Move files to correct location
command: mv {{item}} {{ browbeat_path }}/ansible/{{item}}
with_items:
- hosts.yml
- heat-admin-id_rsa
when: "(tripleo and (not inventry_file))"
- name: Move files to correct location
command: mv {{ item }} {{ browbeat_path }}/ansible/{{ item }}
with_items:
- hosts.yml
- heat-admin-id_rsa
when: tripleo and (not inventry_file)
when: not is_rhoso_deployment
- name: Install requirements.txt into browbeat-venv
pip:
@ -180,4 +183,4 @@
insertafter: "hide"
line: " v.Optional('regex',default=''): v.All(str),"
when: collectd_prometheus
when: collectd_prometheus and not is_rhoso_deployment

View File

@ -5,6 +5,15 @@
# Ignore errors here incase the flavors already exist.
- name: Add flavors to overcloud
shell: . {{ overcloudrc }}; nova flavor-create {{item.name}} auto {{item.memory}} {{item.disk}} {{item.cpu}}
shell: . {{ overcloudrc }}; openstack flavor create {{item.name}} auto {{item.memory}} {{item.disk}} {{item.cpu}}
with_items: "{{browbeat_flavors}}"
ignore_errors: true
when: not is_rhoso_deployment
- name: Add flavors to overcloud
shell: |
export OS_CLOUD=default
openstack flavor create --ram {{ item.memory }} --disk {{ item.disk }} --vcpus {{ item.cpu }} {{ item.name }}
with_items: "{{ browbeat_flavors }}"
ignore_errors: true
when: is_rhoso_deployment

View File

@ -15,6 +15,17 @@
ignore_errors: true
changed_when: false
with_items: "{{ browbeat_guest_images }}"
when: not is_rhoso_deployment
- name: Determine if image exists
shell: |
export OS_CLOUD=default
openstack image list | grep '{{ browbeat_guest_images[item].name }}'
register: image_exists
ignore_errors: true
changed_when: false
with_items: "{{ browbeat_guest_images }}"
when: is_rhoso_deployment
- name: Remove image from dictionary of images if image exists
set_fact:
@ -31,14 +42,38 @@
when: "browbeat_guest_images[item].convert_to_raw"
with_items: "{{ browbeat_guest_images }}"
- name: Upload image into cloud (Newton and Ocata versions)
shell: . {{ overcloudrc }}; openstack image create --public --disk-format={{ browbeat_guest_images[item].type }} --container-format=bare {{ browbeat_guest_images[item].name }} < {{ home_dir }}/{{ browbeat_guest_images[item].name }}.{{ browbeat_guest_images[item].type }}
ignore_errors: true
when: "not browbeat_guest_images[item].convert_to_raw"
with_items: "{{ browbeat_guest_images }}"
- block:
- name: Upload image into cloud (Newton and Ocata versions)
shell: |
. {{ overcloudrc }}
openstack image create --public --disk-format={{ browbeat_guest_images[item].type }} --container-format=bare {{ browbeat_guest_images[item].name }} < {{ home_dir }}/{{ browbeat_guest_images[item].name }}.{{ browbeat_guest_images[item].type }}
ignore_errors: true
when: "not browbeat_guest_images[item].convert_to_raw"
with_items: "{{ browbeat_guest_images }}"
- name: Upload raw image into cloud (Newton and Ocata versions)
shell: . {{ overcloudrc }}; openstack image create --public --disk-format=raw --container-format=bare {{ browbeat_guest_images[item].name }} < {{ home_dir }}/{{ browbeat_guest_images[item].name }}.raw
ignore_errors: true
when: "browbeat_guest_images[item].convert_to_raw"
with_items: "{{ browbeat_guest_images }}"
- name: Upload raw image into cloud (Newton and Ocata versions)
shell: |
. {{ overcloudrc }}
openstack image create --public --disk-format=raw --container-format=bare {{ browbeat_guest_images[item].name }} < {{ home_dir }}/{{ browbeat_guest_images[item].name }}.raw
ignore_errors: true
when: "browbeat_guest_images[item].convert_to_raw"
with_items: "{{ browbeat_guest_images }}"
when: not is_rhoso_deployment
- block:
- name: Upload image into cloud (Newton and Ocata versions)
shell: |
export OS_CLOUD=default
openstack image create --public --disk-format={{ browbeat_guest_images[item].type }} --container-format=bare {{ browbeat_guest_images[item].name }} < {{ home_dir }}/{{ browbeat_guest_images[item].name }}.{{ browbeat_guest_images[item].type }}
ignore_errors: true
when: "not browbeat_guest_images[item].convert_to_raw"
with_items: "{{ browbeat_guest_images }}"
- name: Upload raw image into cloud (Newton and Ocata versions)
shell: |
export OS_CLOUD=default
openstack image create --public --disk-format=raw --container-format=bare {{ browbeat_guest_images[item].name }} < {{ home_dir }}/{{ browbeat_guest_images[item].name }}.raw
ignore_errors: true
when: "browbeat_guest_images[item].convert_to_raw"
with_items: "{{ browbeat_guest_images }}"
when: is_rhoso_deployment

View File

@ -15,13 +15,16 @@ from oslo_db import options as db_options
from browbeat_rally.db import models
from rally.common import cfg
from oslo_db.sqlalchemy import session as db_session
import os
CONF = cfg.CONF
# rally.conf always uses stack.sqlite database
username = os.getenv('USER')
# rally.conf always uses <username>.sqlite database
db_connection = "sqlite:///%s/%s.sqlite" % (tempfile.gettempdir(), username)
db_options.set_defaults(
CONF, connection="sqlite:///%s/stack.sqlite" % tempfile.gettempdir())
CONF, connection=db_connection)
def _create_facade_lazily():
@ -35,7 +38,7 @@ def get_engine():
# alternate way to create engine is
# from oslo_db.sqlalchemy import engines
# engine = engines.create_engine("sqlite:///%s/stack.sqlite" % tempfile.gettempdir())
# engine = engines.create_engine(db_connection)
def schema_create():
engine = get_engine()
metadata = schema.MetaData()

View File

@ -84,20 +84,20 @@
# as python package. This code can be used in browbeat rally plugins.
# Sqlalchemy giving errors when we run this extra DB code as rally plugin
# so we came up with this python package approach.
- name: install rally browbeat code
shell: |
source {{ rally_venv }}/bin/activate
pip install .
args:
executable: /bin/bash
chdir: "{{ role_path }}/files/browbeat-rally"
when: rhosp_version is version('13.0', '>=')
- block:
- name: Install rally browbeat code
shell: |
source {{ rally_venv }}/bin/activate
pip install .
args:
executable: /bin/bash
chdir: "{{ role_path }}/files/browbeat-rally"
- name: create lock table in rally db for dynamic workloads
shell: |
source {{ rally_venv }}/bin/activate
python {{ role_path }}/files/create_lock_table.py
when: rhosp_version is version('13.0', '>=')
- name: Create lock table in rally db for dynamic workloads
shell: |
source {{ rally_venv }}/bin/activate
python {{ role_path }}/files/create_lock_table.py
when: is_rhoso_deployment or rhosp_version is version('13.0', '>=')
- block:
- name: copy of stackrc
@ -138,15 +138,64 @@
when: rally_undercloud_enabled
- name: Setup rally deployment for overcloud
shell: . {{ rally_venv }}/bin/activate; . {{ overcloudrc }}; rally deployment create --fromenv --name overcloud
- block:
- name: Setup rally deployment for overcloud
shell: . {{ rally_venv }}/bin/activate; . {{ overcloudrc }}; rally deployment create --fromenv --name overcloud
- name: Check Rally deployment for overcloud
shell: . {{ rally_venv }}/bin/activate; . {{ overcloudrc }}; rally deployment check
register: rally_deployment_check_overcloud
- name: Check Rally deployment for overcloud
shell: . {{ rally_venv }}/bin/activate; . {{ overcloudrc }}; rally deployment check
register: rally_deployment_check_overcloud
- name: Fail if Rally deployment cannot be verfied for overcloud
fail:
msg: "Failed to verify that your deployment is ready to benchmark"
when: rally_deployment_check_overcloud.rc != 0
- name: Fail if Rally deployment cannot be verified for overcloud
fail:
msg: "Failed to verify that your deployment is ready to benchmark"
when: rally_deployment_check_overcloud.rc != 0
when: not is_rhoso_deployment
- block:
- name: Read clouds.yaml file
command: cat "{{ clouds_yaml_path }}"
register: clouds_yaml_content
- name: Parse clouds.yaml content
set_fact:
clouds_yaml: "{{ clouds_yaml_content.stdout | from_yaml }}"
- name: Generate JSON config content for rally deployment
set_fact:
json_content: |
{
"openstack": {
"auth_url": "{{ clouds_yaml.clouds.default.auth.auth_url }}",
"region_name": "{{ clouds_yaml.clouds.default.region_name }}",
"endpoint_type": "public",
"admin": {
"username": "{{ clouds_yaml.clouds.default.auth.username }}",
"password": "{{ clouds_yaml.clouds.default.auth.password }}",
"user_domain_name": "{{ clouds_yaml.clouds.default.auth.user_domain_name }}",
"project_name": "{{ clouds_yaml.clouds.default.auth.project_name }}",
"project_domain_name": "{{ clouds_yaml.clouds.default.auth.project_domain_name }}"
},
"https_insecure": {{ clouds_yaml.clouds.default.insecure | default(false) }}
}
}
- name: Write JSON content to keystone-v3.json
copy:
content: "{{ json_content }}"
dest: "{{ json_output_path }}"
- name: Setup rally deployment for overcloud
shell: . {{ rally_venv }}/bin/activate; rally deployment create --file={{ json_output_path }} --name overcloud
- name: Check Rally deployment for overcloud
shell: . {{ rally_venv }}/bin/activate; rally deployment check
register: rally_deployment_check_overcloud
- name: Fail if Rally deployment cannot be verified for overcloud
fail:
msg: "Failed to verify that your deployment is ready to benchmark"
when: rally_deployment_check_overcloud.rc != 0
when: is_rhoso_deployment
vars:
json_output_path: "~/keystone-v3.json"