Browse code

Merge "add an image_list tool"

Jenkins authored on 2014/04/04 10:35:43
Showing 1 changed files
1 1
new file mode 100755
... ...
@@ -0,0 +1,35 @@
0
+#!/bin/bash
1
+
2
+# Keep track of the devstack directory
3
+TOP_DIR=$(cd $(dirname "$0")/.. && pwd)
4
+
5
+source $TOP_DIR/functions
6
+
7
+# Possible virt drivers, if we have more, add them here. Always keep
8
+# dummy in the end position to trigger the fall through case.
9
+DRIVERS="openvz ironic libvirt vsphere xenserver dummy"
10
+
11
+# Extra variables to trigger getting additional images.
12
+ENABLED_SERVICES=h-api
13
+HEAT_FETCHED_TEST_IMAGE="Fedora-i386-20-20131211.1-sda"
14
+
15
+# Loop over all the virt drivers and collect all the possible images
16
+ALL_IMAGES=""
17
+for driver in $DRIVERS; do
18
+    VIRT_DRIVER=$driver
19
+    URLS=$(source $TOP_DIR/stackrc && echo $IMAGE_URLS)
20
+    if [[ ! -z "$ALL_IMAGES" ]]; then
21
+        ALL_IMAGES+=,
22
+    fi
23
+    ALL_IMAGES+=$URLS
24
+done
25
+
26
+# Make a nice list
27
+echo $ALL_IMAGES | tr ',' '\n' | sort | uniq
28
+
29
+# Sanity check - ensure we have a minimum number of images
30
+num=$(echo $ALL_IMAGES | tr ',' '\n' | sort | uniq | wc -l)
31
+if [[ "$num" -lt 5 ]]; then
32
+    echo "ERROR: We only found $num images in $ALL_IMAGES, which can't be right."
33
+    exit 1
34
+fi