Create multiattach volume type for tempest
Creating multiattach volume is a non-admin operation but creating multiattach volume type is an admin operation. Previously cinder allowed creating multiattach volumes without a volume type but that support is being removed with[1]. The change requires updating tempest tests[2] but some tempest tests are non-admin, which require admin priviledges to create the multiattach volume type. Based on the last discussion with tempest team[3], the proposed solution is to create a multiattach volume type in devstack, if ENABLE_VOLUME_MULTIATTACH is True, and use it in tempest tests. Similar to how admins create multiattach volume types for non-admin users. This patch creates a multiattach volume type if ENABLE_VOLUME_MULTIATTACH is True. Also we set the multiattach type name as a tempest config option 'volume_type_multiattach'. [1] https://review.opendev.org/c/openstack/cinder/+/874865 [2] https://review.opendev.org/c/openstack/tempest/+/875372 [3] https://meetings.opendev.org/irclogs/%23openstack-cinder/%23openstack-cinder.2023-03-13.log.html#t2023-03-13T18:47:56 Change-Id: Icd3690565bf7b27898cd206641e612da3993703d
This commit is contained in:
parent
35c9afffa5
commit
1898a683be
34
lib/cinder
34
lib/cinder
@ -95,6 +95,7 @@ CINDER_ENABLED_BACKENDS=${CINDER_ENABLED_BACKENDS:-lvm:lvmdriver-1}
|
|||||||
CINDER_VOLUME_CLEAR=${CINDER_VOLUME_CLEAR:-${CINDER_VOLUME_CLEAR_DEFAULT:-zero}}
|
CINDER_VOLUME_CLEAR=${CINDER_VOLUME_CLEAR:-${CINDER_VOLUME_CLEAR_DEFAULT:-zero}}
|
||||||
CINDER_VOLUME_CLEAR=$(echo ${CINDER_VOLUME_CLEAR} | tr '[:upper:]' '[:lower:]')
|
CINDER_VOLUME_CLEAR=$(echo ${CINDER_VOLUME_CLEAR} | tr '[:upper:]' '[:lower:]')
|
||||||
|
|
||||||
|
VOLUME_TYPE_MULTIATTACH=${VOLUME_TYPE_MULTIATTACH:-multiattach}
|
||||||
|
|
||||||
if [[ -n "$CINDER_ISCSI_HELPER" ]]; then
|
if [[ -n "$CINDER_ISCSI_HELPER" ]]; then
|
||||||
if [[ -z "$CINDER_TARGET_HELPER" ]]; then
|
if [[ -z "$CINDER_TARGET_HELPER" ]]; then
|
||||||
@ -649,6 +650,23 @@ function stop_cinder {
|
|||||||
stop_process c-vol
|
stop_process c-vol
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function create_one_type {
|
||||||
|
type_name=$1
|
||||||
|
property_key=$2
|
||||||
|
property_value=$3
|
||||||
|
# NOTE (e0ne): openstack client doesn't work with cinder in noauth mode
|
||||||
|
if is_service_enabled keystone; then
|
||||||
|
openstack --os-region-name="$REGION_NAME" volume type create --property $property_key="$property_value" $type_name
|
||||||
|
else
|
||||||
|
# TODO (e0ne): use openstack client once it will support cinder in noauth mode:
|
||||||
|
# https://bugs.launchpad.net/python-cinderclient/+bug/1755279
|
||||||
|
local cinder_url
|
||||||
|
cinder_url=$CINDER_SERVICE_PROTOCOL://$SERVICE_HOST:$CINDER_SERVICE_PORT/v3
|
||||||
|
OS_USER_ID=$OS_USERNAME OS_PROJECT_ID=$OS_PROJECT_NAME cinder --os-auth-type noauth --os-endpoint=$cinder_url type-create $type_name
|
||||||
|
OS_USER_ID=$OS_USERNAME OS_PROJECT_ID=$OS_PROJECT_NAME cinder --os-auth-type noauth --os-endpoint=$cinder_url type-key $type_name set $property_key="$property_value"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# create_volume_types() - Create Cinder's configured volume types
|
# create_volume_types() - Create Cinder's configured volume types
|
||||||
function create_volume_types {
|
function create_volume_types {
|
||||||
# Create volume types
|
# Create volume types
|
||||||
@ -656,19 +674,13 @@ function create_volume_types {
|
|||||||
local be be_name
|
local be be_name
|
||||||
for be in ${CINDER_ENABLED_BACKENDS//,/ }; do
|
for be in ${CINDER_ENABLED_BACKENDS//,/ }; do
|
||||||
be_name=${be##*:}
|
be_name=${be##*:}
|
||||||
# NOTE (e0ne): openstack client doesn't work with cinder in noauth mode
|
create_one_type $be_name "volume_backend_name" $be_name
|
||||||
if is_service_enabled keystone; then
|
|
||||||
openstack --os-region-name="$REGION_NAME" volume type create --property volume_backend_name="${be_name}" ${be_name}
|
|
||||||
else
|
|
||||||
# TODO (e0ne): use openstack client once it will support cinder in noauth mode:
|
|
||||||
# https://bugs.launchpad.net/python-cinderclient/+bug/1755279
|
|
||||||
local cinder_url
|
|
||||||
cinder_url=$CINDER_SERVICE_PROTOCOL://$SERVICE_HOST:$CINDER_SERVICE_PORT/v3
|
|
||||||
OS_USER_ID=$OS_USERNAME OS_PROJECT_ID=$OS_PROJECT_NAME cinder --os-auth-type noauth --os-endpoint=$cinder_url type-create ${be_name}
|
|
||||||
OS_USER_ID=$OS_USERNAME OS_PROJECT_ID=$OS_PROJECT_NAME cinder --os-auth-type noauth --os-endpoint=$cinder_url type-key ${be_name} set volume_backend_name=${be_name}
|
|
||||||
fi
|
|
||||||
done
|
done
|
||||||
|
|
||||||
|
if [[ $ENABLE_VOLUME_MULTIATTACH == "True" ]]; then
|
||||||
|
create_one_type $VOLUME_TYPE_MULTIATTACH $VOLUME_TYPE_MULTIATTACH "<is> True"
|
||||||
|
fi
|
||||||
|
|
||||||
# Increase quota for the service project if glance is using cinder,
|
# Increase quota for the service project if glance is using cinder,
|
||||||
# since it's likely to occasionally go above the default 10 in parallel
|
# since it's likely to occasionally go above the default 10 in parallel
|
||||||
# test execution.
|
# test execution.
|
||||||
|
@ -604,6 +604,10 @@ function configure_tempest {
|
|||||||
iniset $TEMPEST_CONFIG volume storage_protocol "$TEMPEST_STORAGE_PROTOCOL"
|
iniset $TEMPEST_CONFIG volume storage_protocol "$TEMPEST_STORAGE_PROTOCOL"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ $ENABLE_VOLUME_MULTIATTACH == "True" ]]; then
|
||||||
|
iniset $TEMPEST_CONFIG volume volume_type_multiattach $VOLUME_TYPE_MULTIATTACH
|
||||||
|
fi
|
||||||
|
|
||||||
# Placement Features
|
# Placement Features
|
||||||
# Set the microversion range for placement.
|
# Set the microversion range for placement.
|
||||||
# Setting [None, latest] range of microversion which allow Tempest to run all microversions tests.
|
# Setting [None, latest] range of microversion which allow Tempest to run all microversions tests.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user