Replace Cirros references with generic descriptors

Often it is beneficial to use the functionality provided by `use_cirros`
and `cirros_deploy_image_upstream_url` to download and test with images
of other OS distributions. This patch changes the variable names to
reflect that use case.

`use_cirros` -> `download_custom_deploy_image`
`cirros_deploy_image_upstream_url` -> `custom_deploy_image_upstream_url`

The functionality of the old variables is retained for backwards
compatability.

Co-Authored-By: Alex Welsh <alex@stackhpc.com>

Change-Id: I8b3a973bd5ef19333af563c170b2a28fbbfb5c76
This commit is contained in:
Matt Crees 2023-05-03 11:10:31 +01:00 committed by Alex-Welsh
parent de39802cdb
commit a6ce283146
11 changed files with 38 additions and 24 deletions

View File

@ -182,7 +182,7 @@ def cmd_install(args):
enabled_hardware_types=args.hardware_types,
cleaning_disk_erase=args.cleaning_disk_erase,
testing=args.testenv,
use_cirros=args.testenv,
download_custom_deploy_image=args.testenv,
use_tinyipa=args.testenv,
developer_mode=args.develop,
enable_prometheus_exporter=args.enable_prometheus_exporter,

View File

@ -45,7 +45,7 @@ this.
ipa_kernel_upstream_url: file:///vagrant/ipa-centos9-master.kernel
ipa_ramdisk_upstream_url: file:///vagrant/ipa-centos9-master.initramfs
cirros_deploy_image_upstream_url: file:///vagrant/cirros-0.5.1-x86_64-disk.img
custom_deploy_image_upstream_url: file:///vagrant/cirros-0.5.3-x86_64-disk.img
dib_git_url: file:///vagrant/git/diskimage-builder
ironicclient_git_url: file:///vagrant/git/python-ironicclient
ironic_git_url: file:///vagrant/git/ironic

View File

@ -51,7 +51,7 @@ mysql_password:
# deploy_image: "{{http_boot_folder}}/{{deploy_image_filename}}"
# Setting to utilize diskimage-builder to create a bootable image.
create_image_via_dib: "{{ not use_cirros | default(false) | bool }}"
create_image_via_dib: "{{ not (download_custom_deploy_image | default(use_cirros) | default(false) | bool) }}"
dib_image_type: vm
# Create IPA image instead of downloading an pre-made IPA image.

View File

@ -51,7 +51,7 @@ mysql_password:
# deploy_image: "{{http_boot_folder}}/{{deploy_image_filename}}"
# Setting to utilize diskimage-builder to create a bootable image.
create_image_via_dib: "{{ not use_cirros | default(false) | bool }}"
create_image_via_dib: "{{ not (download_custom_deploy_image | default(use_cirros) | default(false) | bool) }}"
dib_image_type: vm
# Create IPA image instead of downloading an pre-made IPA image.

View File

@ -15,12 +15,15 @@ internal_ip: "{{ hostvars[ans_hostname]['ansible_' + ans_network_interface]['ipv
node_default_network_interface: eth0
testing: false
use_cirros: false
# Build images by default
download_custom_deploy_image: "{{ use_cirros | default(false) }}"
# write_interfaces_file is intended for utilizing base logic to write
# a debian style interfaces file into the configuration drive file
# such that cirros will receive basic network configuration when
# performing basic testing.
write_interfaces_file: "{{ use_cirros }}"
write_interfaces_file: "{{ download_custom_deploy_image }}"
# Basic networking defaults
ipv4_subnet_mask: 255.255.255.0

View File

