Skip to content

Commit 673c941

Browse files
Lewis Dennyopenshift-merge-bot[bot]
authored andcommitted
[Reproducer] Add support for disabling ocp overlays
This patch adds a new top level variable `cifmw_use_ocp_overlay` used to control whether the OCP VMs created by dev_scripts via the reproducer role use image overlays or not. Prior to this patch the use of image overlays was not configurable, while image overlays are useful for local deployments, in CI they are not used. The downside to image overlays is the process to create them takes a very long time. The OCP cluster needs come up and stabilize, then we shut the VMs down and copy the images to use as base images, we then need to start the OCP VMs again and wait for it to stabilize, this is all wasted time because in CI environments we start fresh every time. This patch also removes the undocumented internal variable `cifmw_use_reproducer` and it's use replaced with `cifmw_use_ocp_overlay` Jira: https://issues.redhat.com/browse/OSPRH-7771
1 parent 5cb063d commit 673c941

File tree

6 files changed

+16
-47
lines changed

6 files changed

+16
-47
lines changed

docs/source/usage/01_usage.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ are shared among multiple roles:
6666
- `cifmw_nolog`: (Bool) Toggle `no_log` value for selected tasks. Defaults to `true` (hiding those logs by default).
6767
- `cifmw_parent_scenario`: (String or List(String)) path to existing scenario/parameter file to inherit from.
6868
- `cifmw_configure_switches`: (Bool) Specifies whether switches should be configured. Computes in `reproducer.yml` playbook. Defaults to `false`.
69+
- `cifmw_use_ocp_overlay`: (Boolean) Specifies whether OCP nodes deployed via devscripts should use overlay images. Using overlay images speeds up the redeployment when using the reproducer role locally but in CI each job is cleaned up and redeployed. Creating the overlay image takes time so should be disabled when not used. Defaults to `true`.
6970
- `cifmw_crc_default_network`: (String) name of the untagged network used to address DNS on the crc node. Default is `default`.
7071
- `cifmw_run_operators_compliance_scans`: (Bool) Specifies whether to run operator compliance scans. Defaults to `false`.
7172
- `cifmw_run_compute_compliance_scans`: (Bool) Specifies whether to run compliance scans on the first compute. Defaults to `false`.

roles/devscripts/tasks/300_post.yml

Lines changed: 4 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -26,42 +26,10 @@
2626
- not cifmw_devscripts_ocp_online | bool
2727
ansible.builtin.import_tasks: set_cluster_fact.yml
2828

29-
- name: Prepare for disk overlay configuration.
30-
tags:
31-
- devscripts_deploy
29+
- name: Prepare for disk overlay configuration
3230
when:
3331
- not cifmw_devscripts_ocp_comply | bool
32+
- cifmw_use_ocp_overlay | default(true) | bool
33+
tags:
34+
- devscripts_deploy
3435
ansible.builtin.include_tasks: 310_prepare_overlay.yml
35-
36-
- name: Bringing cluster online.
37-
when:
38-
- not cifmw_use_reproducer | default(false) | bool
39-
block:
40-
- name: Deploy layout on target host
41-
tags:
42-
- libvirt_layout
43-
when:
44-
- not cifmw_devscripts_ocp_comply | bool
45-
ansible.builtin.include_role:
46-
name: libvirt_manager
47-
tasks_from: deploy_layout
48-
49-
- name: Apply VLAN configuration for vnet interfaces.
50-
tags:
51-
- devscripts_post
52-
when:
53-
- cifmw_libvirt_manager_configuration_gen.networks is defined
54-
become: true
55-
cifmw.general.bridge_vlan:
56-
networks: >-
57-
{{
58-
cifmw_libvirt_manager_configuration_gen.networks.keys() | list
59-
}}
60-
failed_when: false
61-
62-
- name: Ensure the OpenShift cluster is accessible.
63-
tags:
64-
- devscripts_post
65-
when:
66-
- not cifmw_devscripts_ocp_online | bool
67-
ansible.builtin.include_tasks: 330_wait_ocp.yml

roles/libvirt_manager/tasks/create_vms.yml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@
2929
_workload: "{{ cifmw_libvirt_manager_basedir }}/workload"
3030
_img_dir: "{{ cifmw_libvirt_manager_basedir }}/images"
3131
_chdir: >-
32-
{{ (is_base_img | default(false) | bool) | ternary(_img_dir, _workload) }}
32+
{{
33+
(_is_base_img | default(false) | bool) |
34+
ansible.builtin.ternary(_img_dir, _workload)
35+
}}
3336
block:
3437
- name: "Create VM image for {{ vm }}"
35-
vars:
36-
_vm_img: >-
37-
{{ vm }}.qcow2
3838
ansible.builtin.command:
3939
cmd: >-
4040
qemu-img create
@@ -48,9 +48,6 @@
4848
chdir: "{{ _chdir }}"
4949

5050
- name: "Ensure file ownership and rights for {{ vm }}"
51-
vars:
52-
_vm_img: >-
53-
{{ vm }}.qcow2
5451
ansible.builtin.file:
5552
path: "{{ (_chdir, _vm_img) | path_join }}"
5653
group: "qemu"

roles/libvirt_manager/tasks/deploy_layout.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,8 @@
198198
}}
199199
pub_key: "{{ pub_ssh_key.content | b64decode }}"
200200
priv_key: "{{ priv_ssh_key.content | b64decode }}"
201+
_vm_img: >-
202+
{{ vm }}.qcow2
201203
ansible.builtin.include_tasks:
202204
file: create_vms.yml
203205
loop: "{{ cifmw_libvirt_manager_all_vms | dict2items }}"

roles/libvirt_manager/tasks/ocp_layout.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
notify: Restart firewalld
77
ansible.builtin.command:
88
cmd: >-
9-
firewall-cmd --permanent --zone libvirt --add-forward
9+
firewall-cmd --permanent --zone libvirt --add-forward
1010
1111
- name: Enable masquerading for public traffic
1212
when: cifmw_libvirt_manager_firewalld_default_zone_masquerade | default(true) | bool
@@ -64,6 +64,7 @@
6464
state: directory
6565
loop:
6666
- "{{ cifmw_libvirt_manager_basedir }}/images"
67+
- "{{ cifmw_libvirt_manager_basedir }}/workload"
6768
- "{{ cifmw_libvirt_manager_ocp_pool_dir }}"
6869

6970
- name: Create pool in libvirt
@@ -79,7 +80,9 @@
7980
{{
8081
_ocp_layout.vms[vm_type]
8182
}}
82-
is_base_img: true
83+
_vm_img: >-
84+
{{ vm }}.qcow2
85+
_is_base_img: "{{ cifmw_use_ocp_overlay | default(true) | bool }}"
8386
ansible.builtin.include_role:
8487
name: "libvirt_manager"
8588
tasks_from: "create_vms.yml"

roles/reproducer/tasks/ocp_layout.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -336,8 +336,6 @@
336336
permanent: true
337337

338338
- name: Run devscripts role
339-
vars:
340-
cifmw_use_reproducer: true
341339
ansible.builtin.include_role:
342340
name: devscripts
343341

0 commit comments

Comments
 (0)