Revert "Encapsulate getting image for a deployment."

This reverts commit 2f2cb8a399.

This feature removed the ability to use locally cached images
from the devtest_* scripts. Also adding top level --download-images
flags to all of the devtest scripts globally isn't something we
want to do. Ideally users would download images of their choosing
ahead of time and just simply set USE_CACHE=1. Much simpler and
can support a variety of download/caching mechanisms.

Change-Id: If788c2772f41fa4c41ea81a94e7c4335c1566158
This commit is contained in:
Dan Prince 2014-11-19 11:38:47 -05:00
parent cbab9a76ff
commit 04e774ffe0
7 changed files with 76 additions and 250 deletions

View File

@ -1,100 +0,0 @@
#!/bin/bash
set -eu
set -o pipefail
SCRIPT_NAME=$(basename $0)
SCRIPT_HOME=$(dirname $0)
function show_options () {
echo "Usage: $SCRIPT_NAME [options] IMAGE_NAME IMAGE-CREATE-EXECUTABLE -- DISKIMAGEBUILDER-COMMAND-LINE"
echo
echo "Acquire an image from cache/download/building it."
echo
echo "With no options and no download root set, images will be built. If a download"
echo "root is supplied then an image will be downloaded only if the local copy is"
echo "different. With -c, locally built images are not refreshed - while we can do"
echo "cache invalidation for downloaded images, we don't have cache invalidation"
echo "logic yet for building images - -c allows direct control."
echo
echo "What constitutes an image is determined by the images key of the"
echo "\$IMAGE_NAME.meta metadata file."
echo
echo "Options:"
echo " -c -- re-use existing images rather than rebuilding."
echo " --download BASE_URL -- download images from BASE_URL/\$imagename."
echo " -h, --help -- this text."
echo
exit $1
}
DOWNLOAD_BASE=
USE_CACHE=
TEMP=$(getopt -o ch -l download:,help -n $SCRIPT_NAME -- "$@")
if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
# Note the quotes around `$TEMP': they are essential!
eval set -- "$TEMP"
while true ; do
case "$1" in
--download) DOWNLOAD_BASE=$2; shift 2;;
-c) USE_CACHE=1; shift 1;;
-h | --help) show_options 0;;
--) shift ; break ;;
*) echo "Error: unsupported option $1." ; exit 1 ;;
esac
done
if [ "$#" -lt 2 ]; then
show_options 1
fi
IMAGE_NAME=${1:-''}
shift
BUILD_COMMAND=${1:-''}
shift
IMAGE_BASENAME=$(basename "${IMAGE_NAME}")
IMAGE_DIRNAME=$(dirname "${IMAGE_NAME}")
URL_BASENAME=$DOWNLOAD_BASE/$IMAGE_BASENAME
METADATA_PATH=$URL_BASENAME.meta
CACHE_URL="$TRIPLEO_ROOT/diskimage-builder/elements/cache-url/bin/cache-url"
if [ -n "$DOWNLOAD_BASE" ]; then
set +e
"${CACHE_URL}" ${METADATA_PATH} ${IMAGE_NAME}.meta
RES=$?
set -e
if [ 0 -ne "$RES" -a 44 -ne "$RES" ]; then
exit $RES
elif [ 44 -ne "$RES" ]; then
IMG_LIST=$(jq '.images' ${IMAGE_NAME}.meta)
for pos in $(seq 0 $(( $(jq length <<< $IMG_LIST) -1 )) ); do
COMPONENT_NAME=$(jq -r ".[$pos]" <<< $IMG_LIST)
"${CACHE_URL}" ${DOWNLOAD_BASE}/${COMPONENT_NAME} "${IMAGE_DIRNAME}"/${COMPONENT_NAME}
done
exit 0
fi
fi
function image_exists() {
if [ ! -e "${IMAGE_NAME}.meta" ]; then
return 1
fi
IMG_LIST=$(jq '.images' ${IMAGE_NAME}.meta)
for pos in $(seq 0 $(($(jq length <<< $IMG_LIST) -1))); do
COMPONENT_NAME=$(jq -r ".[$pos]" <<< $IMG_LIST)
if [ ! -e "${IMAGE_DIRNAME}"/${COMPONENT_NAME} ]; then
return 1
fi
done
return 0
}
if image_exists && [ -n "$USE_CACHE" ]; then
exit 0
fi
"$BUILD_COMMAND" -o "${IMAGE_NAME}" $@

