diff --git a/dev/functions b/dev/functions index f9ee17d5a..f7a54c603 100644 --- a/dev/functions +++ b/dev/functions @@ -431,17 +431,35 @@ function run_tenks_playbook { # $2: The name of the playbook to run. local tenks_path="$1" local tenks_playbook="$2" + local tenks_deploy_type="${3:-default}" + local parent="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" - if [[ -f "${KOLLA_CONFIG_PATH:-/etc/kolla}/admin-openrc.sh" ]]; then - # Overcloud + if [[ ! -f "${KOLLA_CONFIG_PATH:-/etc/kolla}/admin-openrc.sh" && + "${tenks_deploy_type}" = "compute" ]]; then + + die $LINENO "Missing admin-openrc.sh & tenks_deploy_type is compute." + exit 1 + fi + if [[ -f "${KOLLA_CONFIG_PATH:-/etc/kolla}/admin-openrc.sh" && + ( "${tenks_deploy_type}" = "default" || + "${tenks_deploy_type}" = "compute" ) ]]; then + + # Deploys Compute from Overcloud default_tenks_config=tenks-deploy-config-compute.yml source "${KOLLA_CONFIG_PATH:-/etc/kolla}/admin-openrc.sh" - else - # Seed + + elif [[ "${tenks_deploy_type}" = "default" || + "${tenks_deploy_type}" = "overcloud" ]]; then + + # Deploys Overcloud from Seed default_tenks_config=tenks-deploy-config-overcloud.yml write_bifrost_clouds_yaml export OS_CLOUD=bifrost + + else + die $LINENO "Bad tenks_deploy_type: ${tenks_deploy_type}" + exit 1 fi # Allow a specific Tenks config file to be specified via @@ -461,6 +479,7 @@ function tenks_deploy { # 'breth1' exists. Arguments: # $1: The path to the Tenks repo. local tenks_path="$1" + local tenks_deploy_type="${2:-default}" echo "Configuring Tenks" @@ -483,7 +502,7 @@ function tenks_deploy { # vSwitch. sudo cp --no-clobber "$parent/ovs-vsctl" /usr/bin/ovs-vsctl - run_tenks_playbook "$tenks_path" deploy.yml + run_tenks_playbook "$tenks_path" deploy.yml "$tenks_deploy_type" } function tenks_teardown { @@ -492,6 +511,7 @@ function tenks_teardown { # Arguments: # $1: The path to the Tenks repo. local tenks_path="$1" + local tenks_deploy_type="${2:-default}" echo "Tearing down Tenks" @@ -503,7 +523,7 @@ function tenks_teardown { # Source the Tenks venv. source ${TENKS_VENV_PATH:-$HOME/tenks-test-venv}/bin/activate - run_tenks_playbook "$tenks_path" teardown.yml + run_tenks_playbook "$tenks_path" teardown.yml "$tenks_deploy_type" } # General purpose diff --git a/dev/tenks-deploy-compute.sh b/dev/tenks-deploy-compute.sh new file mode 100755 index 000000000..ac768df99 --- /dev/null +++ b/dev/tenks-deploy-compute.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +set -eu +set -o pipefail + +# Simple script to configure and deploy a Tenks cluster. This should be +# executed from within the VM. Arguments: +# $1: The path to the Tenks repo. + +PARENT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" + +source "${PARENT}/functions" + + +function main { + if [ -z ${1+x} ]; then + echo "Usage: $0 " + return 1 + fi + tenks_path="$1" + + config_init + tenks_deploy "$tenks_path" compute +} + +main "$@" diff --git a/dev/tenks-deploy-overcloud.sh b/dev/tenks-deploy-overcloud.sh new file mode 100755 index 000000000..83abb7b84 --- /dev/null +++ b/dev/tenks-deploy-overcloud.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +set -eu +set -o pipefail + +# Simple script to configure and deploy a Tenks cluster. This should be +# executed from within the VM. Arguments: +# $1: The path to the Tenks repo. + +PARENT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" + +source "${PARENT}/functions" + + +function main { + if [ -z ${1+x} ]; then + echo "Usage: $0 " + return 1 + fi + tenks_path="$1" + + config_init + tenks_deploy "$tenks_path" overcloud +} + +main "$@" diff --git a/dev/tenks-teardown-compute.sh b/dev/tenks-teardown-compute.sh new file mode 100755 index 000000000..227d36308 --- /dev/null +++ b/dev/tenks-teardown-compute.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +set -eu +set -o pipefail + +# Simple script to teardown a Tenks cluster. This should be executed from +# within the VM. Arguments: +# $1: The path to the Tenks repo. + +PARENT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" + +source "${PARENT}/functions" + + +function main { + if [ -z ${1+x} ]; then + echo "Usage: $0 " + return 1 + fi + tenks_path="$1" + + config_init + tenks_teardown "$tenks_path" compute +} + +main "$@" diff --git a/dev/tenks-teardown-overcloud.sh b/dev/tenks-teardown-overcloud.sh new file mode 100755 index 000000000..b17e3ab9d --- /dev/null +++ b/dev/tenks-teardown-overcloud.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +set -eu +set -o pipefail + +# Simple script to teardown a Tenks cluster. This should be executed from +# within the VM. Arguments: +# $1: The path to the Tenks repo. + +PARENT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" + +source "${PARENT}/functions" + + +function main { + if [ -z ${1+x} ]; then + echo "Usage: $0 " + return 1 + fi + tenks_path="$1" + + config_init + tenks_teardown "$tenks_path" overcloud +} + +main "$@" diff --git a/doc/source/development/automated.rst b/doc/source/development/automated.rst index 23c2b0f3e..240d8c4b0 100644 --- a/doc/source/development/automated.rst +++ b/doc/source/development/automated.rst @@ -131,9 +131,9 @@ Clone the tenks repository:: Optionally, edit the Tenks configuration file, ``dev/tenks-deploy-config-compute.yml``. -Run the ``dev/tenks-deploy.sh`` script to deploy Tenks:: +Run the ``dev/tenks-deploy-compute.sh`` script to deploy Tenks:: - ./dev/tenks-deploy.sh ./tenks + ./dev/tenks-deploy-compute.sh ./tenks Check that Tenks has created VMs called ``tk0`` and ``tk1``:: @@ -151,9 +151,9 @@ server instance, and delete it once it becomes active:: ./dev/overcloud-test-baremetal.sh The machines and networking created by Tenks can be cleaned up via -``dev/tenks-teardown.sh``:: +``dev/tenks-teardown-compute.sh``:: - ./dev/tenks-teardown.sh ./tenks + ./dev/tenks-teardown-compute.sh ./tenks Upgrading --------- @@ -233,9 +233,9 @@ Clone the tenks repository:: Optionally, edit the Tenks configuration file, ``dev/tenks-deploy-config-overcloud.yml``. -Run the ``dev/tenks-deploy.sh`` script to deploy Tenks:: +Run the ``dev/tenks-deploy-overcloud.sh`` script to deploy Tenks:: - ./dev/tenks-deploy.sh ./tenks + ./dev/tenks-deploy-overcloud.sh ./tenks Check that Tenks has created a VM called ``controller0``:: @@ -246,9 +246,9 @@ Verify that VirtualBMC is running:: ~/tenks-venv/bin/vbmc list The machines and networking created by Tenks can be cleaned up via -``dev/tenks-teardown.sh``:: +``dev/tenks-teardown-overcloud.sh``:: - ./dev/tenks-teardown.sh ./tenks + ./dev/tenks-teardown-overcloud.sh ./tenks .. _development-automated-seed-hypervisor: diff --git a/playbooks/kayobe-overcloud-base/run.yml b/playbooks/kayobe-overcloud-base/run.yml index 483195fee..95d38f172 100644 --- a/playbooks/kayobe-overcloud-base/run.yml +++ b/playbooks/kayobe-overcloud-base/run.yml @@ -11,7 +11,7 @@ shell: # Pass absolute source directory, since otherwise the `chdir` will # cause this to fail. - cmd: dev/tenks-deploy.sh '{{ tenks_src_dir }}' > {{ logs_dir }}/ansible/tenks-deploy + cmd: dev/tenks-deploy-compute.sh '{{ tenks_src_dir }}' > {{ logs_dir }}/ansible/tenks-deploy chdir: "{{ kayobe_src_dir }}" - name: Perform testing of the virtualized machines diff --git a/playbooks/kayobe-overcloud-upgrade-base/run.yml b/playbooks/kayobe-overcloud-upgrade-base/run.yml index db03447b5..2c651fbda 100644 --- a/playbooks/kayobe-overcloud-upgrade-base/run.yml +++ b/playbooks/kayobe-overcloud-upgrade-base/run.yml @@ -27,9 +27,9 @@ - name: Ensure test Tenks cluster is deployed shell: # Pass absolute source directory, since otherwise the `chdir` will - # cause this to fail. Don't use previous_kayobe_source_dir as tenks-deploy.sh - # does not exist there. - cmd: dev/tenks-deploy.sh '{{ tenks_src_dir }}' > {{ logs_dir }}/ansible/tenks-deploy + # cause this to fail. Don't use previous_kayobe_source_dir as + # tenks-deploy-compute.sh does not exist there. + cmd: dev/tenks-deploy-compute.sh '{{ tenks_src_dir }}' > {{ logs_dir }}/ansible/tenks-deploy chdir: "{{ kayobe_src_dir }}" environment: