Add support for $IMAGE_PATH for loading images

This commit is contained in:
James Slagle 2014-09-11 20:23:03 -04:00
parent 03ac1aec2c
commit 452be0b4bb
4 changed files with 23 additions and 26 deletions

View File

@ -7,6 +7,12 @@
# scale will allow deployment of a single role only to homogenous hardware.
DEPLOYMENT_MODE=poc
### IMAGE_PATH ###
# Local file path to the downloaded images.
# The path should be a directory readable by the current user that contains
# the full set of downloaded images.
IMAGE_PATH=.
### LOCAL_IP ###
# IP address to assign to the interface on the Undercloud that will
# be handling the PXE boots and DHCP for Overcloud instances.

View File

@ -9,6 +9,7 @@ echo "Sourcing answers file from instack.answers..."
source ~/instack.answers
export DEPLOYMENT_MODE
export IMAGE_PATH
export LOCAL_IP
export DNSMASQ_START
export DNSMASQ_END

View File

@ -20,6 +20,7 @@ echo "Sourcing answers file from instack.answers..."
source ~/instack.answers
export DEPLOYMENT_MODE
export IMAGE_PATH
export LOCAL_IP
export DNSMASQ_START
export DNSMASQ_END

View File

@ -2,7 +2,7 @@
set -eux
IMG_SOURCE_URL=${IMG_SOURCE_URL:-"http://repos.fedorapeople.org/repos/openstack-m/tripleo-images-rdo-icehouse"}
IMAGE_PATH=${IMAGE_PATH:-"."}
export DEPLOY_NAME=${DEPLOY_NAME:-deploy-ramdisk}
@ -21,39 +21,28 @@ if ! nova keypair-show default 2>&1 1>/dev/null; then
tripleo user-config
fi
function download_image {
local image_name=$1
function check_image {
local image_name=$IMAGE_PATH/$1
if [ ! -f $image_name ]; then
curl -L -O $IMG_SOURCE_URL/$image_name
fi
# Allow the download to fail, in case initrd/vmlinuz is not available,
# will fall back to old behavior of extraction via
# disk-image-get-kernel
if [[ "$image_name" =~ "overcloud" ]]; then
for f in vmlinuz initrd; do
local file_name=$(basename -s .qcow2 $image_name).$f
if [ ! -f $file_name ]; then
curl -L -O $IMG_SOURCE_URL/$file_name || true
fi
done
echo "$image_name does not exist."
exit 1
fi
}
function load_image {
local image_name=$1
local image_name=$IMAGE_PATH/$1
tripleo load-image -d $image_name
}
download_image $DEPLOY_NAME.initramfs
download_image $DEPLOY_NAME.kernel
download_image overcloud-control.qcow2
download_image overcloud-compute.qcow2
download_image overcloud-cinder-volume.qcow2
download_image overcloud-swift-storage.qcow2
download_image fedora-user.qcow2
check_image $DEPLOY_NAME.initramfs
check_image $DEPLOY_NAME.kernel
check_image overcloud-control.qcow2
check_image overcloud-compute.qcow2
check_image overcloud-cinder-volume.qcow2
check_image overcloud-swift-storage.qcow2
check_image fedora-user.qcow2
load_image overcloud-control.qcow2
load_image overcloud-compute.qcow2
@ -62,10 +51,10 @@ load_image overcloud-swift-storage.qcow2
glance image-delete bm-deploy-kernel 2>/dev/null || :
glance image-create --name bm-deploy-kernel --public \
--disk-format aki < $DEPLOY_NAME.kernel
--disk-format aki < $IMAGE_PATH/$DEPLOY_NAME.kernel
glance image-delete bm-deploy-ramdisk 2>/dev/null || :
glance image-create --name bm-deploy-ramdisk --public \
--disk-format ari < $DEPLOY_NAME.initramfs
--disk-format ari < $IMAGE_PATH/$DEPLOY_NAME.initramfs
DEPLOYMENT_MODE=${DEPLOYMENT_MODE:-"poc"}
if [ "$DEPLOYMENT_MODE" = "poc" ]; then