From d690e728d0d36f0dcaa67f805b4b65e79c134920 Mon Sep 17 00:00:00 2001 From: "Ruben S. Montero" Date: Thu, 20 Oct 2011 11:21:38 +0200 Subject: [PATCH] bug #867: Postpone qcow2 management to integrate it with quota system --- src/image_mad/remotes/fs/fsrc | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/image_mad/remotes/fs/fsrc b/src/image_mad/remotes/fs/fsrc index c2f2e8c519..255a22fee8 100644 --- a/src/image_mad/remotes/fs/fsrc +++ b/src/image_mad/remotes/fs/fsrc @@ -41,15 +41,13 @@ echo "$IMAGE_REPOSITORY_PATH/`echo $CANONICAL_MD5 | cut -d ' ' -f1`" } function fs_du { - QEMU_IMG=`command -v qemu-img` + SIZE=`$(stat -c %s $1)` - if [ $? = 0 ]; then - SIZE=$($QEMU_IMG info $1|awk '/^virtual size:/{print substr($4,2)}') - else - SIZE=$(stat -c %s $1) - fi + if [ $? -ne 0 ]; then + SIZE=0 + else + SIZE=$(($SIZE/1048576)) + fi - SIZE=$(($SIZE/1048576)) - - echo "$SIZE" + echo "$SIZE" } \ No newline at end of file