View File

@ -28,9 +28,7 @@ ARCH=i386
export IMAGE_NAME=seed
export DIB_IMAGE_SIZE=30
BUILD_ONLY=
CACHE_OPT=
CREATE_IMAGE=yes
DOWNLOAD_OPT=
ALWAYS_ELEMENTS="vm cloud-init-nocloud local-config boot-stack seed-stack-config"
DIB_COMMON_ELEMENTS=${DIB_COMMON_ELEMENTS:-''}
SEED_DIB_EXTRA_ARGS=${SEED_DIB_EXTRA_ARGS:-'rabbitmq-server'}
@ -71,20 +69,19 @@ function show_options () {
echo "requirements."
echo
echo "Options:"
echo " -a i386|amd64 -- set the architecture of the VM (i386)"
echo " --build-only -- build the needed images but don't deploy them."
echo " --download-images URL -- attempt to download images from this URL."
echo " -o name -- set the name of the VM and image file"
echo " (seed) - must match that from setup-seed-vm"
echo " -s size -- set the image size (30 GB)"
echo " -c -- use a image cache for seed image"
echo " -i -- image file was built elsewhere, don't"
echo " create"
echo " -a i386|amd64 -- set the architecture of the VM (i386)"
echo " --build-only -- build the needed images but don't deploy them."
echo " -o name -- set the name of the VM and image file"
echo " (seed) - must match that from setup-seed-vm"
echo " -s size -- set the image size (30 GB)"
echo " -c -- use a image cache for seed image"
echo " -i -- image file was built elsewhere, don't"
echo " create"
echo
exit $1
}
TEMP=$(getopt -o hcia:o:s: -l build-only,download-images: -n $SCRIPT_NAME -- "$@")
TEMP=$(getopt -o hcia:o:s: -l build-only -n $SCRIPT_NAME -- "$@")
if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
# Note the quotes around `$TEMP': they are essential!
@ -94,11 +91,10 @@ while true ; do
case "$1" in
-a) export ARCH=$2; shift 2 ;;
--build-only) BUILD_ONLY="1"; shift 1;;
--download-images) DOWNLOAD_OPT="--download $2"; shift 2;;
-o) export IMAGE_NAME=$2; shift 2 ;;
-s) export DIB_IMAGE_SIZE=$2; shift 2 ;;
-h) show_options 0;;
-c) CACHE_OPT=-c; shift ;;
-c) export IMAGE_CACHE_USE=1; shift ;;
-i) export CREATE_IMAGE=; shift ;;
--) shift ; break ;;
*) echo "Error: unsupported option $1." ; exit 1 ;;
@ -170,9 +166,11 @@ if [ $CREATE_IMAGE ]; then
IMAGE_CACHE_FILE=$TRIPLEO_ROOT/seed
# Create the image if it doesn't exist or we're not using image cache
acquire-image $CACHE_OPT $DOWNLOAD_OPT $IMAGE_CACHE_FILE $DIB -- -x -u \
-a $ARCH $ALWAYS_ELEMENTS $DIB_COMMON_ELEMENTS $SEED_DIB_EXTRA_ARGS \
2>&1 | tee $IMAGE_CACHE_FILE.log
if [ ! -e "$IMAGE_CACHE_FILE.qcow2" -o -z "$IMAGE_CACHE_USE" ] ; then
$DIB -x -u -a $ARCH $ALWAYS_ELEMENTS $DIB_COMMON_ELEMENTS $SEED_DIB_EXTRA_ARGS -o $IMAGE_CACHE_FILE 2>&1 | tee $IMAGE_CACHE_FILE.log
else
echo "Using cached seed image : $IMAGE_CACHE_FILE.qcow2"
fi
if [ -n "$BUILD_ONLY" ]; then
exit 0
fi

View File

