Merge "Allow installing tempest only with keystone"

This commit is contained in:
Jenkins 2014-11-14 03:17:19 +00:00 committed by Gerrit Code Review
commit d4732d76fc

View File

@ -111,34 +111,36 @@ function configure_tempest {
# ... Also ensure we only take active images, so we don't get snapshots in process # ... Also ensure we only take active images, so we don't get snapshots in process
declare -a images declare -a images
while read -r IMAGE_NAME IMAGE_UUID; do if is_service_enabled glance; then
if [ "$IMAGE_NAME" = "$DEFAULT_IMAGE_NAME" ]; then while read -r IMAGE_NAME IMAGE_UUID; do
image_uuid="$IMAGE_UUID" if [ "$IMAGE_NAME" = "$DEFAULT_IMAGE_NAME" ]; then
image_uuid_alt="$IMAGE_UUID" image_uuid="$IMAGE_UUID"
fi image_uuid_alt="$IMAGE_UUID"
images+=($IMAGE_UUID) fi
# TODO(stevemar): update this command to use openstackclient's `openstack image list` images+=($IMAGE_UUID)
# when it supports listing by status. # TODO(stevemar): update this command to use openstackclient's `openstack image list`
done < <(glance image-list --status=active | awk -F'|' '!/^(+--)|ID|aki|ari/ { print $3,$2 }') # when it supports listing by status.
done < <(glance image-list --status=active | awk -F'|' '!/^(+--)|ID|aki|ari/ { print $3,$2 }')
case "${#images[*]}" in case "${#images[*]}" in
0) 0)
echo "Found no valid images to use!" echo "Found no valid images to use!"
exit 1 exit 1
;; ;;
1) 1)
if [ -z "$image_uuid" ]; then if [ -z "$image_uuid" ]; then
image_uuid=${images[0]} image_uuid=${images[0]}
image_uuid_alt=${images[0]} image_uuid_alt=${images[0]}
fi fi
;; ;;
*) *)
if [ -z "$image_uuid" ]; then if [ -z "$image_uuid" ]; then
image_uuid=${images[0]} image_uuid=${images[0]}
image_uuid_alt=${images[1]} image_uuid_alt=${images[1]}
fi fi
;; ;;
esac esac
fi
# Create tempest.conf from tempest.conf.sample # Create tempest.conf from tempest.conf.sample
# copy every time, because the image UUIDS are going to change # copy every time, because the image UUIDS are going to change
@ -162,63 +164,65 @@ function configure_tempest {
ALT_TENANT_NAME=${ALT_TENANT_NAME:-alt_demo} ALT_TENANT_NAME=${ALT_TENANT_NAME:-alt_demo}
ADMIN_TENANT_ID=$(openstack project list | awk "/ admin / { print \$2 }") ADMIN_TENANT_ID=$(openstack project list | awk "/ admin / { print \$2 }")
# If the ``DEFAULT_INSTANCE_TYPE`` not declared, use the new behavior if is_service_enabled nova; then
# Tempest creates instane types for himself # If the ``DEFAULT_INSTANCE_TYPE`` not declared, use the new behavior
if [[ -z "$DEFAULT_INSTANCE_TYPE" ]]; then # Tempest creates instane types for himself
available_flavors=$(nova flavor-list) if [[ -z "$DEFAULT_INSTANCE_TYPE" ]]; then
if [[ ! ( $available_flavors =~ 'm1.nano' ) ]]; then available_flavors=$(nova flavor-list)
if is_arch "ppc64"; then if [[ ! ( $available_flavors =~ 'm1.nano' ) ]]; then
# qemu needs at least 128MB of memory to boot on ppc64 if is_arch "ppc64"; then
nova flavor-create m1.nano 42 128 0 1 # qemu needs at least 128MB of memory to boot on ppc64
else nova flavor-create m1.nano 42 128 0 1
nova flavor-create m1.nano 42 64 0 1 else
nova flavor-create m1.nano 42 64 0 1
fi
fi fi
fi flavor_ref=42
flavor_ref=42 boto_instance_type=m1.nano
boto_instance_type=m1.nano if [[ ! ( $available_flavors =~ 'm1.micro' ) ]]; then
if [[ ! ( $available_flavors =~ 'm1.micro' ) ]]; then if is_arch "ppc64"; then
if is_arch "ppc64"; then nova flavor-create m1.micro 84 256 0 1
nova flavor-create m1.micro 84 256 0 1 else
else nova flavor-create m1.micro 84 128 0 1
nova flavor-create m1.micro 84 128 0 1 fi
fi fi
fi flavor_ref_alt=84
flavor_ref_alt=84 else
else # Check Nova for existing flavors and, if set, look for the
# Check Nova for existing flavors and, if set, look for the # ``DEFAULT_INSTANCE_TYPE`` and use that.
# ``DEFAULT_INSTANCE_TYPE`` and use that. boto_instance_type=$DEFAULT_INSTANCE_TYPE
boto_instance_type=$DEFAULT_INSTANCE_TYPE flavor_lines=`nova flavor-list`
flavor_lines=`nova flavor-list` IFS=$'\r\n'
IFS=$'\r\n' flavors=""
flavors="" for line in $flavor_lines; do
for line in $flavor_lines; do f=$(echo $line | awk "/ $DEFAULT_INSTANCE_TYPE / { print \$2 }")
f=$(echo $line | awk "/ $DEFAULT_INSTANCE_TYPE / { print \$2 }") flavors="$flavors $f"
flavors="$flavors $f" done
done
for line in $flavor_lines; do for line in $flavor_lines; do
flavors="$flavors `echo $line | grep -v "^\(|\s*ID\|+--\)" | cut -d' ' -f2`" flavors="$flavors `echo $line | grep -v "^\(|\s*ID\|+--\)" | cut -d' ' -f2`"
done done
IFS=" " IFS=" "
flavors=($flavors) flavors=($flavors)
num_flavors=${#flavors[*]} num_flavors=${#flavors[*]}
echo "Found $num_flavors flavors" echo "Found $num_flavors flavors"
if [[ $num_flavors -eq 0 ]]; then if [[ $num_flavors -eq 0 ]]; then
echo "Found no valid flavors to use!" echo "Found no valid flavors to use!"
exit 1 exit 1
fi
flavor_ref=${flavors[0]}
flavor_ref_alt=$flavor_ref
# ensure flavor_ref and flavor_ref_alt have different values
# some resize instance in tempest tests depends on this.
for f in ${flavors[@]:1}; do
if [[ $f -ne $flavor_ref ]]; then
flavor_ref_alt=$f
break
fi fi
done flavor_ref=${flavors[0]}
flavor_ref_alt=$flavor_ref
# ensure flavor_ref and flavor_ref_alt have different values
# some resize instance in tempest tests depends on this.
for f in ${flavors[@]:1}; do
if [[ $f -ne $flavor_ref ]]; then
flavor_ref_alt=$f
break
fi
done
fi
fi fi
if [ "$Q_USE_NAMESPACE" != "False" ]; then if [ "$Q_USE_NAMESPACE" != "False" ]; then
@ -463,20 +467,22 @@ function init_tempest {
local kernel="$image_dir/${base_image_name}-vmlinuz" local kernel="$image_dir/${base_image_name}-vmlinuz"
local ramdisk="$image_dir/${base_image_name}-initrd" local ramdisk="$image_dir/${base_image_name}-initrd"
local disk_image="$image_dir/${base_image_name}-blank.img" local disk_image="$image_dir/${base_image_name}-blank.img"
# if the cirros uec downloaded and the system is uec capable if is_service_enabled nova; then
if [ -f "$kernel" -a -f "$ramdisk" -a -f "$disk_image" -a "$VIRT_DRIVER" != "openvz" \ # if the cirros uec downloaded and the system is uec capable
-a \( "$LIBVIRT_TYPE" != "lxc" -o "$VIRT_DRIVER" != "libvirt" \) ]; then if [ -f "$kernel" -a -f "$ramdisk" -a -f "$disk_image" -a "$VIRT_DRIVER" != "openvz" \
echo "Prepare aki/ari/ami Images" -a \( "$LIBVIRT_TYPE" != "lxc" -o "$VIRT_DRIVER" != "libvirt" \) ]; then
mkdir -p $BOTO_MATERIALS_PATH echo "Prepare aki/ari/ami Images"
( #new namespace mkdir -p $BOTO_MATERIALS_PATH
# tenant:demo ; user: demo ( #new namespace
source $TOP_DIR/accrc/demo/demo # tenant:demo ; user: demo
euca-bundle-image -r ${CIRROS_ARCH} -i "$kernel" --kernel true -d "$BOTO_MATERIALS_PATH" source $TOP_DIR/accrc/demo/demo
euca-bundle-image -r ${CIRROS_ARCH} -i "$ramdisk" --ramdisk true -d "$BOTO_MATERIALS_PATH" euca-bundle-image -r ${CIRROS_ARCH} -i "$kernel" --kernel true -d "$BOTO_MATERIALS_PATH"
euca-bundle-image -r ${CIRROS_ARCH} -i "$disk_image" -d "$BOTO_MATERIALS_PATH" euca-bundle-image -r ${CIRROS_ARCH} -i "$ramdisk" --ramdisk true -d "$BOTO_MATERIALS_PATH"
) 2>&1 </dev/null | cat euca-bundle-image -r ${CIRROS_ARCH} -i "$disk_image" -d "$BOTO_MATERIALS_PATH"
else ) 2>&1 </dev/null | cat
echo "Boto materials are not prepared" else
echo "Boto materials are not prepared"
fi
fi fi
} }