From 0b9776d2f34197d1e920e1dc8506b8f8c31452ca Mon Sep 17 00:00:00 2001 From: Eric Windisch <ewindisch@docker.com> Date: Tue, 28 Jan 2014 11:20:53 -0500 Subject: [PATCH] Install glance images before starting Nova The docker driver for Nova needs a registry service to be running. It is being run inside a container using an image -- that image must be downloaded. The registry service must be started via nova_plugins/hypervisor-docker, but this is presently called before Glance's image download. The reordering is being done such that Glance may download the registry image, but prior to starting Nova such that "hypervisor-docker" may have an image downloaded and available to launch the registry. This change should cause no negative effects on other hypervisors. Change-Id: I7bccb42517e4c6187f2a90c64f39cda4577f89a3 blueprint: docker-glance-uploads --- stack.sh | 82 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 41 insertions(+), 41 deletions(-) diff --git a/stack.sh b/stack.sh index 303541d63e..78cfbc58ce 100755 --- a/stack.sh +++ b/stack.sh @@ -1090,6 +1090,47 @@ if is_service_enabled g-api g-reg; then start_glance fi +# Install Images +# ============== + +# Upload an image to glance. +# +# The default image is cirros, a small testing image which lets you login as **root** +# cirros has a ``cloud-init`` analog supporting login via keypair and sending +# scripts as userdata. +# See https://help.ubuntu.com/community/CloudInit for more on cloud-init +# +# Override ``IMAGE_URLS`` with a comma-separated list of UEC images. +# * **precise**: http://uec-images.ubuntu.com/precise/current/precise-server-cloudimg-amd64.tar.gz + +if is_service_enabled g-reg; then + TOKEN=$(keystone token-get | grep ' id ' | get_field 2) + die_if_not_set $LINENO TOKEN "Keystone fail to get token" + + if is_baremetal; then + echo_summary "Creating and uploading baremetal images" + + # build and upload separate deploy kernel & ramdisk + upload_baremetal_deploy $TOKEN + + # upload images, separating out the kernel & ramdisk for PXE boot + for image_url in ${IMAGE_URLS//,/ }; do + upload_baremetal_image $image_url $TOKEN + done + else + echo_summary "Uploading images" + + # Option to upload legacy ami-tty, which works with xenserver + if [[ -n "$UPLOAD_LEGACY_TTY" ]]; then + IMAGE_URLS="${IMAGE_URLS:+${IMAGE_URLS},}https://github.com/downloads/citrix-openstack/warehouse/tty.tgz" + fi + + for image_url in ${IMAGE_URLS//,/ }; do + upload_image $image_url $TOKEN + done + fi +fi + # Create an access key and secret key for nova ec2 register image if is_service_enabled key && is_service_enabled swift3 && is_service_enabled nova; then NOVA_USER_ID=$(keystone user-list | grep ' nova ' | get_field 1) @@ -1195,47 +1236,6 @@ if is_service_enabled nova && is_service_enabled key; then fi -# Install Images -# ============== - -# Upload an image to glance. -# -# The default image is cirros, a small testing image which lets you login as **root** -# cirros has a ``cloud-init`` analog supporting login via keypair and sending -# scripts as userdata. -# See https://help.ubuntu.com/community/CloudInit for more on cloud-init -# -# Override ``IMAGE_URLS`` with a comma-separated list of UEC images. -# * **precise**: http://uec-images.ubuntu.com/precise/current/precise-server-cloudimg-amd64.tar.gz - -if is_service_enabled g-reg; then - TOKEN=$(keystone token-get | grep ' id ' | get_field 2) - die_if_not_set $LINENO TOKEN "Keystone fail to get token" - - if is_baremetal; then - echo_summary "Creating and uploading baremetal images" - - # build and upload separate deploy kernel & ramdisk - upload_baremetal_deploy $TOKEN - - # upload images, separating out the kernel & ramdisk for PXE boot - for image_url in ${IMAGE_URLS//,/ }; do - upload_baremetal_image $image_url $TOKEN - done - else - echo_summary "Uploading images" - - # Option to upload legacy ami-tty, which works with xenserver - if [[ -n "$UPLOAD_LEGACY_TTY" ]]; then - IMAGE_URLS="${IMAGE_URLS:+${IMAGE_URLS},}https://github.com/downloads/citrix-openstack/warehouse/tty.tgz" - fi - - for image_url in ${IMAGE_URLS//,/ }; do - upload_image $image_url $TOKEN - done - fi -fi - # If we are running nova with baremetal driver, there are a few # last-mile configuration bits to attend to, which must happen # after n-api and n-sch have started.