Auto-detect default overcloud-full image

When the undercloud glance is switched off the image files will be
copied to /var/lib/ironic/images. This change will choose what to set
for the default image based on whether there are image files in
/var/lib/ironic/images, falling back to a glance based
'overcloud-full'.

A missing .initrd file is used to imply that the .qcow2 file is a
whole-disk image.

This is just to determine the default image, and the image can always
be specified on a per-role basis in the baremetal provisioning yaml.

Change-Id: I3b8ba4b2a0d50077fcf4628720dff9310a200e2a
Blueprint: nova-less-deploy
This commit is contained in:
Steve Baker
2020-03-05 12:12:29 +13:00
committed by Kevin Carter (cloudnull)
parent c77f15f66a
commit 4369c28833

View File

@@ -39,6 +39,48 @@
- baremetal_deployed_path is undefined
tasks:
- name: Detect default overcloud-full image
block:
- name: stat overcloud-full.qcow2
stat:
path: /var/lib/ironic/images/overcloud-full.qcow2
get_checksum: true
checksum_algorithm: md5
register: overcloud_full_stat
- name: stat overcloud-full.initrd
stat:
path: /var/lib/ironic/images/overcloud-full.initrd
get_checksum: false
register: overcloud_full_initrd_stat
- name: Set file based default image
set_fact:
default_image:
href: file:///var/lib/ironic/images/overcloud-full.qcow2
checksum: "{{ overcloud_full_stat.stat.checksum }}"
kernel: file:///var/lib/ironic/images/overcloud-full.vmlinuz
ramdisk: file:///var/lib/ironic/images/overcloud-full.initrd
when:
- overcloud_full_stat.stat.exists|bool
- overcloud_full_initrd_stat.stat.exists|bool
- name: Set whole-disk file based default image
set_fact:
default_image:
href: file:///var/lib/ironic/images/overcloud-full.qcow2
checksum: "{{ overcloud_full_stat.stat.checksum }}"
when:
- overcloud_full_stat.stat.exists|bool
- not overcloud_full_initrd_stat.stat.exists|bool
- name: Set glance based default image
set_fact:
default_image:
href: overcloud-full
when: not overcloud_full_stat.stat.exists|bool
- name: Expand roles
tripleo_baremetal_expand_roles:
baremetal_deployment: "{{ baremetal_deployment }}"
@@ -46,6 +88,7 @@
stack_name: "{{ stack_name }}"
ssh_public_keys: "{{ ssh_public_keys }}"
user_name: "{{ ssh_user_name }}"
default_image: "{{ default_image }}"
register: baremetal_instances
- name: Find existing instances