Spiff up the upload_image() format handling

* attempt to detect format of *.img files automatically, recognizing:
  qcow2,raw,vdi,vmdk,vpc

Change-Id: I92ec141584ba8237b67ca640e401a1b88860747e
This commit is contained in:
Dean Troyer 2012-09-14 11:36:07 -05:00
parent d85135ee40
commit 636a3ff429

View File

@ -792,7 +792,12 @@ function upload_image() {
*.img) *.img)
IMAGE="$FILES/$IMAGE_FNAME"; IMAGE="$FILES/$IMAGE_FNAME";
IMAGE_NAME=$(basename "$IMAGE" ".img") IMAGE_NAME=$(basename "$IMAGE" ".img")
format=$(qemu-img info ${IMAGE} | awk '/^file format/ { print $3; exit }')
if [[ ",qcow2,raw,vdi,vmdk,vpc," =~ ",$format," ]]; then
DISK_FORMAT=$format
else
DISK_FORMAT=raw DISK_FORMAT=raw
fi
CONTAINER_FORMAT=bare CONTAINER_FORMAT=bare
;; ;;
*.img.gz) *.img.gz)