@ -43,7 +43,6 @@ function show_options () {
echo " -- heat environment file for the undercloud."
echo " --heat-env-overcloud ENVFILE"
echo " -- heat environment file for the overcloud."
echo " --download-images URL -- Attempt to download images from a given URL."
echo
echo "Note that this script just chains devtest_variables, devtest_setup,"
echo "devtest_testenv, devtest_ramdisk, devtest_seed, devtest_undercloud,"
@ -57,7 +56,6 @@ function show_options () {
BUILD_ONLY=
NO_MERGEPY=
DEBUG_LOGGING=
DOWNLOAD_OPT=
NODES_ARG=
NO_UNDERCLOUD=
NETS_ARG=
@ -68,7 +66,7 @@ USE_CACHE=0
export TRIPLEO_CLEANUP=1
DEVTEST_START=$(date +%s) #nodocs
TEMP=$(getopt -o h,c -l build-only,no-mergepy,debug-logging,download-images:,existing-environment,help,trash-my-machine,nodes:,bm-networks:,no-undercloud,heat-env-overcloud:,heat-env-undercloud: -n $SCRIPT_NAME -- "$@")
TEMP=$(getopt -o h,c -l build-only,no-mergepy,debug-logging,existing-environment,help,trash-my-machine,nodes:,bm-networks:,no-undercloud,heat-env-overcloud:,heat-env-undercloud: -n $SCRIPT_NAME -- "$@")
if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
# Note the quotes around `$TEMP': they are essential!
@ -79,7 +77,6 @@ while true ; do
--build-only) BUILD_ONLY=--build-only; shift 1;;
--no-mergepy) NO_MERGEPY=--no-mergepy; shift 1;;
--debug-logging) DEBUG_LOGGING=--debug-logging; shift 1;;
--download-images) DOWNLOAD_OPT="--download-images $2"; shift 2;;
--trash-my-machine) CONTINUE=--trash-my-machine; shift 1;;
--existing-environment) TRIPLEO_CLEANUP=0; shift 1;;
--nodes) NODES_ARG="--nodes $2"; shift 2;;
@ -288,8 +285,7 @@ fi #nodocs
## #. See :doc:`devtest_ramdisk` for documentation::
DEVTEST_RD_START=$(date +%s) #nodocs
## devtest_ramdisk.sh
devtest_ramdisk.sh $DOWNLOAD_OPT #nodocs
devtest_ramdisk.sh
DEVTEST_RD_END=$(date +%s) #nodocs
## #. See :doc:`devtest_seed` for documentation. If you are not deploying an
@ -308,7 +304,7 @@ if [ -z "$NO_UNDERCLOUD" ]; then
else
ALLNODES="--all-nodes"
fi
devtest_seed.sh $BUILD_ONLY $ALLNODES $DEBUG_LOGGING $DOWNLOAD_OPT
devtest_seed.sh $BUILD_ONLY $ALLNODES $DEBUG_LOGGING
DEVTEST_SD_END=$(date +%s)
export no_proxy=${no_proxy:-},$(os-apply-config --type netaddress -m $TE_DATAFILE --key baremetal-network.seed.ip --key-default '192.0.2.1')
if [ -z "$BUILD_ONLY" ]; then
@ -332,7 +328,7 @@ fi
### --end
DEVTEST_UC_START=$(date +%s)
if [ -z "$NO_UNDERCLOUD" ]; then
devtest_undercloud.sh $TE_DATAFILE $BUILD_ONLY $DEBUG_LOGGING $DOWNLOAD_OPT $HEAT_ENV_UNDERCLOUD
devtest_undercloud.sh $TE_DATAFILE $BUILD_ONLY $DEBUG_LOGGING $HEAT_ENV_UNDERCLOUD
if [ -z "$BUILD_ONLY" ]; then
export no_proxy=$no_proxy,$(os-apply-config --type raw -m $TE_DATAFILE --key undercloud.endpointhost)
source $TRIPLEO_ROOT/tripleo-incubator/undercloudrc
@ -350,7 +346,7 @@ DEVTEST_UC_END=$(date +%s)
## devtest_overcloud.sh
### --end
DEVTEST_OC_START=$(date +%s)
devtest_overcloud.sh $BUILD_ONLY $NO_MERGEPY $DEBUG_LOGGING $DOWNLOAD_OPT $HEAT_ENV_OVERCLOUD
devtest_overcloud.sh $BUILD_ONLY $NO_MERGEPY $DEBUG_LOGGING $HEAT_ENV_OVERCLOUD
DEVTEST_OC_END=$(date +%s)
if [ -z "$BUILD_ONLY" ]; then
### --include

View File

