xenapi: devstack support for raw tgz image upload
Devstack will recognise the .xen-raw.tgz extensions, and upload them to
glance as raw tgz images with xen pv_mode. This change also adds "tgz" to
the recognised container formats of glance. The changes for raw tgz
support are:
https://review.openstack.org/#/c/40908/
https://review.openstack.org/#/c/40909/
https://review.openstack.org/#/c/41651/
related to blueprint xenapi-supported-image-import-export
Change-Id: I077564587d4303291bb4f10d62bb16380b574106
diff --git a/functions b/functions
index 41f008e..5ae2ee5 100644
--- a/functions
+++ b/functions
@@ -1240,7 +1240,7 @@
return
fi
- # XenServer-ovf-format images are provided as .vhd.tgz as well
+ # XenServer-vhd-ovf-format images are provided as .vhd.tgz
# and should not be decompressed prior to loading
if [[ "$image_url" =~ '.vhd.tgz' ]]; then
IMAGE="$FILES/${IMAGE_FNAME}"
@@ -1249,6 +1249,22 @@
return
fi
+ # .xen-raw.tgz suggests a Xen capable raw image inside a tgz.
+ # and should not be decompressed prior to loading.
+ # Setting metadata, so PV mode is used.
+ if [[ "$image_url" =~ '.xen-raw.tgz' ]]; then
+ IMAGE="$FILES/${IMAGE_FNAME}"
+ IMAGE_NAME="${IMAGE_FNAME%.xen-raw.tgz}"
+ glance \
+ --os-auth-token $token \
+ --os-image-url http://$GLANCE_HOSTPORT \
+ image-create \
+ --name "$IMAGE_NAME" --is-public=True \
+ --container-format=tgz --disk-format=raw \
+ --property vm_mode=xen < "${IMAGE}"
+ return
+ fi
+
KERNEL=""
RAMDISK=""
DISK_FORMAT=""