@ -24,7 +24,7 @@ sushy_source_install: false
staging_drivers_source_install: true
prometheus_exporter_source_install: true
# Setting to utilize diskimage-builder to create a bootable image.
create_image_via_dib: "{{ not use_cirros | default(false) | bool }}"
create_image_via_dib: "{{ not (download_custom_deploy_image) }}"
create_ipa_image: false
dib_image_type: vm
dib_os_element: "debian"
@ -106,15 +106,19 @@ deploy_image_filename: "deployment_image.qcow2"
deploy_image: "{{ http_boot_folder }}/{{ deploy_image_filename }}"
esp_image: "{{ http_boot_folder }}/esp.img"
esp_image_url: "{{ ipa_file_protocol }}://{{ internal_ip }}:{{ file_url_port }}/esp.img"
# Use cirros instead of building an image via diskimage-builder
use_cirros: false
# Download a deployment image (default cirros) instead of building an image via diskimage-builder
download_custom_deploy_image: "{{ use_cirros | default(false) }}"
# Download IPA by default
download_ipa: true
update_repos: true
update_ipa: "{{ update_repos }}"
# Use the DIB dynamic-login element to insert the SSH key
ipa_add_ssh_key: false
cirros_deploy_image_upstream_url: https://download.cirros-cloud.net/0.5.1/cirros-0.5.1-x86_64-disk.img
# NOTE(Alex-Welsh): cirros_deploy_image_upstream_url has been deprecated in
# favor of custom_deploy_image_upstream_url but is included for backwards
# compatability. It should be swapped permanently to
# custom_deploy_image_upstream_url in the next major release.
custom_deploy_image_upstream_url: "{{ cirros_deploy_image_upstream_url | default('https://download.cirros-cloud.net/0.5.3/cirros-0.5.3-x86_64-disk.img') }}"
# By default bifrost will deploy dnsmasq to utilize as an integrated DHCP
# server. If you already have a DHCP server or do not need DHCP/TFTP at all,
# you can pass --disable-dhcp to the bifrost-cli install command to disable it.

View File

@ -401,18 +401,18 @@
- not create_ipa_image | bool
- download_ipa | bool
- when: use_cirros | bool
- when: download_custom_deploy_image | bool
block:
- name: "Download cirros to use for deployment if requested"
- name: "Download a custom image to use for deployment if requested"
get_url:
url: "{{ cirros_deploy_image_upstream_url }}"
url: "{{ custom_deploy_image_upstream_url }}"
dest: "{{ deploy_image }}"
owner: ironic
group: ironic
mode: "0644"
rescue:
- name: "Attempt to use curl if get_url fails"
command: "curl -L --output {{ deploy_image }} {{ cirros_deploy_image_upstream_url }}" # noqa: command-instead-of-module
command: "curl -L --output {{ deploy_image }} {{ custom_deploy_image_upstream_url }}" # noqa: command-instead-of-module
- name: Set file permissions
file:
path: "{{ deploy_image }}"
@ -420,9 +420,9 @@
group: ironic
mode: "0644"
- when: use_cirros | bool
- when: download_custom_deploy_image | bool
block:
- name: "Create a checksum file for cirros"
- name: "Create a checksum file for the custom deployment image"
shell: md5sum {{ deploy_image_filename }} > {{ deploy_image_filename }}.CHECKSUMS
args:
chdir: "{{ http_boot_folder }}"

View File

@ -4,7 +4,7 @@
# Set BIFROST_INVENTORY_SOURCE
# export BIFROST_INVENTORY_SOURCE=/tmp/baremetal.json
# Execute the installation and VM startup test.
# ansible-playbook -vvvv -i inventory/bifrost_inventory.py test-bifrost.yaml -e use_cirros=true -e testing_user=cirros
# ansible-playbook -vvvv -i inventory/bifrost_inventory.py test-bifrost.yaml -e download_custom_deploy_image=true -e testing_user=cirros
---
- hosts: localhost
connection: local
@ -19,7 +19,7 @@
block:
- name: "Set variables if running in the CI"
set_fact:
cirros_deploy_image_upstream_url: file:///opt/cache/files/cirros-0.5.3-x86_64-disk.img
custom_deploy_image_upstream_url: file:///opt/cache/files/cirros-0.5.3-x86_64-disk.img
copy_from_local_path: true
git_url_root: "{{ lookup('env', 'WORKSPACE') }}"
- name: "Check if openstacksdk is cloned"

