standalone support for quickstart on libvirt

This patch adds the settings required to run the standalone tripleo
deployment on libvirt nodes in ci.centos.

This enables both centos7 and fedora28 based nodes.

For backwards compatibility reasons "standalone" points to centos7 and
standalone3 points to fedora28 (which will probably be replaced by
centos 8 once available).

Related-Bug: #1788270
Story: https://tree.taiga.io/project/tripleo-ci-board/task/149
Change-Id: I245f9341de8f4b9d2ac974d4757e811d17028886
Co-Authored-By: Alex Schultz <aschultz@redhat.com>
Co-Authored-By: Sorin Sbarnea <ssbarnea@redhat.com>
Depends-On: https://review.openstack.org/#/c/610491/
This commit is contained in:
Wes Hayutin 2018-08-13 21:27:41 -04:00 committed by Sorin Sbarnea
parent 5861bd8ff7
commit 3dd6587e57
8 changed files with 175 additions and 70 deletions

View File

@ -6,12 +6,14 @@
set -eux
: ${OPT_ADDITIONAL_PARAMETERS:=""}
: ${WORKSPACE:=$HOME/.quickstart}
: ${VIRTHOST:=127.0.0.1}
RELEASE=$1
RELEASE=${1:-master-tripleo-ci}
# unused variable in script, kept for consistency
BUILD_SYS=$2
CONFIG=$3
JOB_TYPE=$4
BUILD_SYS=${2:-delorean}
CONFIG=${3:-minimal}
JOB_TYPE=${4:-standalone}
if [ "$JOB_TYPE" = "gate" ] || \
[ "$JOB_TYPE" = "periodic" ] || \
@ -32,7 +34,7 @@ elif [ "$JOB_TYPE" = "dlrn-gate-check" ]; then
fi
elif [ "$JOB_TYPE" = "promote" ]; then
REL_TYPE=$LOCATION
elif [ "$JOB_TYPE" = "standalone" ]; then
elif [ "$JOB_TYPE" = "standalone" ] || [ "$JOB_TYPE" = "standalone3" ]; then
echo "using standalone, single node deployment"
else
echo "Job type must be one of the following:"
@ -42,6 +44,7 @@ else
echo " * dlrn-gate - for gating upstream changes"
echo " * dlrn-gate-check - for gating upstream changes"
echo " * standalone - for standalone deployments"
echo " * standalone3 - for standalone deployments"
exit 1
fi
@ -56,66 +59,98 @@ CI_SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source $CI_SCRIPT_DIR/include-gate-changes.sh
# we need to run differently (and twice) when gating upstream changes
if [ "$JOB_TYPE" = "dlrn-gate" ] || [ "$JOB_TYPE" = "dlrn-gate-check" ]; then
# provison the virthost and build the gated DLRN packages
bash quickstart.sh \
--working-dir $WORKSPACE/ \
--no-clone \
--bootstrap \
--extra-vars artg_compressed_gating_repo="/home/stack/gating_repo.tar.gz" \
--playbook build-test-packages.yml \
--tags all \
--teardown all \
--release ${CI_ENV:+$CI_ENV/}$RELEASE${REL_TYPE:+-$REL_TYPE} \
$OPT_ADDITIONAL_PARAMETERS \
$VIRTHOST
# skip provisioning and run the gate using the previously built RPMs
bash quickstart.sh \
--working-dir $WORKSPACE/ \
--no-clone \
--retain-inventory \
--extra-vars compressed_gating_repo="/home/stack/gating_repo.tar.gz" \
--config $WORKSPACE/config/general_config/$CONFIG.yml \
--skip-tags provision \
--tags all \
--teardown none \
--release ${CI_ENV:+$CI_ENV/}$RELEASE${REL_TYPE:+-$REL_TYPE} \
$OPT_ADDITIONAL_PARAMETERS \
$VIRTHOST
elif [ "$JOB_TYPE" = "standalone" ]; then
bash quickstart.sh \
--working-dir $WORKSPACE/ \
--no-clone \
--bootstrap \
--extra-vars artg_compressed_gating_repo="/home/stack/gating_repo.tar.gz" \
--playbook build-test-packages.yml \
--tags all \
--teardown all \
--release ${CI_ENV:+$CI_ENV/}$RELEASE${REL_TYPE:+-$REL_TYPE} \
$OPT_ADDITIONAL_PARAMETERS \
$VIRTHOST
case "$JOB_TYPE" in
dlrn-gate*)
# provison the virthost and build the gated DLRN packages
bash quickstart.sh \
--working-dir $WORKSPACE/ \
--no-clone \
--bootstrap \
--extra-vars artg_compressed_gating_repo="/home/stack/gating_repo.tar.gz" \
--playbook build-test-packages.yml \
--tags all \
--teardown all \
--release ${CI_ENV:+$CI_ENV/}$RELEASE${REL_TYPE:+-$REL_TYPE} \
$OPT_ADDITIONAL_PARAMETERS \
$VIRTHOST
# skip provisioning and run the gate using the previously built RPMs
bash quickstart.sh \
--working-dir $WORKSPACE/ \
--no-clone \
--retain-inventory \
--extra-vars compressed_gating_repo="/home/stack/gating_repo.tar.gz" \
--config $WORKSPACE/config/general_config/$CONFIG.yml \
--skip-tags provision \
--tags all \
--teardown none \
--release ${CI_ENV:+$CI_ENV/}$RELEASE${REL_TYPE:+-$REL_TYPE} \
$OPT_ADDITIONAL_PARAMETERS \
$VIRTHOST
;;
standalone)
bash quickstart.sh \
--working-dir $WORKSPACE/ \
--no-clone \
--bootstrap \
--extra-vars artg_compressed_gating_repo="/home/stack/gating_repo.tar.gz" \
--playbook build-test-packages.yml \
--tags all \
--teardown all \
--release ${CI_ENV:+$CI_ENV/}$RELEASE${REL_TYPE:+-$REL_TYPE} \
$OPT_ADDITIONAL_PARAMETERS \
$VIRTHOST
bash quickstart.sh \
--working-dir $WORKSPACE/ \
--no-clone \
--retain-inventory \
--extra-vars compressed_gating_repo="/home/stack/gating_repo.tar.gz" \
--config $WORKSPACE/config/general_config/$CONFIG.yml \
--skip-tags provision \
--tags all \
--teardown none \
--playbook quickstart-extras-standalone.yml \
--release ${CI_ENV:+$CI_ENV/}$RELEASE${REL_TYPE:+-$REL_TYPE} \
$OPT_ADDITIONAL_PARAMETERS \
$VIRTHOST
else
bash quickstart.sh \
--bootstrap \
--tags all \
--config $WORKSPACE/config/general_config/$CONFIG.yml \
--working-dir $WORKSPACE/ \
--no-clone \
--release ${CI_ENV:+$CI_ENV/}$RELEASE${REL_TYPE:+-$REL_TYPE} \
$OPT_ADDITIONAL_PARAMETERS \
$VIRTHOST
fi
bash quickstart.sh \
--working-dir $WORKSPACE/ \
--no-clone \
--retain-inventory \
--extra-vars compressed_gating_repo="/home/stack/gating_repo.tar.gz" \
--config $WORKSPACE/config/general_config/$CONFIG.yml \
--environment $WORKSPACE/config/environments/standalone_centos_libvirt.yml \
--skip-tags provision \
--tags all \
--teardown none \
--playbook quickstart-extras-standalone.yml \
--release ${CI_ENV:+$CI_ENV/}$RELEASE${REL_TYPE:+-$REL_TYPE} \
$OPT_ADDITIONAL_PARAMETERS \
$VIRTHOST
;;
standalone3)
bash quickstart.sh \
--working-dir $WORKSPACE/ \
--no-clone \
--bootstrap \
--extra-vars artg_compressed_gating_repo="/home/stack/gating_repo.tar.gz" \
--playbook build-test-packages.yml \
--tags all \
--teardown all \
--release ${CI_ENV:+$CI_ENV/}$RELEASE${REL_TYPE:+-$REL_TYPE} \
$OPT_ADDITIONAL_PARAMETERS \
$VIRTHOST
bash quickstart.sh \
--working-dir $WORKSPACE/ \
--no-clone \
--retain-inventory \
--extra-vars compressed_gating_repo="/home/stack/gating_repo.tar.gz" \
--config $WORKSPACE/config/general_config/$CONFIG.yml \
--environment $WORKSPACE/config/environments/standalone_fedora_libvirt.yml \
--skip-tags provision \
--tags all \
--teardown none \
--playbook quickstart-extras-standalone.yml \
--release tripleo-ci/master_fedora28 \
$OPT_ADDITIONAL_PARAMETERS \
$VIRTHOST
;;
*)
bash quickstart.sh \
--bootstrap \
--tags all \
--config $WORKSPACE/config/general_config/$CONFIG.yml \
--working-dir $WORKSPACE/ \
--no-clone \
--release ${CI_ENV:+$CI_ENV/}$RELEASE${REL_TYPE:+-$REL_TYPE} \
$OPT_ADDITIONAL_PARAMETERS \
$VIRTHOST
esac

