Browse code

Merge "Add basic uec image preparation to tempest"

Jenkins authored on 2013/01/16 12:59:42
Showing 2 changed files
... ...
@@ -9,6 +9,7 @@ if [[ "$1" == "stack" ]]; then
9 9
         echo_summary "Configuring Tempest"
10 10
         install_tempest
11 11
         configure_tempest
12
+        init_tempest
12 13
     fi
13 14
 fi
14 15
 
... ...
@@ -14,10 +14,11 @@
14 14
 # - ``PUBLIC_NETWORK_NAME``
15 15
 # - ``Q_USE_NAMESPACE``
16 16
 # - ``Q_ROUTER_NAME``
17
+# - ``VIRT_DRIVER``
18
+# - ``LIBVIRT_TYPE``
17 19
 # Optional Dependencies:
18 20
 # IDENTITY_USE_SSL, IDENTITY_HOST, IDENTITY_PORT, IDENTITY_PATH
19 21
 # ALT_* (similar vars exists in keystone_data.sh)
20
-# ``OS_USERNAME``
21 22
 # ``IMAGE_PORT``, ``IMAGE_HOST``
22 23
 # ``LIVE_MIGRATION_AVAILABLE``
23 24
 # ``USE_BLOCK_MIGRATION_FOR_LIVE_MIGRATION``
... ...
@@ -27,6 +28,7 @@
27 27
 #
28 28
 # install_tempest
29 29
 # configure_tempest
30
+# init_tempest
30 31
 
31 32
 # Save trace setting
32 33
 XTRACE=$(set +o | grep xtrace)
... ...
@@ -47,6 +49,8 @@ BUILD_INTERVAL=3
47 47
 BUILD_TIMEOUT=400
48 48
 
49 49
 
50
+BOTO_MATERIALS_PATH="$DEST/devstack/files/images/s3-materials/cirros-0.3.0"
51
+
50 52
 # Entry Points
51 53
 # ------------
52 54
 
... ...
@@ -66,6 +70,7 @@ function configure_tempest() {
66 66
     local public_network_id
67 67
     local public_router_id
68 68
     local tenant_networks_reachable
69
+    local boto_instance_type="m1.tiny"
69 70
 
70 71
     # TODO(afazekas):
71 72
     # sudo python setup.py deploy
... ...
@@ -138,11 +143,13 @@ function configure_tempest() {
138 138
     if  [[ -z "$DEFAULT_INSTANCE_TYPE" ]]; then
139 139
         nova flavor-create m1.nano 42 64 0 1
140 140
         flavor_ref=42
141
+        boto_instance_type=m1.nano
141 142
         nova flavor-create m1.micro 84 128 0 1
142 143
         flavor_ref_alt=84
143 144
     else
144 145
         # Check Nova for existing flavors and, if set, look for the
145 146
         # ``DEFAULT_INSTANCE_TYPE`` and use that.
147
+        boto_instance_type=$DEFAULT_INSTANCE_TYPE
146 148
         flavor_lines=`nova flavor-list`
147 149
         IFS=$'\r\n'
148 150
         flavors=""
... ...
@@ -216,10 +223,10 @@ function configure_tempest() {
216 216
     iniset $TEMPEST_CONF compute allow_tenant_isolation ${TEMPEST_ALLOW_TENANT_ISOLATION:-True}
217 217
     #Skip until #1074039 is fixed
218 218
     iniset $TEMPEST_CONF compute run_ssh False
219
-    iniset $TEMPEST_CONF compute ssh_user ${DEFAULT_INSTANCE_USER:-$OS_USERNAME}
219
+    iniset $TEMPEST_CONF compute ssh_user ${DEFAULT_INSTANCE_USER:-cirros}
220 220
     iniset $TEMPEST_CONF compute network_for_ssh $PRIVATE_NETWORK_NAME
221 221
     iniset $TEMPEST_CONF compute ip_version_for_ssh 4
222
-    iniset $TEMPEST_CONF compute ssh_timeout 4
222
+    iniset $TEMPEST_CONF compute ssh_timeout $BUILD_TIMEOUT
223 223
     iniset $TEMPEST_CONF compute image_ref $image_uuid
224 224
     iniset $TEMPEST_CONF compute image_ref_alt $image_uuid_alt
225 225
     iniset $TEMPEST_CONF compute flavor_ref $flavor_ref
... ...
@@ -258,6 +265,9 @@ function configure_tempest() {
258 258
     #boto
259 259
     iniset $TEMPEST_CONF boto ec2_url "http://$SERVICE_HOST:8773/services/Cloud"
260 260
     iniset $TEMPEST_CONF boto s3_url "http://$SERVICE_HOST:${S3_SERVICE_PORT:-3333}"
261
+    iniset $TEMPEST_CONF boto s3_materials_path "$BOTO_MATERIALS_PATH"
262
+    iniset $TEMPEST_CONF boto instance_type "$boto_instance_type"
263
+    iniset $TEMPEST_CONF boto http_socket_timeout 30
261 264
 
262 265
     echo "Created tempest configuration file:"
263 266
     cat $TEMPEST_CONF
... ...
@@ -277,5 +287,30 @@ function install_tempest() {
277 277
     pip_install -r $TEMPEST_DIR/tools/pip-requires
278 278
 }
279 279
 
280
+# init_tempest() - Initialize ec2 images
281
+function init_tempest() {
282
+    local base_image_name=cirros-0.3.0-x86_64
283
+    # /opt/stack/devstack/files/images/cirros-0.3.0-x86_64-uec
284
+    local devstack_dir="$DEST/devstack"
285
+    local image_dir="$devstack_dir/files/images/${base_image_name}-uec"
286
+    local kernel="$image_dir/${base_image_name}-vmlinuz"
287
+    local ramdisk="$image_dir/${base_image_name}-initrd"
288
+    local disk_image="$image_dir/${base_image_name}-blank.img"
289
+    # if the cirros uec downloaded and the system is uec capable
290
+    if [ -f "$kernel" -a -f "$ramdisk" -a -f "$disk_image" -a  "$VIRT_DRIVER" != "openvz" \
291
+         -a \( "$LIBVIRT_TYPE" != "lxc" -o "$VIRT_DRIVER" != "libvirt" \) ]; then
292
+       echo "Prepare aki/ari/ami Images"
293
+       ( #new namespace
294
+           # tenant:demo ; user: demo
295
+           source $devstack_dir/accrc/demo/demo
296
+           euca-bundle-image -i "$kernel" --kernel true -d "$BOTO_MATERIALS_PATH"
297
+           euca-bundle-image -i "$ramdisk" --ramdisk true -d "$BOTO_MATERIALS_PATH"
298
+           euca-bundle-image -i "$disk_image" -d "$BOTO_MATERIALS_PATH"
299
+       ) 2>&1 </dev/null | cat
300
+    else
301
+        echo "Boto materials are not prepared"
302
+    fi
303
+}
304
+
280 305
 # Restore xtrace
281 306
 $XTRACE