From 5b2648aec3c44c6249d12305a0e99502088c5b4e Mon Sep 17 00:00:00 2001 From: David Moreau-Simard Date: Fri, 8 Apr 2016 16:32:46 -0400 Subject: [PATCH] Fix gate: Tempest setup and repositories MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - We no longer need to setup Tempest in a virtual environment since that is now handled by tox - Do not explicitely require python-openstackclient since that is now handled by puppet-tempest since https://review.openstack.org/301162 - Setup packstack to consume Mitaka repositories and OPM until Newton is actively tested - Make swap configuration consistent - Add an empty other-requirements.txt file to prevent the openstack gate environment to pre-install dependencies for us; these are installed within run_tests.sh - Enforce locale, seems necessary since the switch to the new centos7 images in the openstack-infra gate Co-Authored-By: David Moreau Simard Co-Authored-By: Javier Peña Change-Id: I80813ee9404a3cbc837d0d9810855fb13c0d904b --- other-requirements.txt | 0 .../puppet/templates/provision_tempest.pp | 7 -- run_tests.sh | 13 ++- setup.py | 2 +- tools/fix_disk_layout.sh | 97 +++++++++++++++++++ 5 files changed, 109 insertions(+), 10 deletions(-) create mode 100644 other-requirements.txt create mode 100644 tools/fix_disk_layout.sh diff --git a/other-requirements.txt b/other-requirements.txt new file mode 100644 index 000000000..e69de29bb diff --git a/packstack/puppet/templates/provision_tempest.pp b/packstack/puppet/templates/provision_tempest.pp index e5863dc2a..65cb9da18 100644 --- a/packstack/puppet/templates/provision_tempest.pp +++ b/packstack/puppet/templates/provision_tempest.pp @@ -51,7 +51,6 @@ $tempest_repo_uri = hiera('CONFIG_PROVISION_TEMPEST_REPO_URI') $tempest_repo_revision = hiera('CONFIG_PROVISION_TEMPEST_REPO_REVISION') $tempest_clone_path = '/var/lib/tempest' $tempest_clone_owner = 'root' -$setup_venv = true $tempest_user = hiera('CONFIG_PROVISION_TEMPEST_USER') $tempest_password = hiera('CONFIG_PROVISION_TEMPEST_USER_PW') @@ -69,11 +68,6 @@ $heat_available = str2bool(hiera('CONFIG_HEAT_INSTALL')) $swift_available = str2bool(hiera('CONFIG_SWIFT_INSTALL')) $configure_tempest = str2bool(hiera('CONFIG_PROVISION_TEMPEST')) -# on standalone install we depend on this package -package {'python-openstackclient': - before => Class['::tempest'], -} - class { '::tempest': admin_domain_name => $admin_domain_name, admin_password => $admin_password, @@ -105,7 +99,6 @@ class { '::tempest': public_router_id => $public_router_id, resize_available => $resize_available, sahara_available => $sahara_available, - setup_venv => $setup_venv, swift_available => $swift_available, tempest_clone_owner => $tempest_clone_owner, tempest_clone_path => $tempest_clone_path, diff --git a/run_tests.sh b/run_tests.sh index b33ba3ce8..05a8b3fba 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -20,8 +20,8 @@ SCENARIO=${SCENARIO:-scenario001} # We could want to override the default repositories or install behavior INSTALL_FROM_SOURCE=${INSTALL_FROM_SOURCE:-true} MANAGE_REPOS=${MANAGE_REPOS:-true} -DELOREAN=${DELOREAN:-http://trunk.rdoproject.org/centos7/current-passed-ci/delorean.repo} -DELOREAN_DEPS=${DELOREAN_DEPS:-http://trunk.rdoproject.org/centos7/delorean-deps.repo} +DELOREAN=${DELOREAN:-http://trunk.rdoproject.org/centos7-mitaka/current-passed-ci/delorean.repo} +DELOREAN_DEPS=${DELOREAN_DEPS:-http://trunk.rdoproject.org/centos7-mitaka/delorean-deps.repo} # If logs should be retrieved automatically COPY_LOGS=${COPY_LOGS:-true} @@ -39,6 +39,15 @@ if [ $(id -u) != 0 ]; then $SUDO service sshd restart fi +# TODO: REMOVE ME +# https://github.com/openstack/diskimage-builder/blob/b5bcb3b60ec33c4538baa1aeacd026998b155ca6/elements/yum-minimal/pre-install.d/03-yum-cleanup#L26 +$SUDO yum -y reinstall glibc-common + +# Make swap configuration consistent +# TODO: REMOVE ME +# https://review.openstack.org/#/c/300122/ +source ./tools/fix_disk_layout.sh + # Bump ulimit to avoid too many open file errors echo "${USER} soft nofile 65536" | $SUDO tee -a /etc/security/limits.conf echo "${USER} hard nofile 65536" | $SUDO tee -a /etc/security/limits.conf diff --git a/setup.py b/setup.py index 6d209d123..d8c39c11c 100644 --- a/setup.py +++ b/setup.py @@ -28,7 +28,7 @@ MODULES_DIR = os.environ.get('PACKSTACK_PUPPETDIR', '/usr/share/openstack-puppet/modules') MODULES_REPO = ('https://github.com/redhat-openstack/' 'openstack-puppet-modules.git') -MODULES_BRANCH = 'master' +MODULES_BRANCH = 'stable/mitaka' class InstallModulesCommand(Command): diff --git a/tools/fix_disk_layout.sh b/tools/fix_disk_layout.sh new file mode 100644 index 000000000..44f5a35df --- /dev/null +++ b/tools/fix_disk_layout.sh @@ -0,0 +1,97 @@ +#!/bin/bash +# Copyright (C) 2016 OpenStack Foundation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# +# See the License for the specific language governing permissions and +# limitations under the License. + +# Don't attempt to fix disk layout more than once +[[ -e /etc/fixed_disk_layout ]] && return 0 || sudo touch /etc/fixed_disk_layout + +# Ensure virtual machines from different providers all have at least 8GB of +# swap. +# Use an ephemeral disk if there is one or create and use a swapfile. +# Rackspace also doesn't have enough space on / for two devstack installs, +# so we partition the disk and mount it on /opt, syncing the previous +# contents of /opt over. +SWAPSIZE=8192 +swapcurrent=$(( $(grep SwapTotal /proc/meminfo | awk '{ print $2; }') / 1024 )) + +if [[ $swapcurrent -lt $SWAPSIZE ]]; then + if [ -b /dev/xvde ]; then + DEV='/dev/xvde' + else + EPHEMERAL_DEV=$(blkid -L ephemeral0 || true) + if [ -n "$EPHEMERAL_DEV" -a -b "$EPHEMERAL_DEV" ]; then + DEV=$EPHEMERAL_DEV + fi + fi + if [ -n "$DEV" ]; then + # If an ephemeral device is available, use it + swap=${DEV}1 + lvmvol=${DEV}2 + optdev=${DEV}3 + if mount | grep ${DEV} > /dev/null; then + echo "*** ${DEV} appears to already be mounted" + echo "*** ${DEV} unmounting and reformating" + sudo umount ${DEV} + fi + sudo parted ${DEV} --script -- mklabel msdos + sudo parted ${DEV} --script -- mkpart primary linux-swap 1 ${SWAPSIZE} + sudo parted ${DEV} --script -- mkpart primary ext2 8192 -1 + sudo mkswap ${DEV}1 + sudo mkfs.ext4 ${DEV}2 + sudo swapon ${DEV}1 + sudo mount ${DEV}2 /mnt + sudo find /opt/ -mindepth 1 -maxdepth 1 -exec mv {} /mnt/ \; + sudo umount /mnt + sudo mount ${DEV}2 /opt + + # Sanity check + grep -q ${DEV}1 /proc/swaps || exit 1 + grep -q ${DEV}2 /proc/mounts || exit 1 + else + # If no ephemeral devices are available, use root filesystem + # Don't use sparse device to avoid wedging when disk space and + # memory are both unavailable. + swapfile='/root/swapfile' + swapdiff=$(( $SWAPSIZE - $swapcurrent )) + + sudo dd if=/dev/zero of=${swapfile} bs=1M count=${swapdiff} + sudo chmod 600 ${swapfile} + sudo mkswap ${swapfile} + sudo swapon ${swapfile} + + # Sanity check + grep -q ${swapfile} /proc/swaps || exit 1 + fi +fi + +# dump vm settings for reference (Ubuntu 12 era procps can get +# confused with certain proc trigger nodes that are write-only and +# return a EPERM; ignore this) +sudo sysctl vm || true + +# ensure a standard level of swappiness. Some platforms +# (rax+centos7) come with swappiness of 0 (presumably because the +# vm doesn't come with swap setup ... but we just did that above), +# which depending on the kernel version can lead to the OOM killer +# kicking in on some processes despite swap being available; +# particularly things like mysql which have very high ratio of +# anonymous-memory to file-backed mappings. + +# make sure reload of sysctl doesn't reset this +sudo sed -i '/vm.swappiness/d' /etc/sysctl.conf +# This sets swappiness low; we really don't want to be relying on +# cloud I/O based swap during our runs +sudo sysctl -w vm.swappiness=10