Skip to content
This repository has been archived by the owner on Feb 29, 2024. It is now read-only.

Commit

Permalink
Do not hard-code overcloud-full image name
Browse files Browse the repository at this point in the history
The var overcloud_image defaults to overcloud-full, and will until the
switchover to the whole-disk overcloud.

Change-Id: I8037e8140e36ed0cd56e1654c4a8269dfbd4b5d1
Blueprint: whole-disk-default
  • Loading branch information
steveb authored and rlandy committed Sep 14, 2021
1 parent 34a844d commit e401b6b
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 25 deletions.
2 changes: 1 addition & 1 deletion roles/common/defaults/main.yml
Expand Up @@ -23,7 +23,7 @@ image_cache_dir: "/var/cache/tripleo-quickstart/images/{{ release }}"
image_fetch_dir: "{{ working_dir }}"

# This determines whether to download a pre-built undercloud.qcow2 or
# whether to instead use an overcloud-full.qcow2 and convert it on
# whether to instead use an overcloud qcow2 and convert it on
# the fly. The default is to use a pre-built undercloud.qcow2.
overcloud_as_undercloud: false

Expand Down
4 changes: 2 additions & 2 deletions roles/convert-image/README.md
@@ -1,6 +1,6 @@
# Convert an overcloud-full.qcow2 into an image to boot an undercloud from

The `convert-image` role transforms an overcloud-full image into one which an
The `convert-image` role transforms an overcloud image into one which an
undercloud can be booted from in order to save time on package installs, while
not needing to maintain/host a specific undercloud image.

Expand All @@ -19,6 +19,6 @@ not needing to maintain/host a specific undercloud image.
separate from the install list so that it can be allowed to fail without
failing the conversion)
* `overcloud_full_root_pwd`: If set the defined password will
set for the root user on the overcloud-full image. The
set for the root user on the overcloudl image. The
resulting overcloud and undercloud instances will have
the password set.
10 changes: 5 additions & 5 deletions roles/convert-image/tasks/main.yml
Expand Up @@ -4,25 +4,25 @@
src: "{{ convert_image_template }}"
dest: "{{ convert_image_working_dir }}/convert_image.sh"

- name: check if we have an overcloud-full.qcow2 to start from
- name: check if we have an {{ overcloud_image }}.qcow2 to start from
stat:
path: "{{ convert_image_working_dir }}/overcloud-full.qcow2"
path: "{{ convert_image_working_dir }}/{{ overcloud_image }}.qcow2"
register: overcloud_full_qcow2

# This tasks is not be used in CI or on any public systems
# Only use this option when debugging locally on a secure system
- name: set root password for image
command: >
virt-customize --smp 2 -m {{ convert_image_host_memory }}
-a {{ convert_image_working_dir }}/overcloud-full.qcow2
-a {{ convert_image_working_dir }}/{{ overcloud_image }}.qcow2
--root-password password:{{ overcloud_full_root_pwd }}
when:
- overcloud_full_root_pwd is defined
- overcloud_full_qcow2.stat.exists

- name: copy overcloud-full.qcow2 to undercloud.qcow2
- name: copy {{ overcloud_image }}.qcow2 to undercloud.qcow2
command: >
cp {{ convert_image_working_dir }}/overcloud-full.qcow2
cp {{ convert_image_working_dir }}/{{ overcloud_image }}.qcow2
{{ convert_image_working_dir }}/undercloud.qcow2
changed_when: true
when: overcloud_full_qcow2.stat.exists and overcloud_as_undercloud|bool
Expand Down
14 changes: 7 additions & 7 deletions roles/libvirt/setup/undercloud/tasks/customize_overcloud.yml
Expand Up @@ -13,23 +13,23 @@
# so we can inject the gating repo into it.
- name: check if overcloud image is already extracted
stat:
path: '{{ working_dir }}/overcloud-full.qcow2'
path: '{{ working_dir }}/{{ overcloud_image }}.qcow2'
register: overcloud_image_stat_for_customize

