#!/bin/bash set -eux IMAGE_PATH=${IMAGE_PATH:-"."} export DEPLOY_NAME=${DEPLOY_NAME:-deploy-ramdisk-ironic} export DISCOVERY_NAME=${DISCOVERY_NAME:-discovery-ramdisk} HTTP_ROOT=${HTTP_ROOT:-/httpboot} source <(sudo cat /root/stackrc) OS_AUTH_URL=${OS_AUTH_URL:-""} if [ -z "$OS_AUTH_URL" ]; then echo "You must source a stackrc file for the Undercloud." exit 1 fi function check_image { local image_name=$IMAGE_PATH/$1 if [ ! -f $image_name ]; then echo "$image_name does not exist." exit 1 fi } function load_image { local image_name=$IMAGE_PATH/$1 tripleo load-image -d $image_name } check_image $DEPLOY_NAME.initramfs check_image $DEPLOY_NAME.kernel check_image $DISCOVERY_NAME.initramfs check_image $DISCOVERY_NAME.kernel check_image overcloud-full.qcow2 load_image overcloud-full.qcow2 glance image-delete bm-deploy-kernel 2>/dev/null || : glance image-create --name bm-deploy-kernel --is-public true \ --disk-format aki < $IMAGE_PATH/$DEPLOY_NAME.kernel glance image-delete bm-deploy-ramdisk 2>/dev/null || : glance image-create --name bm-deploy-ramdisk --is-public true \ --disk-format ari < $IMAGE_PATH/$DEPLOY_NAME.initramfs deploy_kernel_id=$(glance image-show bm-deploy-kernel | awk ' / id / {print $4}') deploy_ramdisk_id=$(glance image-show bm-deploy-ramdisk | awk ' / id / {print $4}') sudo cp -f "$IMAGE_PATH/$DISCOVERY_NAME.kernel" "$HTTP_ROOT/discovery.kernel" sudo cp -f "$IMAGE_PATH/$DISCOVERY_NAME.initramfs" "$HTTP_ROOT/discovery.ramdisk"