Browse code

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

Eric Windisch authored on 2014/01/29 01:20:53
Showing 1 changed files
... ...
@@ -1090,6 +1090,47 @@ if is_service_enabled g-api g-reg; then
1090 1090
     start_glance
1091 1091
 fi
1092 1092
 
1093
+# Install Images
1094
+# ==============
1095
+
1096
+# Upload an image to glance.
1097
+#
1098
+# The default image is cirros, a small testing image which lets you login as **root**
1099
+# cirros has a ``cloud-init`` analog supporting login via keypair and sending
1100
+# scripts as userdata.
1101
+# See https://help.ubuntu.com/community/CloudInit for more on cloud-init
1102
+#
1103
+# Override ``IMAGE_URLS`` with a comma-separated list of UEC images.
1104
+#  * **precise**: http://uec-images.ubuntu.com/precise/current/precise-server-cloudimg-amd64.tar.gz
1105
+
1106
+if is_service_enabled g-reg; then
1107
+    TOKEN=$(keystone token-get | grep ' id ' | get_field 2)
1108
+    die_if_not_set $LINENO TOKEN "Keystone fail to get token"
1109
+
1110
+    if is_baremetal; then
1111
+        echo_summary "Creating and uploading baremetal images"
1112
+
1113
+        # build and upload separate deploy kernel & ramdisk
1114
+        upload_baremetal_deploy $TOKEN
1115
+
1116
+        # upload images, separating out the kernel & ramdisk for PXE boot
1117
+        for image_url in ${IMAGE_URLS//,/ }; do
1118
+            upload_baremetal_image $image_url $TOKEN
1119
+        done
1120
+    else
1121
+        echo_summary "Uploading images"
1122
+
1123
+        # Option to upload legacy ami-tty, which works with xenserver
1124
+        if [[ -n "$UPLOAD_LEGACY_TTY" ]]; then
1125
+            IMAGE_URLS="${IMAGE_URLS:+${IMAGE_URLS},}https://github.com/downloads/citrix-openstack/warehouse/tty.tgz"
1126
+        fi
1127
+
1128
+        for image_url in ${IMAGE_URLS//,/ }; do
1129
+            upload_image $image_url $TOKEN
1130
+        done
1131
+    fi
1132
+fi
1133
+
1093 1134
 # Create an access key and secret key for nova ec2 register image
1094 1135
 if is_service_enabled key && is_service_enabled swift3 && is_service_enabled nova; then
1095 1136
     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
1195 1195
 fi
1196 1196
 
1197 1197
 
1198
-# Install Images
1199
-# ==============
1200
-
1201
-# Upload an image to glance.
1202
-#
1203
-# The default image is cirros, a small testing image which lets you login as **root**
1204
-# cirros has a ``cloud-init`` analog supporting login via keypair and sending
1205
-# scripts as userdata.
1206
-# See https://help.ubuntu.com/community/CloudInit for more on cloud-init
1207
-#
1208
-# Override ``IMAGE_URLS`` with a comma-separated list of UEC images.
1209
-#  * **precise**: http://uec-images.ubuntu.com/precise/current/precise-server-cloudimg-amd64.tar.gz
1210
-
1211
-if is_service_enabled g-reg; then
1212
-    TOKEN=$(keystone token-get | grep ' id ' | get_field 2)
1213
-    die_if_not_set $LINENO TOKEN "Keystone fail to get token"
1214
-
1215
-    if is_baremetal; then
1216
-        echo_summary "Creating and uploading baremetal images"
1217
-
1218
-        # build and upload separate deploy kernel & ramdisk
1219
-        upload_baremetal_deploy $TOKEN
1220
-
1221
-        # upload images, separating out the kernel & ramdisk for PXE boot
1222
-        for image_url in ${IMAGE_URLS//,/ }; do
1223
-            upload_baremetal_image $image_url $TOKEN
1224
-        done
1225
-    else
1226
-        echo_summary "Uploading images"
1227
-
1228
-        # Option to upload legacy ami-tty, which works with xenserver
1229
-        if [[ -n "$UPLOAD_LEGACY_TTY" ]]; then
1230
-            IMAGE_URLS="${IMAGE_URLS:+${IMAGE_URLS},}https://github.com/downloads/citrix-openstack/warehouse/tty.tgz"
1231
-        fi
1232
-
1233
-        for image_url in ${IMAGE_URLS//,/ }; do
1234
-            upload_image $image_url $TOKEN
1235
-        done
1236
-    fi
1237
-fi
1238
-
1239 1198
 # If we are running nova with baremetal driver, there are a few
1240 1199
 # last-mile configuration bits to attend to, which must happen
1241 1200
 # after n-api and n-sch have started.