Custom Search

Wednesday, March 26, 2014

OpenStack Heat devstack tricks with images

a)
Configure DevStack to enable Heat
Adding the following line to your `localrc` file will enable the heat services

ENABLED_SERVICES+=,heat,h-api,h-api-cfn,h-api-cw,h-eng
## It would also be useful to automatically download and register VM images that Heat can launch.
# 64bit image (~660MB)
IMAGE_URLS+=",http://fedorapeople.org/groups/heat/prebuilt-jeos-images/F17-x86_64-cfntools.qcow2"
# 32bit image (~640MB)
IMAGE_URLS+=",http://fedorapeople.org/groups/heat/prebuilt-jeos-images/F17-i386-cfntools.qcow2"


b)
devstack/stack.sh
https://github.com/openstack-dev/devstack/blob/master/stack.sh

# Install Images
# ==============
You can Override ``IMAGE_URLS`` with a comma-separated list of UEC images in localrc.

#g-reg: if glance registration service enabled
if is_service_enabled g-reg; then
    #Upload images to glance
    for image_url in ${IMAGE_URLS//,/ }; do
        upload_baremetal_image $image_url $TOKEN <=== Method Call
    done

c)
devstack/lib/baremetal
https://github.com/openstack-dev/devstack/blob/master/lib/baremetal

function upload_baremetal_image() {
    local image_url=$1
    local token=$2

    # Create a directory for the downloaded image tarballs.
    mkdir -p $FILES/images

    # Downloads the image (uec ami+aki style), then extracts it.
    IMAGE_FNAME=`basename "$image_url"`
    if [[ ! -f $FILES/$IMAGE_FNAME || \
        "$(stat -c "%s" $FILES/$IMAGE_FNAME)" = "0" ]]; then
        wget -c $image_url -O $FILES/$IMAGE_FNAME <=Download image
        if [[ $? -ne 0 ]]; then
            echo "Not found: $image_url"
            return
        fi
    fi

* Above function "upload_baremetal_image" will download the images (defined in the localrc) to the folder "devstack/files/", then
upload to glance.


* So if you already downloaded that images, then just copy that to the folder "files" in the "devstack/" folder and run ./stack script.

* ls -lsh ~/openstack/devstack/files/

https://github.com/openstack-dev/devstack/tree/master/files
454M -rw-r--r-- 1 saju saju 454M Mar 26 18:27 F17-i386-cfntools.qcow2
455M -rw-r--r-- 1 saju saju 455M Mar 26 18:28 F17-x86_64-cfntools.qcow2


No comments:

Post a Comment