@ -14,7 +14,6 @@ CONTROL_FLAVOR="baremetal"
BLOCKSTORAGE_FLAVOR="baremetal"
SWIFTSTORAGE_FLAVOR="baremetal"
USE_MERGEPY=1
DOWNLOAD_OPT=
function show_options () {
echo "Usage: $SCRIPT_NAME [options]"
@ -27,7 +26,6 @@ function show_options () {
echo " --build-only -- build the needed images but don't deploy them."
echo " --no-mergepy -- use the standalone Heat templates."
echo " --debug-logging -- Turn on debug logging in the built overcloud."
echo " --download-images URL -- attempt to download images from this URL."
echo " --heat-env -- path to a JSON heat environment file."
echo " Defaults to \$TRIPLEO_ROOT/overcloud-env.json."
echo " --compute-flavor -- Nova flavor to use for compute nodes."
@ -44,7 +42,7 @@ function show_options () {
exit $1
}
TEMP=$(getopt -o c,h -l build-only,no-mergepy,debug-logging,download-images:,heat-env:,compute-flavor:,control-flavor:,block-storage-flavor:,swift-storage-flavor:,help -n $SCRIPT_NAME -- "$@")
TEMP=$(getopt -o c,h -l build-only,no-mergepy,debug-logging,heat-env:,compute-flavor:,control-flavor:,block-storage-flavor:,swift-storage-flavor:,help -n $SCRIPT_NAME -- "$@")
if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
# Note the quotes around `$TEMP': they are essential!
@ -56,7 +54,6 @@ while true ; do
--build-only) BUILD_ONLY="1"; shift 1;;
--no-mergepy) USE_MERGEPY=0; shift 1;;
--debug-logging) DEBUG_LOGGING="1"; shift 1;;
--download-images) DOWNLOAD_OPT="--download $2"; shift 2;;
--heat-env) HEAT_ENV="$2"; shift 2;;
--compute-flavor) COMPUTE_FLAVOR="$2"; shift 2;;
--control-flavor) CONTROL_FLAVOR="$2"; shift 2;;
@ -96,11 +93,6 @@ OVERCLOUD_SSL_KEY=${SSLBASE:+$(<$SSLBASE.key)}
PUBLIC_API_URL=${12:-''}
SSL_ELEMENT=${SSLBASE:+openstack-ssl}
USE_CACHE=${USE_CACHE:-0}
if [ "$USE_CACHE" = "1" ]; then
CACHE_OPT=-c
else
CACHE_OPT=
fi
DIB_COMMON_ELEMENTS=${DIB_COMMON_ELEMENTS:-'stackuser'}
OVERCLOUD_CONTROL_DIB_EXTRA_ARGS=${OVERCLOUD_CONTROL_DIB_EXTRA_ARGS:-'rabbitmq-server cinder-tgt'}
OVERCLOUD_COMPUTE_DIB_EXTRA_ARGS=${OVERCLOUD_COMPUTE_DIB_EXTRA_ARGS:-''}
@ -135,9 +127,6 @@ OVERCLOUD_FIXED_RANGE_CIDR=${OVERCLOUD_FIXED_RANGE_CIDR:-"10.0.0.0/8"}
## ``$SSL_ELEMENT`` is used when building a cloud with SSL endpoints - it should be
## set to openstack-ssl in that situation.
## If you wish to use a locally cached previously built image pass -c to
## acquire-image. To download images pass --download BASE_URL.
## ::
NODE_ARCH=$(os-apply-config -m $TE_DATAFILE --key arch --type raw)
@ -151,26 +140,17 @@ if [ "$USE_UNDERCLOUD_UI" -ne 0 ] ; then
OVERCLOUD_BLOCKSTORAGE_DIB_EXTRA_ARGS="$OVERCLOUD_BLOCKSTORAGE_DIB_EXTRA_ARGS snmpd"
fi
## acquire-image $TRIPLEO_ROOT/overcloud-control \
## $TRIPLEO_ROOT/diskimage-builder/bin/disk-image-create -- $NODE_DIST \
## -a $NODE_ARCH ntp hosts \
## baremetal boot-stack cinder-api ceilometer-collector \
## ceilometer-api ceilometer-agent-central ceilometer-agent-notification \
## os-collect-config horizon neutron-network-node dhcp-all-interfaces \
## swift-proxy swift-storage keepalived haproxy \
## $DIB_COMMON_ELEMENTS $OVERCLOUD_CONTROL_DIB_EXTRA_ARGS ${SSL_ELEMENT:-}
### --end
acquire-image $CACHE_OPT $DOWNLOAD_OPT $TRIPLEO_ROOT/overcloud-control \
$TRIPLEO_ROOT/diskimage-builder/bin/disk-image-create -- $NODE_DIST \
-a $NODE_ARCH ntp hosts \
baremetal boot-stack cinder-api ceilometer-collector \
ceilometer-api ceilometer-agent-central ceilometer-agent-notification \
ceilometer-alarm-notifier ceilometer-alarm-evaluator \
os-collect-config horizon neutron-network-node dhcp-all-interfaces \
swift-proxy swift-storage keepalived haproxy \
$DIB_COMMON_ELEMENTS $OVERCLOUD_CONTROL_DIB_EXTRA_ARGS ${SSL_ELEMENT:-} 2>&1 | \
tee $TRIPLEO_ROOT/dib-overcloud-control.log
if [ ! -e $TRIPLEO_ROOT/overcloud-control.qcow2 -o "$USE_CACHE" == "0" ] ; then #nodocs
$TRIPLEO_ROOT/diskimage-builder/bin/disk-image-create $NODE_DIST \
-a $NODE_ARCH -o $TRIPLEO_ROOT/overcloud-control ntp hosts \
baremetal boot-stack cinder-api ceilometer-collector \
ceilometer-api ceilometer-agent-central ceilometer-agent-notification \
ceilometer-alarm-notifier ceilometer-alarm-evaluator \
os-collect-config horizon neutron-network-node dhcp-all-interfaces \
swift-proxy swift-storage keepalived haproxy \
$DIB_COMMON_ELEMENTS $OVERCLOUD_CONTROL_DIB_EXTRA_ARGS ${SSL_ELEMENT:-} 2>&1 | \
tee $TRIPLEO_ROOT/dib-overcloud-control.log
fi #nodocs
## #. Unless you are just building the images, load the image into Glance.
@ -185,21 +165,14 @@ fi #nodocs
## ::
if [ $OVERCLOUD_BLOCKSTORAGESCALE -gt 0 ]; then
## acquire-image $TRIPLEO_ROOT/overcloud-cinder-volume.qcow2 \
## $TRIPLEO_ROOT/diskimage-builder/bin/disk-image-create -- $NODE_DIST \
## -a $NODE_ARCH -o $TRIPLEO_ROOT/overcloud-cinder-volume ntp hosts \
## baremetal cinder-volume os-collect-config \
## dhcp-all-interfaces $DIB_COMMON_ELEMENTS \
## $OVERCLOUD_BLOCKSTORAGE_DIB_EXTRA_ARGS
### --end
acquire-image $TRIPLEO_ROOT/overcloud-cinder-volume.qcow2 \
$TRIPLEO_ROOT/diskimage-builder/bin/disk-image-create -- $NODE_DIST \
-a $NODE_ARCH -o $TRIPLEO_ROOT/overcloud-cinder-volume ntp hosts \
baremetal os-collect-config \
dhcp-all-interfaces $DIB_COMMON_ELEMENTS \
$OVERCLOUD_BLOCKSTORAGE_DIB_EXTRA_ARGS 2>&1 | \
tee $TRIPLEO_ROOT/dib-overcloud-cinder-volume.log
if [ ! -e $TRIPLEO_ROOT/overcloud-cinder-volume.qcow2 -o "$USE_CACHE" == "0" ]; then #nodocs
$TRIPLEO_ROOT/diskimage-builder/bin/disk-image-create $NODE_DIST \
-a $NODE_ARCH -o $TRIPLEO_ROOT/overcloud-cinder-volume ntp hosts \
baremetal os-collect-config \
dhcp-all-interfaces $DIB_COMMON_ELEMENTS \
$OVERCLOUD_BLOCKSTORAGE_DIB_EXTRA_ARGS 2>&1 | \
tee $TRIPLEO_ROOT/dib-overcloud-cinder-volume.log
fi #nodocs
## #. And again load the image into Glance, unless you are just building the images.
@ -214,27 +187,24 @@ fi
## deploys to host KVM (or QEMU, Xen, etc.) instances.
## ::
## acquire-image $TRIPLEO_ROOT/overcloud-compute \
## $TRIPLEO_ROOT/diskimage-builder/bin/disk-image-create -- $NODE_DIST \
## -a $NODE_ARCH ntp hosts \
## baremetal nova-compute nova-kvm neutron-openvswitch-agent os-collect-config \
## dhcp-all-interfaces $DIB_COMMON_ELEMENTS $OVERCLOUD_COMPUTE_DIB_EXTRA_ARGS
if [ ! -e $TRIPLEO_ROOT/overcloud-compute.qcow2 -o "$USE_CACHE" == "0" ] ; then #nodocs
$TRIPLEO_ROOT/diskimage-builder/bin/disk-image-create $NODE_DIST \
-a $NODE_ARCH -o $TRIPLEO_ROOT/overcloud-compute ntp hosts \
baremetal nova-compute nova-kvm neutron-openvswitch-agent os-collect-config \
dhcp-all-interfaces $DIB_COMMON_ELEMENTS $OVERCLOUD_COMPUTE_DIB_EXTRA_ARGS 2>&1 | \
tee $TRIPLEO_ROOT/dib-overcloud-compute.log
fi #nodocs
## #. Load the image into Glance. If you are just building the images you are done.
## ::
### --end
acquire-image $CACHE_OPT $DOWNLOAD_OPT $TRIPLEO_ROOT/overcloud-compute \
$TRIPLEO_ROOT/diskimage-builder/bin/disk-image-create -- \
$NODE_DIST -a $NODE_ARCH ntp hosts \
baremetal nova-compute nova-kvm neutron-openvswitch-agent os-collect-config \
dhcp-all-interfaces $DIB_COMMON_ELEMENTS $OVERCLOUD_COMPUTE_DIB_EXTRA_ARGS 2>&1 | \
tee $TRIPLEO_ROOT/dib-overcloud-compute.log
if [ -n "$BUILD_ONLY" ]; then
exit 0
fi
### --include
## #. Load the image into Glance. If you are just building the images you are done.
## ::
OVERCLOUD_COMPUTE_ID=$(load-image -d $TRIPLEO_ROOT/overcloud-compute.qcow2)
## #. For running an overcloud in VM's. For Physical machines, set to kvm:
@ -481,13 +451,9 @@ TEST_IMAGE_DIB_EXTRA_ARGS=${TEST_IMAGE_DIB_EXTRA_ARGS:-''}
if [ ! -e $TRIPLEO_ROOT/$USER_IMG_NAME -o "$USE_CACHE" == "0" ] ; then
if [ "$USE_CIRROS" == "0" ] ; then
### --include
## acquire-image $TRIPLEO_ROOT/user \
## $TRIPLEO_ROOT/diskimage-builder/bin/disk-image-create -- $NODE_DIST vm \
## $TEST_IMAGE_DIB_EXTRA_ARGS -a $NODE_ARCH 2>&1 | tee $TRIPLEO_ROOT/dib-user.log
$TRIPLEO_ROOT/diskimage-builder/bin/disk-image-create $NODE_DIST vm $TEST_IMAGE_DIB_EXTRA_ARGS \
-a $NODE_ARCH -o $TRIPLEO_ROOT/user 2>&1 | tee $TRIPLEO_ROOT/dib-user.log
### --end
acquire-image $CACHE_OPT $DOWNLOAD_OPT $TRIPLEO_ROOT/user \
$TRIPLEO_ROOT/diskimage-builder/bin/disk-image-create -- $NODE_DIST vm \
$TEST_IMAGE_DIB_EXTRA_ARGS -a $NODE_ARCH
else
VERSION=$($TRIPLEO_ROOT/diskimage-builder/elements/cache-url/bin/cache-url \
http://download.cirros-cloud.net/version/released >(cat) 1>&2)

View File

@ -11,15 +11,12 @@ function show_options () {
echo "Build a baremetal deployment ramdisk."
echo
echo "Options:"
echo " -h -- this help"
echo " --download-images URL -- attempt to download images from this URL."
echo " -h -- this help"
echo
exit $1
}
DOWNLOAD_OPT=
TEMP=$(getopt -o h -l download-images:,help -n $SCRIPT_NAME -- "$@")
TEMP=$(getopt -o h -l help -n $SCRIPT_NAME -- "$@")
if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
# Note the quotes around `$TEMP': they are essential!
@ -27,7 +24,6 @@ eval set -- "$TEMP"
while true ; do
case "$1" in
--download-images) DOWNLOAD_OPT="--download $2"; shift 2;;
-h | --help) show_options 0;;
--) shift ; break ;;
*) echo "Error: unsupported option $1." ; exit 1 ;;
@ -46,26 +42,19 @@ DIB_COMMON_ELEMENTS=${DIB_COMMON_ELEMENTS:-'stackuser'}
## -----------------------
## #. Create or download deployment ramdisk + kernel. These are used by the
## seed cloud and the undercloud for deployment to bare metal. To use a
## cache pass -c to acquire-image. To download the files pass --download BASE_URL.
## #. Create a deployment ramdisk + kernel. These are used by the seed cloud and
## the undercloud for deployment to bare metal.
## ::
NODE_ARCH=$(os-apply-config -m $TE_DATAFILE --key arch)
## acquire-image $TRIPLEO_ROOT/${DEPLOY_NAME} \
## $TRIPLEO_ROOT/diskimage-builder/bin/ramdisk-image-create -- \
## -a $NODE_ARCH $NODE_DIST $DEPLOY_IMAGE_ELEMENT \
## $DIB_COMMON_ELEMENTS
### --end
if [ "$USE_CACHE" = "1" ]; then
CACHE_OPT=-c
else
CACHE_OPT=
NODE_ARCH=$(os-apply-config -m $TE_DATAFILE --key arch)
if [ ! -e $TRIPLEO_ROOT/$DEPLOY_NAME.kernel -o \
! -e $TRIPLEO_ROOT/$DEPLOY_NAME.initramfs -o \
"$USE_CACHE" == "0" ] ; then
### --include
$TRIPLEO_ROOT/diskimage-builder/bin/ramdisk-image-create -a $NODE_ARCH \
$NODE_DIST $DEPLOY_IMAGE_ELEMENT -o $TRIPLEO_ROOT/$DEPLOY_NAME \
$DIB_COMMON_ELEMENTS 2>&1 | \
tee $TRIPLEO_ROOT/dib-deploy.log
### --end
fi
acquire-image $CACHE_OPT $DOWNLOAD_OPT $TRIPLEO_ROOT/${DEPLOY_NAME} \
$TRIPLEO_ROOT/diskimage-builder/bin/ramdisk-image-create -- \
-a $NODE_ARCH $NODE_DIST $DEPLOY_IMAGE_ELEMENT \
$DIB_COMMON_ELEMENTS 2>&1 | \
tee $TRIPLEO_ROOT/dib-deploy.log

