Add CI job support for second mode of Generic driver

After appearence of second mode for Generic driver we need to run additional
job with functional tests using this second mode.

Changes:
- Add possibility to create service share server for each generic driver with
mode that does not allow share servers handling.
- Add autodetection of driver mode for post_test_hook.

Implements bp generic-driver-single-svm-ci-job

Change-Id: I77127115a89caaaa8701c2089cd5db4b609e6c7f
This commit is contained in:
Valeriy Ponomaryov 2015-01-22 19:55:03 +02:00
parent 53b40423f4
commit 75c4aae09e
3 changed files with 75 additions and 6 deletions

View File

@ -13,21 +13,26 @@
# under the License.
# This script is executed inside post_test_hook function in devstack gate.
# First argument ($1) expects 'multibackend' as value for setting appropriate
# tempest conf opts, all other values will assume singlebackend installation.
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 function 'iniset'
# Import devstack functions 'iniset', 'iniget' and 'trueorfalse'
source $BASE/new/devstack/functions
if [[ "$1" =~ "multibackend" ]]; then
# if arg $1 has "multibackend", then we assume multibackend installation
iniset $BASE/new/tempest/etc/tempest.conf share multi_backend True
# backend names are defined in pre_test_hook
iniset $BASE/new/tempest/etc/tempest.conf share backend_names "LONDON,PARIS"
# Set share backends names, they are defined within pre_test_hook
export BACKENDS_NAMES="LONDON,PARIS"
else
export BACKENDS_NAMES="LONDON"
fi
iniset $BASE/new/tempest/etc/tempest.conf share backend_names $BACKENDS_NAMES
# Set two retries for CI jobs
iniset $BASE/new/tempest/etc/tempest.conf share share_creation_retry_number 2
@ -35,6 +40,41 @@ iniset $BASE/new/tempest/etc/tempest.conf share share_creation_retry_number 2
# Suppress errors in cleanup of resources
iniset $BASE/new/tempest/etc/tempest.conf share suppress_errors_in_cleanup True
# Define whether share drivers handle share servers or not.
# Requires defined config option 'driver_handles_share_servers'.
MANILA_CONF=${MANILA_CONF:-/etc/manila/manila.conf}
NO_SHARE_SERVER_HANDLING_MODES=0
WITH_SHARE_SERVER_HANDLING_MODES=0
# Convert backend names to config groups using lowercase translation
CONFIG_GROUPS=${BACKENDS_NAMES,,}
for CG in ${CONFIG_GROUPS//,/ }; do
DRIVER_HANDLES_SHARE_SERVERS=$(iniget $MANILA_CONF $CG driver_handles_share_servers)
if [[ $DRIVER_HANDLES_SHARE_SERVERS == False ]]; then
NO_SHARE_SERVER_HANDLING_MODES=$((NO_SHARE_SERVER_HANDLING_MODES+1))
elif [[ $DRIVER_HANDLES_SHARE_SERVERS == True ]]; then
WITH_SHARE_SERVER_HANDLING_MODES=$((WITH_SHARE_SERVER_HANDLING_MODES+1))
else
echo "Config option 'driver_handles_share_servers' either is not defined or \
defined with improper value - '$DRIVER_HANDLES_SHARE_SERVERS'."
exit 1
fi
done
if [[ $NO_SHARE_SERVER_HANDLING_MODES -ge 1 && $WITH_SHARE_SERVER_HANDLING_MODES -ge 1 || \
$NO_SHARE_SERVER_HANDLING_MODES -eq 0 && $WITH_SHARE_SERVER_HANDLING_MODES -eq 0 ]]; then
echo 'Allowed only same driver modes for all backends to be run with Tempest job.'
exit 1
elif [[ $NO_SHARE_SERVER_HANDLING_MODES -ge 1 ]]; then
iniset $BASE/new/tempest/etc/tempest.conf share multitenancy_enabled False
elif [[ $WITH_SHARE_SERVER_HANDLING_MODES -ge 1 ]]; then
iniset $BASE/new/tempest/etc/tempest.conf share multitenancy_enabled True
else
echo 'Should never get here. If get, then error occured.'
exit 1
fi
# let us control if we die or not
set +o errexit
cd $BASE/new/tempest

View File

@ -16,12 +16,20 @@ if is_service_enabled manila; then
elif [[ "$1" == "stack" && "$2" == "extra" ]]; then
echo_summary "Creating Manila entities for auth service"
create_manila_accounts
echo_summary "Creating Manila service flavor"
create_manila_service_flavor
echo_summary "Creating Manila service security group"
create_manila_service_secgroup
echo_summary "Creating Manila service image"
create_manila_service_image
echo_summary "Creating Manila service share servers for generic driver backends \
for which handlng of share servers is disabled."
create_service_share_servers
echo_summary "Starting Manila"
start_manila
fi

View File

@ -82,6 +82,7 @@ fi
# Common opts
SHARE_NAME_PREFIX=${SHARE_NAME_PREFIX:-share-}
MANILA_SCHEDULER_DRIVER=${MANILA_SCHEDULER_DRIVER:-manila.scheduler.filter_scheduler.FilterScheduler}
MANILA_SERVICE_SECGROUP="manila-service"
# Common info for Generic driver(s)
SHARE_DRIVER=${SHARE_DRIVER:-manila.share.drivers.generic.GenericShareDriver}
@ -260,7 +261,7 @@ function configure_manila {
fi
if [ ! $MANILA_ENABLED_BACKENDS ]; then
# If $MANILA_ENABLED_BACKENDS is not set, use configured backends by default
MANILA_ENABLED_BACKENDS=$default_backends
export MANILA_ENABLED_BACKENDS=$default_backends
fi
iniset $MANILA_CONF DEFAULT enabled_share_backends $MANILA_ENABLED_BACKENDS
@ -292,6 +293,28 @@ function configure_manila {
set_config_opts DEFAULT
}
function create_service_share_servers {
private_net_id=$(neutron net-list --all-tenants | grep ' private ' | get_field 1)
for BE in ${MANILA_ENABLED_BACKENDS//,/ }; do
driver_handles_share_servers=$(iniget $MANILA_CONF $BE driver_handles_share_servers)
share_driver=$(iniget $MANILA_CONF $BE share_driver)
generic_driver='manila.share.drivers.generic.GenericShareDriver'
if [[ $(trueorfalse False driver_handles_share_servers) == False && \
$share_driver == $generic_driver ]]; then
vm_name='manila_service_share_server_'$BE
nova boot $vm_name \
--flavor $MANILA_SERVICE_VM_FLAVOR_NAME \
--image $MANILA_SERVICE_IMAGE_NAME \
--nic net-id=$private_net_id \
--security-groups $MANILA_SERVICE_SECGROUP
iniset $MANILA_CONF $BE service_instance_name_or_id $vm_name
iniset $MANILA_CONF $BE service_net_name_or_ip $private_net_id
iniset $MANILA_CONF $BE tenant_net_name_or_ip $private_net_id
fi
done
}
function create_manila_service_flavor {
# Create flavor for Manila's service VM
nova flavor-create $MANILA_SERVICE_VM_FLAVOR_NAME $MANILA_SERVICE_VM_FLAVOR_REF $MANILA_SERVICE_VM_FLAVOR_RAM $MANILA_SERVICE_VM_FLAVOR_DISK $MANILA_SERVICE_VM_FLAVOR_VCPUS
@ -307,8 +330,6 @@ function create_manila_service_image {
}
function create_manila_service_secgroup {
MANILA_SERVICE_SECGROUP="manila-service"
# Create a secgroup
if ! nova secgroup-list | grep -q $MANILA_SERVICE_SECGROUP; then
nova secgroup-create $MANILA_SERVICE_SECGROUP "$MANILA_SERVICE_SECGROUP description"