Devstack: support download ubuntu image

After this patch applied, we can pass MANGUM_GUEST_IMAGE_URL to devstack
environment to download a ubuntu image and upload it to glance with proper
os_distro set.

This is a preparation to add mesos function testing.
Implements: blueprint mesos-functional-testing
Change-Id: I98274cd2bf1cfb37f1a1c960d0a455d9c24d1e0b
This commit is contained in:
Eli Qiao 2015-12-25 17:04:47 +08:00
parent 49c0f4d4ce
commit 09af131807
1 changed files with 11 additions and 1 deletions

View File

@ -233,7 +233,17 @@ function init_magnum {
# magnum_register_image - Register heat image for magnum with property os_distro # magnum_register_image - Register heat image for magnum with property os_distro
function magnum_register_image { function magnum_register_image {
local magnum_image_property="--property os_distro=fedora-atomic" local magnum_image_property="--property os_distro="
local atomic="$(echo $MANGUM_GUEST_IMAGE_URL | grep -o 'atomic' || true;)"
if [ ! -z $atomic ]; then
magnum_image_property=$magnum_image_property"fedora-atomic"
fi
local ubuntu="$(echo $MANGUM_GUEST_IMAGE_URL | grep -o "ubuntu" || ture;)"
if [ ! -z $ubuntu ]; then
magnum_image_property=$magnum_image_property"ubuntu"
fi
openstack --os-url $GLANCE_SERVICE_PROTOCOL://$GLANCE_HOSTPORT --os-image-api-version 1 image set $(basename "$MANGUM_GUEST_IMAGE_URL" ".qcow2") $magnum_image_property openstack --os-url $GLANCE_SERVICE_PROTOCOL://$GLANCE_HOSTPORT --os-image-api-version 1 image set $(basename "$MANGUM_GUEST_IMAGE_URL" ".qcow2") $magnum_image_property
} }