- name: Extract overcloud-full image
- name: Extract {{ overcloud_image }} image
command: >
virt-copy-out -a {{ working_dir }}/undercloud.qcow2
/home/{{ undercloud_user }}/overcloud-full.qcow2 {{ working_dir }}
/home/{{ undercloud_user }}/{{ overcloud_image }}.qcow2 {{ working_dir }}
when: not overcloud_image_stat_for_customize.stat.exists

# only customize overcloud-full image if that is not going to be
# only customize {{ overcloud_image }} image if that is not going to be
# used as undercloud
- name: Perform extra overcloud customizations
command: >
virt-customize -a {{ working_dir }}/overcloud-full.qcow2
virt-customize -a {{ working_dir }}/{{ overcloud_image }}.qcow2
--run '{{ working_dir }}/overcloud-customize.sh'
- name: Copy updated overcloud-full image back to undercloud
- name: Copy updated {{ overcloud_image }} image back to undercloud
command: >
virt-copy-in -a {{ working_dir }}/undercloud.qcow2
{{ working_dir }}/overcloud-full.qcow2 /home/{{ undercloud_user }}/
{{ working_dir }}/{{ overcloud_image }}.qcow2 /home/{{ undercloud_user }}/
20 changes: 10 additions & 10 deletions roles/libvirt/setup/undercloud/tasks/main.yml
Expand Up @@ -49,11 +49,11 @@
- include_tasks: inject_gating_repo.yml
when: compressed_gating_repo is defined and compressed_gating_repo

# Converts an overcloud-full.qcow2 into a undercloud.qcow2
# Converts an {{ overcloud_image }}.qcow2 into a undercloud.qcow2
- include_tasks: convert_image.yml
when: overcloud_as_undercloud|bool or baseos_as_undercloud|bool

# Update images after we have converted the overcloud-full to an
# Update images after we have converted the overcloud to an
# undercloud image when using devmode. This also clones tripleo-ci
# on the undercloud image.
- include_tasks: update_image.yml
Expand Down Expand Up @@ -271,14 +271,14 @@
cacheable: true
when: ssh_user != "root"

# NOTE(trown) We use the overcloud-full initramfs and kernel as DIB
# NOTE(trown) We use the overcloud initramfs and kernel as DIB
# seems a bit smarter about extracting them than virt-get-kernel and
# the partition image is simply a converted overcloud-full
# the partition image is simply a converted overcloud
- name: Extract the kernel and initramfs from the undercloud image
command: >
virt-copy-out -a '{{ working_dir }}/undercloud.qcow2'
'/home/{{ undercloud_user }}/overcloud-full.vmlinuz'
'/home/{{ undercloud_user }}/overcloud-full.initrd'
'/home/{{ undercloud_user }}/{{ overcloud_image }}.vmlinuz'
'/home/{{ undercloud_user }}/{{ overcloud_image }}.initrd'
'{{ working_dir }}'
environment: "{{ libvirt_environment }}"
when: not undercloud_use_custom_boot_images|bool
Expand All @@ -297,20 +297,20 @@
LIBVIRT_DEFAULT_URI: "{{ libvirt_uri }}"

# NOTE(trown) The undercloudvm template expects this to be
# named overcloud-full.vmlinuz. We can update the devmode case
# named {{ overcloud_image }}.vmlinuz. We can update the devmode case
# to not require this step
- name: rename undercloud kernel
command: >
mv '{{ working_dir }}/vmlinuz'
'{{ working_dir }}/overcloud-full.vmlinuz'
'{{ working_dir }}/{{ overcloud_image }}.vmlinuz'
# NOTE(trown) The undercloudvm template expects this to be
# named overcloud-full.initrd. We can update the devmode case
# named {{ overcloud_image }}.initrd. We can update the devmode case
# to not require this step
- name: rename undercloud initramfs
command: >
mv '{{ working_dir }}/initramfs'
'{{ working_dir }}/overcloud-full.initrd'
'{{ working_dir }}/{{ overcloud_image }}.initrd'
# NOTE(trown): This is a bit of a hack to get the undercloud vm
# template to use the external kernel and initrd. We should
Expand Down

0 comments on commit e401b6b

Please sign in to comment.