1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-23 22:50:09 +03:00

feature #1770: Apparent size of qcow images reported by fs_size function

This commit is contained in:
Ruben S. Montero 2013-11-21 14:07:08 +01:00
parent d1b71d0df1
commit f69e86f2bb

View File

@ -178,11 +178,14 @@ function fs_size {
SIZE=`du -sb "$1" | cut -f1`
error=$?
else
TYPE=$(cat "$1" | head -n 1024 | file -b --mime-type -)
TYPE=$(cat "$1" | head -n 1024 | file -b -)
case "$TYPE" in
"application/x-gzip")
*gzip*)
SIZE=$(gzip_file_size "$1")
;;
*QCOW*)
SIZE=$($QEMU_IMG info "$1" | sed -n 's/.*(\([0-9]*\) bytes).*/\1/p')
;;
*)
SIZE=$(file_size "$1")
;;