tripleo-quickstart-extras/roles/overcloud-prep-images/templates/overcloud-prep-images.sh.j2

99 lines
2.0 KiB
Django/Jinja

#!/bin/bash
set -eux
### --start_docs
## Prepare images for deploying the overcloud
## ==========================================
## Prepare Your Environment
## ------------------------
## * Source in the undercloud credentials.
## ::
source {{ working_dir }}/stackrc
{% if step_overcloud_image|bool %}
## * Upload images to glance.
## ::
openstack overcloud image upload {% if bash_deploy_ramdisk %}--old-deploy-image{% endif %} {% if whole_disk_images|bool %}--whole-disk{% endif %}
{% endif %}
{% if step_glance_upload|bool %}
## * Upload images to glance, this step is specific to nodepool based deployments.
## ::
glance image-create --container-format bare \
--disk-format qcow2 \
--name overcloud-full \
--file overcloud-full.qcow2
{% endif %}
## .. note:: Workaround for https://bugzilla.redhat.com/show_bug.cgi?id=1391602
## ::
sudo systemctl restart openstack-ironic-conductor && sleep 30
{% if step_register|bool %}
## * Register nodes with Ironic.
## ::
openstack baremetal import --json instackenv.json
openstack baremetal configure boot
{% endif %}
{% if step_root_device_size|bool %}
## * Get nodes UUID
## ::
export items="$( ironic node-list | awk '/power/ {print $2}' )"
## * Find disk size from instackenv.json
## ::
export DISK_SIZE="$( jq '.["nodes"][]["disk"] | tonumber' instackenv.json )"
## * Update nodes with disk size hint
## ::
count=0
ARRAY_DISK_SIZE=($(echo $DISK_SIZE))
ROOT_DEVICE_SIZE={{ disk_root_device_size }}
for item in $items; do
if [ $ROOT_DEVICE_SIZE -ge ${ARRAY_DISK_SIZE[$count]} ]; then
declare i ADS
ADS=${ARRAY_DISK_SIZE[$count]}
ironic node-update $item add properties/root_device='{"size": '$ADS'}'
fi
count=$((count+1))
done
# Temporary step to avoid introspection failure
# Workaround for: https://bugs.launchpad.net/tripleo/+bug/1649350
sudo mistral-db-manage populate
{% endif %}
{% if step_introspect %}
## * Introspect hardware attributes of nodes.
## ::
openstack baremetal introspection bulk start
{% endif %}
### --stop_docs