View File

@ -0,0 +1,29 @@
# This environment can be used to use a base CentOS qcow2 image for the undercloud
# instead of the default pre-built undercloud qcow2
# baseos undercloud settings
undercloud_image_url: https://cloud.centos.org/centos/7/images/CentOS-7-x86_64-GenericCloud-1805.qcow2
# this must be named undercloud
images:
- name: undercloud
url: "{{ undercloud_image_url }}"
type: qcow2
md5sum: "3bb5a5fd550980aa4bf3c80071f8cbb0 CentOS-7-x86_64-GenericCloud-1805.qcow2"
inject_images: []
guest_partition: /dev/sda1
baseos_as_undercloud: true
overcloud_as_undercloud: false
undercloud_setup: true
use_external_images: true
ovb_setup_connectivity: false
non_root_user_setup: true
package_installs: true
hostname_correction: true
# standalone interface
standalone_interface: eth1
standalone_ip: 192.168.24.2

View File

@ -0,0 +1,27 @@
# This environment can be used to use an upstream OpenStack Fedora qcow2 image for the undercloud
# instead of the default pre-built undercloud qcow2
undercloud_image_url: https://images.rdoproject.org/fedora-stable/Fedora-Cloud-Base-RDO-28-latest.qcow2
# https://download.fedoraproject.org/pub/fedora/linux/releases/28/Cloud/x86_64/images/Fedora-Cloud-Base-28-1.1.x86_64.qcow2
# the name should always be undercloud
images:
- name: undercloud
url: "{{ undercloud_image_url }}"
type: qcow2
inject_images: []
guest_partition: /dev/sda1
baseos_as_undercloud: true
overcloud_as_undercloud: false
undercloud_setup: true
use_external_images: true
ovb_setup_connectivity: false
non_root_user_setup: true
package_installs: true
hostname_correction: true
# standalone interface
standalone_interface: ens4
standalone_ip: 192.168.24.2

