Currently *.qcow2 and *.img files in IMAGE_URLS are piped into glance
using zcat, which fails and leaves the image in a perpetual SAVING state.
This change makes only *.img.gz files use zcat.
Change-Id: I6e02ccff93a42bbc149d8f1058bba7825c910e05
| ... | ... |
@@ -2177,6 +2177,8 @@ if is_service_enabled g-reg; then |
| 2177 | 2177 |
RAMDISK="" |
| 2178 | 2178 |
DISK_FORMAT="" |
| 2179 | 2179 |
CONTAINER_FORMAT="" |
| 2180 |
+ UNPACK="" |
|
| 2181 |
+ |
|
| 2180 | 2182 |
case "$IMAGE_FNAME" in |
| 2181 | 2183 |
*.tar.gz|*.tgz) |
| 2182 | 2184 |
# Extract ami and aki files |
| ... | ... |
@@ -2208,6 +2210,7 @@ if is_service_enabled g-reg; then |
| 2208 | 2208 |
IMAGE_NAME=$(basename "$IMAGE" ".img.gz") |
| 2209 | 2209 |
DISK_FORMAT=raw |
| 2210 | 2210 |
CONTAINER_FORMAT=bare |
| 2211 |
+ UNPACK=zcat |
|
| 2211 | 2212 |
;; |
| 2212 | 2213 |
*.qcow2) |
| 2213 | 2214 |
IMAGE="$FILES/${IMAGE_FNAME}"
|
| ... | ... |
@@ -2219,7 +2222,11 @@ if is_service_enabled g-reg; then |
| 2219 | 2219 |
esac |
| 2220 | 2220 |
|
| 2221 | 2221 |
if [ "$CONTAINER_FORMAT" = "bare" ]; then |
| 2222 |
- glance --os-auth-token $TOKEN --os-image-url http://$GLANCE_HOSTPORT image-create --name "$IMAGE_NAME" --is-public=True --container-format=$CONTAINER_FORMAT --disk-format $DISK_FORMAT < <(zcat --force "${IMAGE}")
|
|
| 2222 |
+ if [ "$UNPACK" = "zcat" ]; then |
|
| 2223 |
+ glance --os-auth-token $TOKEN --os-image-url http://$GLANCE_HOSTPORT image-create --name "$IMAGE_NAME" --is-public=True --container-format=$CONTAINER_FORMAT --disk-format $DISK_FORMAT < <(zcat --force "${IMAGE}")
|
|
| 2224 |
+ else |
|
| 2225 |
+ glance --os-auth-token $TOKEN --os-image-url http://$GLANCE_HOSTPORT image-create --name "$IMAGE_NAME" --is-public=True --container-format=$CONTAINER_FORMAT --disk-format $DISK_FORMAT < ${IMAGE}
|
|
| 2226 |
+ fi |
|
| 2223 | 2227 |
else |
| 2224 | 2228 |
# Use glance client to add the kernel the root filesystem. |
| 2225 | 2229 |
# We parse the results of the first upload to get the glance ID of the |