View File

@ -0,0 +1,7 @@
---
deprecations:
- |
`use_cirros` and `cirros_deploy_image_upstream_url` have been deprecated in
favour of `download_custom_deploy_image` and
`custom_deploy_image_upstream_url` respectively, to better reflect their
OS-agnositic nature. The old variables will be removed in a future release.

View File

@ -32,7 +32,7 @@ USE_VMEDIA=${USE_VMEDIA:-false}
VM_DOMAIN_TYPE=qemu
export VM_DISK_CACHE="unsafe"
TEST_VM_NUM_NODES=1
USE_CIRROS=true
DOWNLOAD_CUSTOM_DEPLOY_IMAGE=true
TESTING_USER=cirros
TEST_PLAYBOOK="test-bifrost.yaml"
USE_INSPECTOR=true
@ -74,7 +74,7 @@ if which setenforce &> /dev/null; then
sudo setenforce Enforcing
fi
if [ ${USE_CIRROS} = "true" ] && [ ! -f "$HOME/.ssh/id_ecdsa.pub" ]; then
if [ ${DOWNLOAD_CUSTOM_DEPLOY_IMAGE} = "true" ] && [ ! -f "$HOME/.ssh/id_ecdsa.pub" ]; then
# CentOS/RHEL 8 and 9, as well as Fedora, do not work with the RSA key
# that the Cirros' SSH server uses. Generate an ECDSA key pair instead.
ssh-keygen -t ECDSA -f "$HOME/.ssh/id_ecdsa" -N ""
@ -98,7 +98,7 @@ if [ ${USE_DHCP} = "true" ]; then
WRITE_INTERFACES_FILE=false
CLOUD_CONFIG+=" -e dhcp_provider=none"
elif [ ${BUILD_IMAGE} = "true" ]; then
USE_CIRROS=false
DOWNLOAD_CUSTOM_DEPLOY_IMAGE=false
TESTING_USER=root
VM_MEMORY_SIZE="4096"
ENABLE_INSPECTOR=false
@ -111,7 +111,7 @@ elif [ ${ENABLE_KEYSTONE} = "true" ]; then
CLOUD_CONFIG+=" -e cloud_name=bifrost"
fi
REDEPLOY_NODES=$USE_CIRROS
REDEPLOY_NODES=$DOWNLOAD_CUSTOM_DEPLOY_IMAGE
if [[ -n "$BOOT_MODE" ]]; then
CLOUD_CONFIG+=" -e default_boot_mode=$BOOT_MODE"
@ -188,7 +188,7 @@ ${ANSIBLE} -vvvv \
-i inventory/bifrost_inventory.py \
-i inventory/target \
${TEST_PLAYBOOK} \
-e use_cirros=${USE_CIRROS} \
-e download_custom_deploy_image=${DOWNLOAD_CUSTOM_DEPLOY_IMAGE} \
-e use_tinyipa=true \
-e testing_user=${TESTING_USER} \
-e test_vm_num_nodes=${TEST_VM_NUM_NODES} \

View File

@ -91,7 +91,7 @@
become: yes
- name: Install Bifrost
command: ${VENV}/bin/ansible-playbook -vvvv -i inventory/target install.yaml -e network_interface={{network_interface}} -e ansible_python_interpreter="/usr/bin/python3" -e download_ipa=true -e use_cirros=true
command: ${VENV}/bin/ansible-playbook -vvvv -i inventory/target install.yaml -e network_interface={{network_interface}} -e ansible_python_interpreter="/usr/bin/python3" -e download_ipa=true -e download_custom_deploy_image=true
environment:
PATH: "{{ansible_env.HOME}}/.local/bin:{{ansible_env.PATH}}"
VENV: "/opt/stack/bifrost"