Skip to content

Commit 4976d99

Browse files
Merge pull request openstack-k8s-operators#158 from kstrenkova/extra-image
Add option to add extra image
2 parents d334b37 + d5d994f commit 4976d99

File tree

1 file changed

+33
-1
lines changed

1 file changed

+33
-1
lines changed

Diff for: container-images/tcib/base/os/tempest/run_tempest.sh

+33-1
Original file line numberDiff line numberDiff line change
@@ -171,11 +171,39 @@ if [[ ! -z ${TEMPESTCONF_REMOVE} ]]; then
171171
done <<< "$TEMPESTCONF_REMOVE"
172172
fi
173173

174-
175174
if [ -n "$CONCURRENCY" ] && [ -z ${TEMPEST_CONCURRENCY} ]; then
176175
TEMPEST_ARGS+="--concurrency ${CONCURRENCY} "
177176
fi
178177

178+
function generate_extra_tempest_configuration {
179+
TEMPEST_NEUTRON_IMAGE=neutron_tempest_plugin_image
180+
TEMPEST_NEUTRON_FLAVOR_ID=100
181+
182+
if [ ! -f "$TEMPEST_NEUTRON_IMAGE.qcow2" ]; then
183+
sudo curl -o "$TEMPEST_NEUTRON_IMAGE.qcow2" ${TEMPEST_NEUTRON_IMAGE_URL}
184+
fi
185+
186+
if ! openstack image list --os-cloud default -f value -c Name | grep ${TEMPEST_NEUTRON_IMAGE} >/dev/null; then
187+
openstack image create \
188+
--os-cloud default \
189+
--disk-format qcow2 \
190+
--container-format bare \
191+
--file "$TEMPEST_NEUTRON_IMAGE.qcow2" ${TEMPEST_NEUTRON_IMAGE}
192+
fi
193+
TEMPEST_NEUTRON_IMAGE_ID=$(openstack image list --os-cloud default --name ${TEMPEST_NEUTRON_IMAGE} -f value -c ID)
194+
195+
if ! openstack flavor list --os-cloud default -f value -c ID | grep ${TEMPEST_NEUTRON_FLAVOR_ID} >/dev/null; then
196+
openstack flavor create \
197+
--os-cloud default \
198+
--public advanced-flavor \
199+
--id ${TEMPEST_NEUTRON_FLAVOR_ID} \
200+
--ram 1024 --disk 10 --vcpus 1
201+
fi
202+
203+
TEMPESTCONF_OVERRIDES+="neutron_plugin_options.advanced_image_ref ${TEMPEST_NEUTRON_IMAGE_ID} "
204+
TEMPESTCONF_OVERRIDES+="neutron_plugin_options.advanced_image_flavor_ref ${TEMPEST_NEUTRON_FLAVOR_ID}"
205+
}
206+
179207
function run_git_tempest {
180208
mkdir -p $TEMPEST_EXTERNAL_PLUGIN_DIR
181209
pushd $TEMPEST_EXTERNAL_PLUGIN_DIR
@@ -263,6 +291,10 @@ function generate_test_results {
263291

264292
export OS_CLOUD=default
265293

294+
if [[ ! -z ${TEMPEST_NEUTRON_IMAGE_URL} ]]; then
295+
generate_extra_tempest_configuration
296+
fi
297+
266298
if [ ! -z ${USE_EXTERNAL_FILES} ]; then
267299
mkdir -p $HOME/.config/openstack
268300
cp ${TEMPEST_PATH}clouds.yaml $HOME/.config/openstack/clouds.yaml

0 commit comments

Comments
 (0)