diff options
Diffstat (limited to 'prototypes')
-rwxr-xr-x | prototypes/bifrost/scripts/destroy-env.sh | 6 | ||||
-rwxr-xr-x | prototypes/bifrost/scripts/osa-bifrost-deployment.sh | 142 | ||||
-rwxr-xr-x | prototypes/openstack-ansible/scripts/osa_deploy.sh | 1 | ||||
-rw-r--r-- | prototypes/openstack-ansible/var/ubuntu.yml | 2 |
4 files changed, 149 insertions, 2 deletions
diff --git a/prototypes/bifrost/scripts/destroy-env.sh b/prototypes/bifrost/scripts/destroy-env.sh index b73092b0f..1138da904 100755 --- a/prototypes/bifrost/scripts/destroy-env.sh +++ b/prototypes/bifrost/scripts/destroy-env.sh @@ -20,6 +20,10 @@ for vm in $(virsh list --all --name); do virsh destroy $vm || true virsh undefine $vm || true done +# Delete all hosts from vbmc (look for a port number) +for vm in $(vbmc list | awk '/[0-9]/{{ print $2 }}'); do + vbmc delete $vm +done service ironic-conductor stop || true @@ -47,6 +51,6 @@ rm -rf /var/lib/libvirt/images/*.qcow2 echo "restarting services" service dnsmasq restart || true service libvirtd restart -service ironic-api restart || true +service ironic-api restart || true service ironic-conductor start || true service ironic-inspector restart || true diff --git a/prototypes/bifrost/scripts/osa-bifrost-deployment.sh b/prototypes/bifrost/scripts/osa-bifrost-deployment.sh new file mode 100755 index 000000000..cca30c2fc --- /dev/null +++ b/prototypes/bifrost/scripts/osa-bifrost-deployment.sh @@ -0,0 +1,142 @@ +#!/bin/bash +# SPDX-license-identifier: Apache-2.0 +############################################################################## +# Copyright (c) 2016 Ericsson AB and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + +set -eux +set -o pipefail +export PYTHONUNBUFFERED=1 +SCRIPT_HOME="$(cd "$(dirname "$0")" && pwd)" +BIFROST_HOME=$SCRIPT_HOME/.. +ANSIBLE_INSTALL_ROOT=${ANSIBLE_INSTALL_ROOT:-/opt/stack} +ENABLE_VENV="false" +USE_DHCP="false" +USE_VENV="false" +BUILD_IMAGE=true +BAREMETAL_DATA_FILE=${BAREMETAL_DATA_FILE:-'/tmp/baremetal.json'} +PROVISION_WAIT_TIMEOUT=${PROVISION_WAIT_TIMEOUT:-3600} + +# Set defaults for ansible command-line options to drive the different +# tests. + +# NOTE(TheJulia/cinerama): The variables defined on the command line +# for the default and DHCP tests 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. The "build image" test does not +# use cirros. + +TEST_VM_NUM_NODES=6 +export TEST_VM_NODE_NAMES="jumphost controller00 controller01 controller02 compute00 compute01" +export VM_DOMAIN_TYPE="kvm" +# 8 vCPU, 60 GB HDD are minimum equipment +export VM_CPU=${VM_CPU:-8} +export VM_DISK=${VM_DISK:-100} +export VM_DISK_CACHE=${VM_DISK_CACHE:-unsafe} +TEST_PLAYBOOK="test-bifrost-infracloud.yaml" +USE_INSPECTOR=true +USE_CIRROS=false +TESTING_USER=root +# seting the memory to 16 GB to make more easily success +# 8 GB RAM is minimum equipment, but it work with at least 12 GB. +VM_MEMORY_SIZE=${VM_MEMORY_SIZE:-16384} +DOWNLOAD_IPA=true +CREATE_IPA_IMAGE=false +INSPECT_NODES=true +INVENTORY_DHCP=false +INVENTORY_DHCP_STATIC_IP=false +WRITE_INTERFACES_FILE=true + +# Set BIFROST_INVENTORY_SOURCE +export BIFROST_INVENTORY_SOURCE=/tmp/baremetal.json + +# DIB custom elements path +export ELEMENTS_PATH=/opt/puppet-infracloud/files/elements + +# settings for console access +export DIB_DEV_USER_PWDLESS_SUDO=yes +export DIB_DEV_USER_PASSWORD=devuser + +# settings for distro: trusty/ubuntu-minimal, 7/centos7 +export DIB_OS_RELEASE=${DIB_OS_RELEASE:-xenial} +export DIB_OS_ELEMENT=${DIB_OS_ELEMENT:-ubuntu-minimal} + +# for centos 7: "vim,less,bridge-utils,iputils,rsyslog,curl" +export DIB_OS_PACKAGES=${DIB_OS_PACKAGES:-"vlan,vim,less,bridge-utils,sudo,language-pack-en,iputils-ping,rsyslog,curl,python,debootstrap,ifenslave,ifenslave-2.6,lsof,lvm2,tcpdump,nfs-kernel-server,chrony"} + +# Additional dib elements +export EXTRA_DIB_ELEMENTS=${EXTRA_DIB_ELEMENTS:-"openssh-server"} + +# 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 +o nounset +$SCRIPT_HOME/env-setup.sh +source ${ANSIBLE_INSTALL_ROOT}/ansible/hacking/env-setup +ANSIBLE=$(which ansible-playbook) +set -x -o nounset + +logs_on_exit() { + $SCRIPT_HOME/collect-test-info.sh +} +trap logs_on_exit EXIT + +# Change working directory +cd $BIFROST_HOME/playbooks + +# Syntax check of dynamic inventory test path +for task in syntax-check list-tasks; do + ${ANSIBLE} -vvvv \ + -i inventory/localhost \ + test-bifrost-create-vm.yaml \ + --${task} + ${ANSIBLE} -vvvv \ + -i inventory/localhost \ + ${TEST_PLAYBOOK} \ + --${task} \ + -e testing_user=${TESTING_USER} +done + +# Create the test VMS +${ANSIBLE} -vvvv \ + -i inventory/localhost \ + test-bifrost-create-vm.yaml \ + -e test_vm_num_nodes=${TEST_VM_NUM_NODES} \ + -e test_vm_memory_size=${VM_MEMORY_SIZE} \ + -e enable_venv=${ENABLE_VENV} \ + -e test_vm_domain_type=${VM_DOMAIN_TYPE} \ + -e baremetal_json_file=${BAREMETAL_DATA_FILE} + +# Execute the installation and VM startup test. +${ANSIBLE} -vvvv \ + -i inventory/bifrost_inventory.py \ + ${TEST_PLAYBOOK} \ + -e use_cirros=${USE_CIRROS} \ + -e testing_user=${TESTING_USER} \ + -e test_vm_num_nodes=${TEST_VM_NUM_NODES} \ + -e inventory_dhcp=${INVENTORY_DHCP} \ + -e inventory_dhcp_static_ip=${INVENTORY_DHCP_STATIC_IP} \ + -e enable_venv=${ENABLE_VENV} \ + -e enable_inspector=${USE_INSPECTOR} \ + -e inspect_nodes=${INSPECT_NODES} \ + -e download_ipa=${DOWNLOAD_IPA} \ + -e create_ipa_image=${CREATE_IPA_IMAGE} \ + -e write_interfaces_file=${WRITE_INTERFACES_FILE} \ + -e ipv4_gateway=192.168.122.1 \ + -e wait_timeout=${PROVISION_WAIT_TIMEOUT} +EXITCODE=$? + +if [ $EXITCODE != 0 ]; then + echo "****************************" + echo "Test failed. See logs folder" + echo "****************************" +fi + +exit $EXITCODE diff --git a/prototypes/openstack-ansible/scripts/osa_deploy.sh b/prototypes/openstack-ansible/scripts/osa_deploy.sh index 95f593194..79625d211 100755 --- a/prototypes/openstack-ansible/scripts/osa_deploy.sh +++ b/prototypes/openstack-ansible/scripts/osa_deploy.sh @@ -4,7 +4,6 @@ export OSA_PATH=/opt/openstack-ansible export LOG_PATH=$OSA_PATH/log export PLAYBOOK_PATH=$OSA_PATH/playbooks export OSA_BRANCH=${OSA_BRANCH:-"master"} - JUMPHOST_IP="192.168.122.2" sudo /bin/rm -rf $LOG_PATH diff --git a/prototypes/openstack-ansible/var/ubuntu.yml b/prototypes/openstack-ansible/var/ubuntu.yml index 71f54ecb5..9464384b3 100644 --- a/prototypes/openstack-ansible/var/ubuntu.yml +++ b/prototypes/openstack-ansible/var/ubuntu.yml @@ -2,5 +2,7 @@ OSA_URL: https://git.openstack.org/openstack/openstack-ansible OSA_PATH: /opt/openstack-ansible OSA_ETC_PATH: /etc/openstack_deploy +OSA_BRANCH: "{{ lookup('env','OSA_BRANCH') }}" + JUMPHOST_IP: 192.168.122.2 host_info: {'jumphost':{'MGMT_IP': '172.29.236.10','VLAN_IP': '192.168.122.2', 'STORAGE_IP': '172.29.244.10'},'controller00':{'MGMT_IP': '172.29.236.11','VLAN_IP': '192.168.122.3', 'STORAGE_IP': '172.29.244.11'},'controller01':{'MGMT_IP': '172.29.236.12','VLAN_IP': '192.168.122.4', 'STORAGE_IP': '172.29.244.12'},'controller02':{'MGMT_IP': '172.29.236.13','VLAN_IP': '192.168.122.5', 'STORAGE_IP': '172.29.240.13'},'compute00':{'MGMT_IP': '172.29.236.14','VLAN_IP': '192.168.122.6','VLAN_IP_SECOND': '173.29.241.1','VXLAN_IP': '172.29.240.14', 'STORAGE_IP': '172.29.244.14'},'compute01':{'MGMT_IP': '172.29.236.15','VLAN_IP': '192.168.122.7','VLAN_IP_SECOND': '173.29.241.2','VXLAN_IP': '172.29.240.15', 'STORAGE_IP': '172.29.244.15'}} |