diff --git a/README.md b/README.md index 4ba3df3a..19dd812b 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,8 @@ As part of ```stack.sh```: * Installs Ceph (client and server) packages * Creates a Ceph cluster for use with openstack services -* Configures Ceph as the storage backend for Cinder, Cinder Backup, Nova & Glance services +* Configures Ceph as the storage backend for Cinder, Cinder Backup, Nova, + Manila (not by default), and Glance services * Supports Ceph cluster running local or remote to openstack services As part of ```unstack.sh``` | ```clean.sh```: @@ -25,15 +26,26 @@ This plugin also gets used to configure Ceph as the storage backend for the upst ```enable_plugin devstack-plugin-ceph git://git.openstack.org/openstack/devstack-plugin-ceph``` - _Note: Ceph can be disabled as the storage backend for a service with the - following setting in the ```localrc``` file,_ +* Ceph is setup as the default storage backend for Cinder, Cinder Backup, + Glance and Nova services. To disable Ceph disable as the storage backend + for a service use the following setting in the ```localrc``` file, ``` ENABLE_CEPH_$SERVICE=False ``` - _where $SERVICE can be CINDER, C_BAK, GLANCE, or NOVA corresponding to - Cinder, Cinder Backup, Glance, and Nova services respectively._ + where $SERVICE can be CINDER, C_BAK, GLANCE or NOVA corresponding to + Cinder, Cinder Backup, Glance, and Nova services respectively. + +* Ceph can be enabled as the storage backend for Manila with the following + setting in the ```localrc``` file, + + ``` + ENABLE_CEPH_MANILA=True + ``` + + Make sure that the manila plugin is enabled before devstack-plugin-ceph in + the ```localrc``` file. * Then run ```stack.sh``` and wait for the _magic_ to happen :) @@ -43,6 +55,7 @@ This plugin also gets used to configure Ceph as the storage backend for the upst * Configuring Rados Gateway with Keystone for Swift * Add support for Ceph Infernalis release * Add support for distro specific ceph repos +* Add Manila support for non-Ubuntu systems # Bugs diff --git a/devstack/lib/ceph b/devstack/lib/ceph index 4f474150..f6f921a3 100644 --- a/devstack/lib/ceph +++ b/devstack/lib/ceph @@ -67,6 +67,14 @@ CINDER_CEPH_POOL_PGP=${CINDER_CEPH_POOL_PGP:-8} CINDER_CEPH_USER=${CINDER_CEPH_USER:-cinder} CINDER_CEPH_UUID=${CINDER_CEPH_UUID:-$(uuidgen)} +# Manila +CEPHFS_POOL_PG=${CEPHFS_POOL_PG:-8} +CEPHFS_METADATA_POOL=${CEPHFS_CEPH_POOL:-cephfs_metadata} +CEPHFS_DATA_POOL=${CEPHFS_CEPH_POOL:-cephfs_data} +MANILA_CEPH_DRIVER=${MANILA_CEPH_DRIVER:-cephfsnative} +MANILA_CEPH_USER=${MANILA_CEPH_USER:-manila} +MDS_ID=${MDS_ID:-a} + # Set ``CEPH_REPLICAS`` to configure how many replicas are to be # configured for your Ceph cluster. By default we are configuring # only one replica since this is way less CPU and memory intensive. If @@ -108,12 +116,24 @@ function is_ceph_enabled_for_service { return $enabled } +# get_ceph_version() - checks version of Ceph mon daemon or CLI based on an +# argument. Checking mon daemon version requires the mon daemon to be up +# and healthy. function get_ceph_version { -local ceph_version_str -ceph_version_str=$(sudo ceph daemon mon.$(hostname) version\ -| cut -d '"' -f 4 | cut -f 1,2 -d '.') + local ceph_version_str -echo $ceph_version_str + if [[ $1 == 'cli' ]]; then + ceph_version_str=$(sudo ceph --version | cut -d ' ' -f 3 | \ + cut -d '.' -f 1,2) + elif [[ $1 == 'mon' ]]; then + ceph_version_str=$(sudo ceph daemon mon.$(hostname) version | \ + cut -d '"' -f 4 | cut -f 1,2 -d '.') + else + die $LINENO "Invalid argument. The get_ceph_version function needs \ + an argument that can be 'cli' or 'mon'." + fi + + echo $ceph_version_str } # import_libvirt_secret_ceph() - Imports Cinder user key into libvirt @@ -187,6 +207,13 @@ if is_ceph_enabled_for_service nova; then sudo ceph osd pool delete $NOVA_CEPH_POOL $NOVA_CEPH_POOL \ --yes-i-really-really-mean-it > /dev/null 2>&1 fi +if is_ceph_enabled_for_service manila; then + sudo ceph osd pool delete $CEPHFS_METADATA_POOL $CEPHFS_METADATA_POOL \ + --yes-i-really-really-mean-it > /dev/null 2>&1 + sudo ceph osd pool delete $CEPHFS_DATA_POOL $CEPHFS_DATA_POOL \ + --yes-i-really-really-mean-it > /dev/null 2>&1 + sudo ceph auth del client.$MANILA_CEPH_USER > /dev/null 2>&1 +fi } function cleanup_ceph_embedded { @@ -245,6 +272,13 @@ sudo ceph-mon -c ${CEPH_CONF_FILE} --mkfs -i $(hostname) \ if is_ubuntu; then sudo touch /var/lib/ceph/mon/ceph-$(hostname)/upstart + # Do a Ceph version check. If version >= Infernalis, then make sure that + # the user "ceph" is the owner of files within the ${CEPH_DATA_DIR}. + # Check CLI version instead of mon daemon version as the mon daemon + # is not yet up. + if [[ $(echo $(get_ceph_version cli) '>=' 9.2 | bc -l) == 1 ]]; then + sudo chown -R ceph. ${CEPH_DATA_DIR} + fi sudo initctl emit ceph-mon id=$(hostname) else sudo touch /var/lib/ceph/mon/ceph-$(hostname)/sysvinit @@ -266,7 +300,7 @@ done # pools data and metadata were removed in the Giant release # so depending on the version we apply different commands local ceph_version -ceph_version=$(get_ceph_version) +ceph_version=$(get_ceph_version mon) # change pool replica size according to the CEPH_REPLICAS set by the user if [[ ${ceph_version%%.*} -eq 0 ]] && [[ ${ceph_version##*.} -lt 87 ]]; then sudo ceph -c ${CEPH_CONF_FILE} osd pool set rbd size ${CEPH_REPLICAS} @@ -314,6 +348,19 @@ for rep in ${CEPH_REPLICAS_SEQ}; do fi done +if is_ceph_enabled_for_service manila; then + # create a MDS + sudo mkdir -p ${CEPH_DATA_DIR}/mds/ceph-${MDS_ID} + sudo ceph -c ${CEPH_CONF_FILE} auth get-or-create mds.${MDS_ID} \ + mon 'allow profile mds ' osd 'allow rw' mds 'allow' \ + -o ${CEPH_DATA_DIR}/mds/ceph-${MDS_ID}/keyring + if is_ubuntu; then + sudo touch ${CEPH_DATA_DIR}/mds/ceph-${MDS_ID}/upstart + else + sudo touch ${CEPH_DATA_DIR}/mds/ceph-${MDS_ID}/sysvinit + fi +fi + # bootstrap rados gateway sudo mkdir ${CEPH_DATA_DIR}/radosgw/ceph-radosgw.$(hostname) sudo ceph auth get-or-create client.radosgw.$(hostname) \ @@ -329,6 +376,12 @@ else sudo touch \ ${CEPH_DATA_DIR}/radosgw/ceph-radosgw.$(hostname)/{sysvinit,done} fi + +# Do a Ceph version check. If version >= Infernalis, then make sure that user +# "ceph" is the owner of files within ${CEPH_DATA_DIR}. +if [[ $(echo $(get_ceph_version mon) '>=' 9.2 | bc -l) == 1 ]]; then + sudo chown -R ceph. ${CEPH_DATA_DIR} +fi } function configure_ceph_embedded_rgw { @@ -425,6 +478,37 @@ iniset $GLANCE_API_CONF glance_store rbd_store_user $GLANCE_CEPH_USER iniset $GLANCE_API_CONF glance_store rbd_store_pool $GLANCE_CEPH_POOL } +function configure_ceph_manila { + sudo ceph -c ${CEPH_CONF_FILE} osd pool create ${CEPHFS_METADATA_POOL} \ + ${CEPHFS_POOL_PG} + sudo ceph -c ${CEPH_CONF_FILE} osd pool create ${CEPHFS_DATA_POOL} \ + ${CEPHFS_POOL_PG} + sudo ceph -c ${CEPH_CONF_FILE} fs new cephfs ${CEPHFS_METADATA_POOL} \ + ${CEPHFS_DATA_POOL} + sudo ceph -c ${CEPH_CONF_FILE} auth get-or-create \ + client.${MANILA_CEPH_USER} \ + mon "allow *" osd "allow rw" mds "allow *" \ + -o ${CEPH_CONF_DIR}/ceph.client.${MANILA_CEPH_USER}.keyring + sudo chown ${STACK_USER}:$(id -g -n $whoami) \ + ${CEPH_CONF_DIR}/ceph.client.${MANILA_CEPH_USER}.keyring + # Enable snapshots in CephFS. + sudo ceph -c ${CEPH_CONF_FILE} mds set allow_new_snaps true \ + --yes-i-really-mean-it +} + +function configure_ceph_embedded_manila { + sudo ceph -c ${CEPH_CONF_FILE} osd pool set ${CEPHFS_DATA_POOL} size \ + ${CEPH_REPLICAS} + sudo ceph -c ${CEPH_CONF_FILE} osd pool set ${CEPHFS_METADATA_POOL} size \ + ${CEPH_REPLICAS} + if [[ $CEPH_REPLICAS -ne 1 ]]; then + sudo ceph -c ${CEPH_CONF_FILE} osd pool set ${CEPHFS_DATA_POOL} \ + crush_ruleset ${RULE_ID} + sudo ceph -c ${CEPH_CONF_FILE} osd pool set ${CEPHFS_METADATA_POOL} \ + crush_ruleset ${RULE_ID} + fi +} + function configure_ceph_embedded_nova { # configure Nova service options, ceph pool, ceph user and ceph key sudo ceph -c ${CEPH_CONF_FILE} osd pool \ @@ -500,6 +584,9 @@ function init_ceph { sudo pkill -f ceph-mon || true sudo pkill -f ceph-osd || true sudo pkill -f radosgw || true +if is_ceph_enabled_for_service manila; then + sudo pkill -f ceph-mds || true +fi } # install_ceph() - Collect source and prepare @@ -509,12 +596,26 @@ install_package ceph-common function install_ceph { if is_ubuntu; then - wget -q -O- 'https://download.ceph.com/keys/release.asc' \ - | sudo apt-key add - + # TODO (rraja): use wip-manila development repo until Ceph patches needed + # by Manila's Ceph driver are available in a release package. + if is_ceph_enabled_for_service manila; then + wget -q -O- 'https://download.ceph.com/keys/autobuild.asc' \ + | sudo apt-key add - - echo deb http://ceph.com/debian-${CEPH_RELEASE} $(lsb_release -sc) main \ - | sudo tee /etc/apt/sources.list.d/ceph.list + echo deb \ + http://gitbuilder.ceph.com/ceph-deb-$(lsb_release -sc)-x86_64-basic/ref/wip-manila \ + $(lsb_release -sc) main | sudo tee /etc/apt/sources.list.d/ceph.list + else + wget -q -O- 'https://download.ceph.com/keys/release.asc' \ + | sudo apt-key add - + echo deb http://ceph.com/debian-${CEPH_RELEASE} $(lsb_release -sc) \ + main | sudo tee /etc/apt/sources.list.d/ceph.list + + fi + + # Update package repo. + REPOS_UPDATED=False install_package ceph radosgw libnss3-tools else # Install directly from distro repos. See LP bug 1521073 for more details. @@ -528,10 +629,18 @@ fi # start_ceph() - Start running processes, including screen function start_ceph { if is_ubuntu; then + # Do a Ceph version check. If version >= Infernalis, then make sure that + # the user "ceph" is the owner of files within ${CEPH_DATA_DIR}. + if [[ $(echo $(get_ceph_version mon) '>=' 9.2 | bc -l) == 1 ]]; then + sudo chown -R ceph. ${CEPH_DATA_DIR} + fi sudo initctl emit ceph-mon id=$(hostname) for id in $(sudo ceph -c ${CEPH_CONF_FILE} osd ls); do sudo start ceph-osd id=${id} done + if is_ceph_enabled_for_service manila; then + sudo start ceph-mds id=${MDS_ID} + fi else sudo service ceph start fi @@ -545,6 +654,9 @@ function stop_ceph { if is_ubuntu; then sudo service ceph-mon-all stop > /dev/null 2>&1 sudo service ceph-osd-all stop > /dev/null 2>&1 + if is_ceph_enabled_for_service manila; then + sudo service ceph-mds-all stop > /dev/null 2>&1 + fi else sudo service ceph stop > /dev/null 2>&1 fi diff --git a/devstack/override-defaults b/devstack/override-defaults index 71b98260..9df55dec 100644 --- a/devstack/override-defaults +++ b/devstack/override-defaults @@ -3,6 +3,9 @@ ENABLE_CEPH_CINDER=$(trueorfalse True ENABLE_CEPH_CINDER) ENABLE_CEPH_C_BAK=$(trueorfalse True ENABLE_CEPH_C_BAK) ENABLE_CEPH_GLANCE=$(trueorfalse True ENABLE_CEPH_GLANCE) +# Disable Ceph as the default backend for Manila as the +# CephFS Manila driver is WIP. +ENABLE_CEPH_MANILA=$(trueorfalse False ENABLE_CEPH_MANILA) ENABLE_CEPH_NOVA=$(trueorfalse True ENABLE_CEPH_NOVA) if [[ $ENABLE_CEPH_CINDER == "True" ]]; then diff --git a/devstack/plugin.sh b/devstack/plugin.sh index 7d5e5024..7aaf7dcc 100644 --- a/devstack/plugin.sh +++ b/devstack/plugin.sh @@ -40,6 +40,10 @@ elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then echo_summary "Configuring libvirt secret" import_libvirt_secret_ceph fi + if is_ceph_enabled_for_service manila; then + echo_summary "Configuring Manila for Ceph" + configure_ceph_manila + fi if [ "$REMOTE_CEPH" = "False" ]; then if is_ceph_enabled_for_service glance; then @@ -54,6 +58,10 @@ elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then echo_summary "Configuring Cinder for Ceph" configure_ceph_embedded_cinder fi + if is_ceph_enabled_for_service manila; then + echo_summary "Configuring Manila for Ceph" + configure_ceph_embedded_manila + fi # FIXME: Fix this once radosgw service is running #echo_summary "Configuring Rados Gateway with Keystone for Swift" diff --git a/devstack/settings b/devstack/settings index 64c86c04..4cfbc8ed 100644 --- a/devstack/settings +++ b/devstack/settings @@ -15,5 +15,24 @@ TEMPEST_STORAGE_PROTOCOL=ceph CEPH_LOOPBACK_DISK_SIZE=8G # Source plugin's lib/ceph - source $CEPH_PLUGIN_DIR/lib/ceph + +# Set Manila related global variables used by Manila's DevStack plugin. +if (is_ceph_enabled_for_service manila) && \ +[[ $MANILA_CEPH_DRIVER == 'cephfsnative' ]]; then + MANILA_DHSS=$(trueorfalse False MANILA_DHSS) + ENABLED_SHARE_PROTOCOLS="CEPHFS" + MANILA_DEFAULT_SHARE_TYPE=cephfstype + # CephFSNative Driver does not yet support creation of shares from + # snapshot. + MANILA_DEFAULT_SHARE_TYPE_EXTRA_SPECS='snapshot_support=False' + + MANILA_ENABLED_BACKENDS=cephfsnative1 + MANILA_CONFIGURE_GROUPS=cephfsnative1 + + MANILA_OPTGROUP_cephfsnative1_share_driver=manila.share.drivers.cephfs.CephFSNativeDriver + MANILA_OPTGROUP_cephfsnative1_driver_handles_share_servers=$MANILA_DHSS + MANILA_OPTGROUP_cephfsnative1_share_backend_name=CEPHFSNATIVE1 + MANILA_OPTGROUP_cephfsnative1_cephfs_conf_path=${CEPH_CONF_FILE} + MANILA_OPTGROUP_cephfsnative1_cephfs_auth_id=${MANILA_CEPH_USER} +fi diff --git a/manila/post_test_hook.sh b/manila/post_test_hook.sh new file mode 100644 index 00000000..8addb6ad --- /dev/null +++ b/manila/post_test_hook.sh @@ -0,0 +1,135 @@ +#!/bin/bash -xe +# +# 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. + +# This script is executed inside post_test_hook function in devstack gate. + +sudo chown -R jenkins:stack $BASE/new/tempest +sudo chown -R jenkins:stack $BASE/data/tempest +sudo chmod -R o+rx $BASE/new/devstack/files + +# Import devstack functions 'iniset'. +source $BASE/new/devstack/functions + +export TEMPEST_CONFIG=$BASE/new/tempest/etc/tempest.conf + +# === Handle script arguments === +# The script arguments as detailed here in the manila CI job +# template, +# https://github.com/openstack-infra/project-config/commit/6ae99cee70a33d6cc312a7f9a83aa6db8b39ce21 +# Handle the relevant ones. + +# First argument is the type of backend configuration that is setup. It can +# either be 'singlebackend' or 'multiplebackend'. +MANILA_BACKEND_TYPE=$1 +MANILA_BACKEND_TYPE=${MANILA_BACKEND_TYPE:-singlebackend} + +# Second argument is the type of the cephfs driver that is setup. Currently, +# 'cephfsnative' is the only possibility. +MANILA_CEPH_DRIVER=$2 +MANILA_CEPH_DRIVER=${MANILA_CEPH_DRIVER:-cephfsnative} + +# Third argument is the type of Tempest tests to be run, 'api' or 'scenario'. +MANILA_TEST_TYPE=$3 +MANILA_TEST_TYPE=${MANILA_TEST_TYPE:-api} + +if [[ $MANILA_CEPH_DRIVER == 'cephfsnative' ]]; then + export BACKEND_NAME="CEPHFSNATIVE1" + iniset $TEMPEST_CONFIG share enable_protocols cephfs + iniset $TEMPEST_CONFIG share storage_protocol CEPHFS + + # Disable tempest config option that enables creation of 'ip' type access + # rules by default during tempest test runs. + iniset $TEMPEST_CONFIG share enable_ip_rules_for_protocols + iniset $TEMPEST_CONFIG share capability_snapshot_support False + iniset $TEMPEST_CONFIG share backend_names $BACKEND_NAME + + # Disable manage/unmanage tests + # CephFSNative driver does not yet support manage and unmanage operations of shares. + RUN_MANILA_MANAGE_TESTS=${RUN_MANILA_MANAGE_TESTS:-False} + iniset $TEMPEST_CONFIG share run_manage_unmanage_tests $RUN_MANILA_MANAGE_TESTS +fi + +# Set two retries for CI jobs. +iniset $TEMPEST_CONFIG share share_creation_retry_number 2 + +# Suppress errors in cleanup of resources. +SUPPRESS_ERRORS=${SUPPRESS_ERRORS_IN_CLEANUP:-True} +iniset $TEMPEST_CONFIG share suppress_errors_in_cleanup $SUPPRESS_ERRORS + + +if [[ $MANILA_BACKEND_TYPE == 'multibackend' ]]; then + RUN_MANILA_MULTI_BACKEND_TESTS=True +elif [[ $MANILA_BACKEND_TYPE == 'singlebackend' ]]; then + RUN_MANILA_MULTI_BACKEND_TESTS=False +fi +iniset $TEMPEST_CONFIG share multi_backend $RUN_MANILA_MULTI_BACKEND_TESTS + +# Enable extend tests. +RUN_MANILA_EXTEND_TESTS=${RUN_MANILA_EXTEND_TESTS:-True} +iniset $TEMPEST_CONFIG share run_extend_tests $RUN_MANILA_EXTEND_TESTS + +# Enable shrink tests. +RUN_MANILA_SHRINK_TESTS=${RUN_MANILA_SHRINK_TESTS:-True} +iniset $TEMPEST_CONFIG share run_shrink_tests $RUN_MANILA_SHRINK_TESTS + +# Disable multi_tenancy tests. +iniset $TEMPEST_CONFIG share multitenancy_enabled False + +# CephFS does not yet suppport cloning of snapshots required to create Manila +# shares from snapshots. +# Disable snapshot tests +RUN_MANILA_SNAPSHOT_TESTS=${RUN_MANILA_SNAPSHOT_TESTS:-False} +iniset $TEMPEST_CONFIG share run_snapshot_tests $RUN_MANILA_SNAPSHOT_TESTS + +# Enable consistency group tests. +RUN_MANILA_CG_TESTS=${RUN_MANILA_CG_TESTS:-True} +iniset $TEMPEST_CONFIG share run_consistency_group_tests $RUN_MANILA_CG_TESTS + +# Let us control if we die or not. +set +o errexit +cd $BASE/new/tempest + + +# Check whether tempest plugin was installed correctly. +echo 'import pkg_resources; print list(pkg_resources.iter_entry_points("tempest.test_plugins"))' | python + +# Workaround for Tempest architectural changes +# See bugs: +# 1) https://bugs.launchpad.net/manila/+bug/1531049 +# 2) https://bugs.launchpad.net/tempest/+bug/1524717 +ADMIN_TENANT_NAME=${ADMIN_TENANT_NAME:-"admin"} +ADMIN_PASSWORD=${ADMIN_PASSWORD:-"secretadmin"} +iniset $TEMPEST_CONFIG auth admin_username ${ADMIN_USERNAME:-"admin"} +iniset $TEMPEST_CONFIG auth admin_password $ADMIN_PASSWORD +iniset $TEMPEST_CONFIG auth admin_tenant_name $ADMIN_TENANT_NAME +iniset $TEMPEST_CONFIG auth admin_domain_name ${ADMIN_DOMAIN_NAME:-"Default"} +iniset $TEMPEST_CONFIG identity username ${TEMPEST_USERNAME:-"demo"} +iniset $TEMPEST_CONFIG identity password $ADMIN_PASSWORD +iniset $TEMPEST_CONFIG identity tenant_name ${TEMPEST_TENANT_NAME:-"demo"} +iniset $TEMPEST_CONFIG identity alt_username ${ALT_USERNAME:-"alt_demo"} +iniset $TEMPEST_CONFIG identity alt_password $ADMIN_PASSWORD +iniset $TEMPEST_CONFIG identity alt_tenant_name ${ALT_TENANT_NAME:-"alt_demo"} +iniset $TEMPEST_CONFIG validation ip_version_for_ssh 4 +iniset $TEMPEST_CONFIG validation ssh_timeout $BUILD_TIMEOUT +iniset $TEMPEST_CONFIG validation network_for_ssh ${PRIVATE_NETWORK_NAME:-"private"} + +echo "Running tempest manila test suites" +if [[ $MANILA_TEST_TYPE == 'api' ]]; then + export MANILA_TESTS='manila_tempest_tests.tests.api' +elif [[ $MANILA_TEST_TYPE == 'scenario' ]]; then + export MANILA_TESTS='manila_tempest_tests.tests.scenario' +fi +export MANILA_TEMPEST_CONCURRENCY=${MANILA_TEMPEST_CONCURRENCY:-12} + +sudo -H -u jenkins tox -eall-plugin $MANILA_TESTS -- --concurrency=$MANILA_TEMPEST_CONCURRENCY diff --git a/manila/pre_test_hook.sh b/manila/pre_test_hook.sh new file mode 100644 index 00000000..34a69431 --- /dev/null +++ b/manila/pre_test_hook.sh @@ -0,0 +1,66 @@ +#!/bin/bash -xe +# +# 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. + +# This script is executed inside pre_test_hook function in devstack gate. + +# Import devstack function 'trueorfalse'. +source $BASE/new/devstack/functions + +# === Handle script arguments === +# Handle script arguments as detailed here in the manila CI job template, +# https://github.com/openstack-infra/project-config/commit/6ae99cee70a33d6cc312a7f9a83aa6db8b39ce21 + +# First argument specifies the type of share driver -- whether the driver +# handles or does not handle share servers -- to be configured. It is a boolean +# value, 'True' for driver that handles share servers, and 'False' for driver +# that does not. +MANILA_DHSS=$1 +MANILA_DHSS=$(trueorfalse False MANILA_DHSS) + +# Second argument specifies the type of cephfs driver to be set up. Currently, +# 'cephfsnative' is the only option. +MANILA_CEPH_DRIVER=$2 +MANILA_CEPH_DRIVER=${MANILA_CEPH_DRIVER:-cephfsnative} + +# Third argument specifies the type of backend configuration. It can either be +# 'singlebackend' or 'multiplebackend'. +MANILA_BACKEND_TYPE=$3 +MANILA_BACKEND_TYPE=${MANILA_BACKEND_TYPE:-singlebackend} +if [[ $MANILA_BACKEND_TYPE == 'multibackend' ]]; then + echo "MANILA_MULTI_BACKEND=True" >> $localrc_path +elif [[ $MANILA_BACKEND_TYPE == 'singlebackend' ]]; then + echo "MANILA_MULTI_BACKEND=False" >> $localrc_path +fi + +localrc_path=$BASE/new/devstack/localrc +echo "DEVSTACK_GATE_TEMPEST_ALLOW_TENANT_ISOLATION=1" >> $localrc_path +echo "API_RATE_LIMIT=False" >> $localrc_path +echo "TEMPEST_SERVICES+=,manila" >> $localrc_path +echo "MANILA_USE_DOWNGRADE_MIGRATIONS=True" >> $localrc_path + +# Enable isolated metadata in Neutron because Tempest creates isolated +# networks and created VMs in scenario tests don't have access to Nova Metadata +# service. This leads to unavailability of created VMs in scenario tests. +echo 'ENABLE_ISOLATED_METADATA=True' >> $localrc_path + +# Go to Tempest dir and checkout stable commit to avoid possible +# incompatibilities for plugin stored in Manila repo. +cd $BASE/new/tempest + +# Import to set $MANILA_TEMPEST_COMMIT. +source $BASE/new/manila/contrib/ci/common.sh +git checkout $MANILA_TEMPEST_COMMIT + +# Print current Tempest status. +git status