Merge "Test script to drive image testing"

This commit is contained in:
Jenkins 2015-08-19 18:22:53 +00:00 committed by Gerrit Code Review
commit f306c4b69d
7 changed files with 88 additions and 0 deletions

View File

@ -375,3 +375,16 @@ and thus will not automatically grow the root partition.
Due to the nature of the design, it would be relatively easy for a user to
import automatic growth or reconfiguration steps either in the image to be
deployed, or in post-deployment steps via custom Ansible playbooks.
Custom IPA Images
=================
Bifrost supports the ability for a user to build a custom IPA ramdisk
utilizing the diskimage-builder element "ironic-agent". In order to utilize
this feature, the download_ipa setting must be set to "false" and the
create_ipa_image must be set to "true". By default, the playbook will build
a Debian based IPA image, if a pre-existing IPA image is not present on disk.
If you wish to include an extra element into the IPA disk image, such as a
custom hardware manager, you can pass the variable "ipa_extra_dib_elements"
as a space separated list of elements. This defaults to an emtpy string.

View File

@ -7,6 +7,7 @@
roles:
- { role: bifrost-prep-for-install, when: skip_install is not defined }
- bifrost-ironic-install
- { role: bifrost-create-dib-image, dib_imagename: "{{ http_boot_folder }}/ipa", build_ramdisk: false, dib_os_element: "{{ ipa_dib_os_element|default('debian') }}", dib_elements: "ironic-agent {{ ipa_extra_dib_elements | default('') }}", when: create_ipa_image | bool == true }
- { role: bifrost-create-dib-image, dib_imagename: "{{ deploy_image }}", dib_imagetype: "qcow2", dib_os_element: "{{ dib_os_element|default('debian') }}", dib_elements: "vm serial-console simple-init {{ extra_dib_elements|default('') }}", dib_packages: "{{ dib_packages|default('') }}", when: create_image_via_dib == true and transform_boot_image == false }
environment:
http_proxy: "{{ lookup('env','http_proxy') }}"

View File

@ -54,3 +54,6 @@ create_image_via_dib: true
# Transform boot image is intended for use with the Ubuntu trusty image. It makes the image bootable by installing Grub.
# Setting to prepend a partition image with a boot sector and partition table.
transform_boot_image: false
# Create IPA image instead of downloading an pre-made CoreOS IPA image.
create_ipa_image: false

View File

@ -24,6 +24,8 @@ deploy_image_filename: "deployment_image.qcow2"
deploy_image: "{{http_boot_folder}}/{{deploy_image_filename}}"
# Use cirros instead of building an image via diskimage-builder
use_cirros: false
# Download IPA by default
download_ipa: true
cirros_deploy_image_upstream_url: http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img
# By default Bifrost will deploy dnsmasq to utilize as an integrated DHCP
# server. If you already have a DHCP server, you will need to disable

View File

@ -224,6 +224,7 @@
when: "{{include_dhcp_server|bool}}"
- name: "Download Ironic Python Agent kernel & image"
include: download_ipa_image.yml
when: download_ipa | bool == true
- name: "Download cirros to use for deployment if requested"
get_url: url={{ cirros_deploy_image_upstream_url }} dest="{{ deploy_image }}"
when: "{{use_cirros|bool}}"

View File

@ -51,6 +51,10 @@
- role: bifrost-ironic-install
cleaning: false
testing: true
# NOTE(TheJulia): While the next step creates a ramdisk, some elements
# do not support ramdisk-image-create as they invoke steps to cleanup
# the ramdisk which causes ramdisk-image-create to believe it failed.
- { role: bifrost-create-dib-image, dib_imagename: "{{ http_boot_folder }}/ipa", build_ramdisk: false, dib_os_element: "{{ ipa_dib_os_element|default('debian') }}", dib_elements: "ironic-agent {{ ipa_extra_dib_elements | default('') }}", when: create_ipa_image | bool == true }
- { role: bifrost-create-dib-image, dib_imagetype: "qcow2", dib_imagename: "{{deploy_image}}", dib_os_element: "{{ dib_os_element|default('debian') }}", dib_elements: "vm serial-console simple-init {{ extra_dib_elements|default('') }}", dib_packages: "{{ dib_packages|default('') }}", when: create_image_via_dib == true and transform_boot_image == false }
environment:
http_proxy: "{{ lookup('env','http_proxy') }}"

View File

@ -0,0 +1,64 @@
#!/bin/bash
set -eux
set -o pipefail
export PYTHONUNBUFFERED=1
SCRIPT_HOME=$(dirname $0)
BIFROST_HOME=$SCRIPT_HOME/..
# Install Ansible
$SCRIPT_HOME/env-setup.sh
# Source Ansible
# NOTE(TheJulia): Ansible stable-1.9 source method tosses an error deep
# under the hood which -x will detect, so for this step, we need to suspend
# and then re-enable the feature.
set +x
source /opt/stack/ansible/hacking/env-setup
set -x
# Change working directory
cd $BIFROST_HOME/playbooks
# Syntax check of dynamic inventory test path
ansible-playbook -vvvv -i inventory/localhost test-bifrost-create-vm.yaml --syntax-check --list-tasks
ansible-playbook -vvvv -i inventory/localhost test-bifrost-dynamic.yaml --syntax-check --list-tasks
# Create the test VM
ansible-playbook -vvvv -i inventory/localhost test-bifrost-create-vm.yaml
set +e
# Set BIFROST_INVENTORY_SOURCE
export BIFROST_INVENTORY_SOURCE=/tmp/baremetal.csv
# Execute the installation and VM startup test.
# NOTE(TheJulia): The variables defined on the command line are to
# drive the use of Cirros as the deployed operating system, and
# as such sets the test user to cirros, and writes a debian style
# interfaces file out to the configuration drive as cirros does
# not support the network_info.json format file placed in the
# configuration drive.
ansible-playbook -vvvv -i inventory/bifrost_inventory.py \
test-bifrost-dynamic.yaml \
-e testing_user=root \
-e download_ipa=false \
-e create_ipa_image=true
EXITCODE=$?
if [ $EXITCODE != 0 ]; then
echo "****************************"
echo "Test failed. See logs folder"
echo "****************************"
fi
echo "Making logs directory and collecting logs."
mkdir ../logs
sudo cp /var/log/libvirt/baremetal_logs/testvm1_console.log ../logs/
sudo chown $USER ../logs/testvm1_console.log
dmesg &> ../logs/dmesg.log
sudo netstat -apn &> ../logs/netstat.log
sudo iptables -L -n -v &> ../logs/iptables.log
sudo cp /var/log/upstart/ironic-api.log ../logs/
sudo chown $USER ../logs/ironic-api.log
sudo cp /var/log/upstart/ironic-conductor.log ../logs/
sudo chown $USER ../logs/ironic-conductor.log
exit $EXITCODE