View File

@ -17,16 +17,14 @@ function show_options () {
echo " --debug-logging -- Turn on debug logging in the seed."
echo " --all-nodes -- use all the nodes in the testenv rather than"
echo " just the first one."
echo " --download-images URL -- attempt to download images from this URL."
echo
exit $1
}
BUILD_ONLY=
DEBUG_LOGGING=
DOWNLOAD_OPT=
TEMP=$(getopt -o c,h -l all-nodes,build-only,debug-logging,download-images:,help -n $SCRIPT_NAME -- "$@")
TEMP=$(getopt -o c,h -l all-nodes,build-only,debug-logging,help -n $SCRIPT_NAME -- "$@")
if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
# Note the quotes around `$TEMP': they are essential!
@ -38,7 +36,6 @@ while true ; do
-c) USE_CACHE=1; shift 1;;
--build-only) BUILD_ONLY="--build-only"; shift 1;;
--debug-logging) DEBUG_LOGGING="seed-debug-logging"; shift 1;;
--download-images) DOWNLOAD_OPT="--download $2"; shift 2;;
-h | --help) show_options 0;;
--) shift ; break ;;
*) echo "Error: unsupported option $1." ; exit 1 ;;
@ -170,8 +167,6 @@ if [ -n "$REMOTE_OPERATIONS" ] ; then
fi
### --include
## #. We use the architecture defined in the test environment to build the seed vm.::
NODE_ARCH=$(os-apply-config -m $TE_DATAFILE --key arch --type raw)
## #. If you are only building disk images, there is no reason to boot the
@ -182,9 +177,6 @@ NODE_ARCH=$(os-apply-config -m $TE_DATAFILE --key arch --type raw)
## one, passing ``-c`` will boot the existing image rather than creating
## a new one.
## If you want to try to download a prebuilt VM pass --download BASE_URL to
## boot-seed-vm.
## ::
cd $TRIPLEO_ROOT
@ -195,8 +187,8 @@ if [ "$USE_CACHE" == "0" ] ; then
else
CACHE_OPT="-c"
fi
boot-seed-vm $CACHE_OPT $BUILD_ONLY -a $NODE_ARCH $NODE_DIST $DEBUG_LOGGING $DOWNLOAD_OPT \
neutron-dhcp-agent 2>&1 | tee $TRIPLEO_ROOT/dib-seed.log
boot-seed-vm $CACHE_OPT $BUILD_ONLY -a $NODE_ARCH $NODE_DIST $DEBUG_LOGGING neutron-dhcp-agent 2>&1 | \
tee $TRIPLEO_ROOT/dib-seed.log
if [ -n "${BUILD_ONLY}" ]; then
exit 0

