Allow overriding the default base image for convert-image

This change will allow basing the undercloud image off overcloud-full
(as convert-image does not yet support whole disk images) while still
using the supported uefi images for the overcloud.

Change-Id: Ia255383e8fa5b15c3b2318e0e8f624c7ce775fe1
This commit is contained in:
Rafael Castillo 2022-03-15 14:42:25 -07:00
parent 2d9358367b
commit 292c69973c
4 changed files with 11 additions and 5 deletions

View File

@ -6,6 +6,7 @@ not needing to maintain/host a specific undercloud image.
## Variables
* `convert_image_base`: -- base image to convert into an undercloud image
* `convert_image_working_dir`: -- directory to be used for image conversion
* `convert_image_template`: jinja template for the script which does the
conversion

View File

@ -19,3 +19,6 @@ convert_image_install_pkgs:
convert_image_tempest_plugins: []
convert_image_host_memory: 2048
guest_partition: /dev/sda
# Image to use as base
convert_image_base: "{{ overcloud_image }}"

View File

@ -4,9 +4,9 @@
src: "{{ convert_image_template }}"
dest: "{{ convert_image_working_dir }}/convert_image.sh"
- name: "check if we have an {{ overcloud_image }}.qcow2 to start from"
- name: "check if we have an {{ convert_image_base }}.qcow2 to start from"
stat:
path: "{{ convert_image_working_dir }}/{{ overcloud_image }}.qcow2"
path: "{{ convert_image_working_dir }}/{{ convert_image_base }}.qcow2"
register: overcloud_full_qcow2
# This tasks is not be used in CI or on any public systems
@ -14,15 +14,15 @@
- name: set root password for image
command: >
virt-customize --smp 2 -m {{ convert_image_host_memory }}
-a {{ convert_image_working_dir }}/{{ overcloud_image }}.qcow2
-a {{ convert_image_working_dir }}/{{ convert_image_base }}.qcow2
--root-password password:{{ overcloud_full_root_pwd }}
when:
- overcloud_full_root_pwd is defined
- overcloud_full_qcow2.stat.exists
- name: "copy {{ overcloud_image }}.qcow2 to undercloud.qcow2"
- name: "copy {{ convert_image_base }}.qcow2 to undercloud.qcow2"
command: >
cp {{ convert_image_working_dir }}/{{ overcloud_image }}.qcow2
cp {{ convert_image_working_dir }}/{{ convert_image_base }}.qcow2
{{ convert_image_working_dir }}/undercloud.qcow2
changed_when: true
when: overcloud_full_qcow2.stat.exists and overcloud_as_undercloud|bool

View File

@ -2,3 +2,5 @@
- name: indirect role include (workaround to https://github.com/ansible/ansible/issues/19472)
include_role:
name: convert-image
vars:
convert_image_base: "{{ undercloud_base_image | default(overcloud_image) }}"