From 450096d30ab2a2e0598c83aa8798f05f95d60169 Mon Sep 17 00:00:00 2001 From: Martin Kopec Date: Mon, 12 Feb 2024 22:40:45 +0100 Subject: [PATCH] Add set-src-dest-host role The role will find out the available hosts and set compute.migration_source_host and compute.migration_dest_host options in tempest.conf if tempest_set_src_dest_host is set to True. Change-Id: Ic01970b100a7bb30d9c78229204c7de67681108c --- playbooks/devstack-tempest.yaml | 5 ++++ roles/set-src-dest-host/defaults/main.yaml | 1 + roles/set-src-dest-host/tasks/main.yaml | 29 ++++++++++++++++++++++ zuul.d/integrated-gate.yaml | 1 + 4 files changed, 36 insertions(+) create mode 100644 roles/set-src-dest-host/defaults/main.yaml create mode 100644 roles/set-src-dest-host/tasks/main.yaml diff --git a/playbooks/devstack-tempest.yaml b/playbooks/devstack-tempest.yaml index 269999c7c8..6d70bc349e 100644 --- a/playbooks/devstack-tempest.yaml +++ b/playbooks/devstack-tempest.yaml @@ -20,6 +20,11 @@ include_role: name: acl-devstack-files + - name: Set source and destination host + include_role: + name: set-src-dest-host + when: tempest_set_src_dest_host is defined and tempest_set_src_dest_host | bool + - name: Run tempest cleanup init-saved-state include_role: name: tempest-cleanup diff --git a/roles/set-src-dest-host/defaults/main.yaml b/roles/set-src-dest-host/defaults/main.yaml new file mode 100644 index 0000000000..fea05c8146 --- /dev/null +++ b/roles/set-src-dest-host/defaults/main.yaml @@ -0,0 +1 @@ +devstack_base_dir: /opt/stack diff --git a/roles/set-src-dest-host/tasks/main.yaml b/roles/set-src-dest-host/tasks/main.yaml new file mode 100644 index 0000000000..78b7a2c171 --- /dev/null +++ b/roles/set-src-dest-host/tasks/main.yaml @@ -0,0 +1,29 @@ +- name: Find out hostnames + set_fact: + devstack_hostnames: "{{ devstack_hostnames|default([]) + [hostvars[zj_item]['ansible_hostname'] | default('unknown')] }}" + loop: "{{ query('inventory_hostnames', 'all,!localhost') }}" + loop_control: + loop_var: zj_item + ignore_errors: yes # noqa ignore-errors + +- name: Found hostnames + debug: + msg: | + # Available hosts + {{ devstack_hostnames }} + +- name: Set migration_source_host in tempest.conf + become: true + community.general.ini_file: + path: "{{ devstack_base_dir }}/tempest/etc/tempest.conf" + section: compute + option: migration_source_host + value: "{{ devstack_hostnames[0] }}" + +- name: Set migration_dest_host in tempest.conf + become: true + community.general.ini_file: + path: "{{ devstack_base_dir }}/tempest/etc/tempest.conf" + section: compute + option: migration_dest_host + value: "{{ devstack_hostnames[1] }}" diff --git a/zuul.d/integrated-gate.yaml b/zuul.d/integrated-gate.yaml index 4b4306c61e..8d2842e8f3 100644 --- a/zuul.d/integrated-gate.yaml +++ b/zuul.d/integrated-gate.yaml @@ -263,6 +263,7 @@ # requests to services and can cause more oom issues. To avoid the # oom issue, setting the concurrency to 4 in this job. tempest_concurrency: 4 + tempest_set_src_dest_host: true devstack_localrc: USE_PYTHON3: true devstack_plugins: