Merge "Add support for diskimage-builder tracing"

This commit is contained in:
Jenkins 2016-12-14 19:57:11 +00:00 committed by Gerrit Code Review
commit 547d03ae25
3 changed files with 18 additions and 3 deletions

View File

@ -34,8 +34,12 @@ function build_octavia_worker_image {
TOKEN=$(openstack token issue | grep ' id ' | get_field 2) TOKEN=$(openstack token issue | grep ' id ' | get_field 2)
die_if_not_set $LINENO TOKEN "Keystone failed to get token." die_if_not_set $LINENO TOKEN "Keystone failed to get token."
octavia_dib_tracing_arg=
if [ "$OCTAVIA_DIB_TRACING" != "0" ]; then
octavia_dib_tracing_arg="-x"
fi
if ! [ -f $OCTAVIA_AMP_IMAGE_FILE ]; then if ! [ -f $OCTAVIA_AMP_IMAGE_FILE ]; then
$OCTAVIA_DIR/diskimage-create/diskimage-create.sh -s 2 -o $OCTAVIA_AMP_IMAGE_FILE $OCTAVIA_DIR/diskimage-create/diskimage-create.sh $octavia_dib_tracing_arg -s 2 -o $OCTAVIA_AMP_IMAGE_FILE
fi fi
upload_image file://${OCTAVIA_AMP_IMAGE_FILE} $TOKEN upload_image file://${OCTAVIA_AMP_IMAGE_FILE} $TOKEN

View File

@ -89,3 +89,5 @@ OCTAVIA_PREGENERATED_CERTS_DIR=${OCTAVIA_PREGENERATED_CERTS_DIR:-"${OCTAVIA_DIR}
OCTAVIA_NODE=${OCTAVIA_NODE:-"standalone"} OCTAVIA_NODE=${OCTAVIA_NODE:-"standalone"}
OCTAVIA_CONTROLLER_IP_PORT_LIST=${OCTAVIA_CONTROLLER_IP_PORT_LIST:-"auto"} OCTAVIA_CONTROLLER_IP_PORT_LIST=${OCTAVIA_CONTROLLER_IP_PORT_LIST:-"auto"}
OCTAVIA_MGMT_PORT_IP=${OCTAVIA_MGMT_PORT_IP:-"auto"} OCTAVIA_MGMT_PORT_IP=${OCTAVIA_MGMT_PORT_IP:-"auto"}
OCTAVIA_DIB_TRACING=${OCTAVIA_DIB_TRACING:-"0"}

View File

@ -45,6 +45,7 @@ usage() {
echo " '-t' is the image type (default: qcow2)" echo " '-t' is the image type (default: qcow2)"
echo " '-v' display the script version" echo " '-v' display the script version"
echo " '-w' working directory for image building (default: .)" echo " '-w' working directory for image building (default: .)"
echo " '-x' enable tracing for diskimage-builder"
echo echo
exit 1 exit 1
} }
@ -71,8 +72,9 @@ if [ -z $OCTAVIA_REPO_PATH ]; then
AMP_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) AMP_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
OCTAVIA_REPO_PATH=${OCTAVIA_REPO_PATH:-${AMP_DIR%/*}} OCTAVIA_REPO_PATH=${OCTAVIA_REPO_PATH:-${AMP_DIR%/*}}
fi fi
dib_enable_tracing=
while getopts "a:b:c:d:hi:o:t:r:s:vw:" opt; do while getopts "a:b:c:d:hi:o:t:r:s:vw:x" opt; do
case $opt in case $opt in
a) a)
AMP_ARCH=$OPTARG AMP_ARCH=$OPTARG
@ -138,6 +140,8 @@ while getopts "a:b:c:d:hi:o:t:r:s:vw:" opt; do
w) w)
AMP_WORKING_DIR=$OPTARG AMP_WORKING_DIR=$OPTARG
;; ;;
x) dib_enable_tracing=1
;;
*) *)
usage usage
;; ;;
@ -396,7 +400,12 @@ if [ "$AMP_BASEOS" = "ubuntu" ]; then
export DIB_CLOUD_INIT_DATASOURCES=$CLOUD_INIT_DATASOURCES export DIB_CLOUD_INIT_DATASOURCES=$CLOUD_INIT_DATASOURCES
fi fi
disk-image-create -a $AMP_ARCH -o $AMP_OUTPUTFILENAME -t $AMP_IMAGETYPE --image-size $AMP_IMAGESIZE --image-cache $AMP_CACHEDIR $AMP_element_sequence dib_trace_arg=
if [ -n "$dib_enable_tracing" ]; then
dib_trace_arg="-x"
fi
disk-image-create $dib_trace_arg -a $AMP_ARCH -o $AMP_OUTPUTFILENAME -t $AMP_IMAGETYPE --image-size $AMP_IMAGESIZE --image-cache $AMP_CACHEDIR $AMP_element_sequence
popd > /dev/null # out of $TEMP popd > /dev/null # out of $TEMP
rm -rf $TEMP rm -rf $TEMP