View File

@ -6,6 +6,10 @@ non_root_user_setup: true
ovb_setup_connectivity: false
package_installs: true
vxlan_networking: false
toci_vxlan_networking: false
enable_vbmc: false
deploy_supplemental_node: false
undercloud_setup: true
# role / scenario definition
# deployment role

View File

@ -17,3 +17,4 @@ convert_image_install_pkgs:
convert_image_tempest_plugins: []
convert_image_host_memory: 2048
guest_partition: /dev/sda

View File

@ -7,7 +7,7 @@ FS_TYPE=`findmnt -o FSTYPE -fn /`
if [ "$FS_TYPE" = "xfs" ]; then
xfs_growfs /
elif [ "$FS_TYPE" = "ext4" ]; then
resize2fs /dev/sda
resize2fs {{ guest_partition }} || true
else
echo "ERROR: Unknown filesystem, cannot resize."
exit 1

View File

@ -57,6 +57,7 @@
environment:
LIBGUESTFS_BACKEND: direct
LIBVIRT_DEFAULT_URI: "{{ libvirt_uri }}"
when: resize_qcow_filesystem|default(true)|bool
- name: Disable cloud-init
command: >
@ -79,10 +80,11 @@
LIBGUESTFS_BACKEND: direct
LIBVIRT_DEFAULT_URI: "{{ libvirt_uri }}"
# note upstream images may be in use and have the zuul user created
- name: Add zuul user to the image
command: >
virt-customize -a {{ working_dir }}/undercloud.qcow2
--run-command 'useradd zuul'
--run-command 'id -u zuul &>/dev/null || useradd zuul'
--mkdir /home/zuul/.ssh
--run-command 'cp /root/.ssh/authorized_keys /home/zuul/.ssh/'
--run-command 'chown -R zuul:zuul /home/zuul/.ssh'
@ -91,6 +93,9 @@
--run-command 'echo "zuul ALL=(root) NOPASSWD:ALL" > /etc/sudoers.d/zuul'
--run-command 'chmod 0440 /etc/sudoers.d/zuul'
--selinux-relabel
# we should NOT create symlinks between python->python3
# see https://www.python.org/dev/peps/pep-0394/
# --run-command 'ln -s /usr/bin/python3 /usr/bin/python'
environment:
LIBGUESTFS_BACKEND: direct
LIBVIRT_DEFAULT_URI: "{{ libvirt_uri }}"
@ -158,6 +163,7 @@
ansible_private_key_file: "~/.ssh/id_rsa"
subnode_private_ip: "{{ subnode_0_ip }}"
subnode_public_ip: "{{ subnode_0_ip }}"
ansible_python_interpreter: "{{ python_interpreter|default('/usr/bin/python') }}"
- name: Set hostname correctly for subnode-0
delegate_to: subnode-0
@ -199,6 +205,7 @@
ansible_private_key_file: "~/.ssh/id_rsa"
subnode_private_ip: "{{ subnode_1_ip }}"
subnode_public_ip: "{{ subnode_1_ip }}"
ansible_python_interpreter: "{{ python_interpreter|default('/usr/bin/python') }}"
- name: Set hostname correctly for subnode-1
delegate_to: subnode-1

View File

@ -71,7 +71,9 @@
--run-command 'chown {{ undercloud_user }}:{{ undercloud_user }} /home/{{ undercloud_user }}/{{ item }}'
changed_when: true
with_items: "{{ inject_images | default('') }}"
when: overcloud_as_undercloud|bool or use_external_images|bool
when:
- overcloud_as_undercloud|bool or use_external_images|bool
- inject_images|length > 0
# This copies the `instackenv.json` configuration file that we
# generated in the overcloud setup role to the undercloud host.