bifrost/scripts/test-bifrost.sh
Julia Kreger edd5b67afc Switch to simple-init for network configuration
Bifrost defining and attempting to bake in configuration files
into configuration drives to allow initial configuration of
connectivity is a crazy idea.

Since the Openstack-infra folks have glean and simple-init, we
will utilize their tooling to provide greater flexibility across
operating systems.

Additionally, the ability to write out a simple debian style
interfaces config file has been retained, however off by default
as it is necessary for cirros testing.  In addition to this, the
ability for inventory based data to override the contents of the
network_info.json file.

Change-Id: Id85b18277b4d78acf418f63f046e39e889590719
Closes-Bug: 1463191
2015-07-14 08:31:34 -04:00

57 lines
1.9 KiB
Bash
Executable File

#!/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
# Perform a syntax check
ansible-playbook -vvvv -i inventory/localhost test-bifrost.yaml --syntax-check --list-tasks
# 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
set +e
# Create the test VM
ansible-playbook -vvvv -i inventory/localhost test-bifrost-create-vm.yaml
# Set BIFROST_INVENTORY_SOURCE
export BIFROST_INVENTORY_SOURCE=/tmp/baremetal.csv
# Execute the installation and VM startup test.
ansible-playbook -vvvv -i inventory/bifrost_inventory.py test-bifrost-dynamic.yaml -e use_cirros=true -e testing_user=cirros -e write_interfaces_file=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