View File

@ -10,7 +10,6 @@ BUILD_ONLY=
DEBUG_LOGGING=
HEAT_ENV=
FLAVOR="baremetal"
DOWNLOAD_OPT=
function show_options () {
echo "Usage: $SCRIPT_NAME [options]"
@ -22,7 +21,6 @@ function show_options () {
echo " -c -- re-use existing source/images if they exist."
echo " --build-only -- build the needed images but don't deploy them."
echo " --debug-logging -- Turn on debug logging in the undercloud."
echo " --download-images URL -- attempt to download images from this URL."
echo " --heat-env -- path to a JSON heat environment file."
echo " Defaults to \$TRIPLEO_ROOT/undercloud-env.json."
echo " --flavor -- flavor to use for the undercloud. Defaults"
@ -31,7 +29,7 @@ function show_options () {
exit $1
}
TEMP=$(getopt -o c,h -l build-only,debug-logging,download-images:,heat-env:,flavor:,help -n $SCRIPT_NAME -- "$@")
TEMP=$(getopt -o c,h -l build-only,debug-logging,heat-env:,flavor:,help -n $SCRIPT_NAME -- "$@")
if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
# Note the quotes around `$TEMP': they are essential!
@ -44,7 +42,6 @@ while true ; do
--debug-logging) DEBUG_LOGGING="1"; shift 1;;
--heat-env) HEAT_ENV="$2"; shift 2;;
--flavor) FLAVOR="$2"; shift 2;;
--download-images) DOWNLOAD_OPT="--download $2"; shift 2;;
-h | --help) show_options 0;;
--) shift ; break ;;
*) echo "Error: unsupported option $1." ; exit 1 ;;
@ -53,11 +50,6 @@ done
set -x
USE_CACHE=${USE_CACHE:-0}
if [ "$USE_CACHE" = "1" ]; then
CACHE_OPT=-c
else
CACHE_OPT=
fi
TE_DATAFILE=${1:?"A test environment description is required as \$1."}
UNDERCLOUD_DIB_EXTRA_ARGS=${UNDERCLOUD_DIB_EXTRA_ARGS:-'rabbitmq-server'}
@ -97,24 +89,17 @@ UNDERCLOUD_STACK_TIMEOUT=${UNDERCLOUD_STACK_TIMEOUT:-60}
## #. Create your undercloud image. This is the image that the seed nova
## will deploy to become the baremetal undercloud. $UNDERCLOUD_DIB_EXTRA_ARGS is
## meant to be used to pass additional arguments to disk-image-create.
## If you wish to use a locally cached previously built image pass -c to
## acquire-image. To download images pass --download BASE_URL.
## ::
NODE_ARCH=$(os-apply-config -m $TE_DATAFILE --key arch --type raw)
## acquire-image $TRIPLEO_ROOT/undercloud \
## $TRIPLEO_ROOT/diskimage-builder/bin/disk-image-create --\
## $NODE_DIST -a $NODE_ARCH \
## ntp baremetal boot-stack os-collect-config dhcp-all-interfaces \
## neutron-dhcp-agent $DIB_COMMON_ELEMENTS $UNDERCLOUD_DIB_EXTRA_ARGS
### --end
acquire-image $CACHE_OPT $DOWNLOAD_OPT $TRIPLEO_ROOT/undercloud \
$TRIPLEO_ROOT/diskimage-builder/bin/disk-image-create -- \
$NODE_DIST -a $NODE_ARCH \
if [ ! -e $TRIPLEO_ROOT/undercloud.qcow2 -o "$USE_CACHE" == "0" ] ; then #nodocs
$TRIPLEO_ROOT/diskimage-builder/bin/disk-image-create $NODE_DIST \
-a $NODE_ARCH -o $TRIPLEO_ROOT/undercloud \
ntp baremetal boot-stack os-collect-config dhcp-all-interfaces \
neutron-dhcp-agent $DIB_COMMON_ELEMENTS $UNDERCLOUD_DIB_EXTRA_ARGS 2>&1 | \
tee $TRIPLEO_ROOT/dib-undercloud.log
### --end
fi
if [ -n "$BUILD_ONLY" ]; then
exit 0
fi