From 0aea938dea80b877ece90b1ee00e86a85120a4b5 Mon Sep 17 00:00:00 2001 From: Josh Smith Date: Mon, 5 Oct 2015 12:31:37 -0400 Subject: [PATCH 1/3] If the disk size is specified as a decimil number the generated metadat.json file is invalid resulting in a broken vagrant box. Wraped this in the awk int() function to only print the integer part of the disk size. --- tools/create_box.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/create_box.sh b/tools/create_box.sh index 9f35409..bcae373 100755 --- a/tools/create_box.sh +++ b/tools/create_box.sh @@ -81,7 +81,8 @@ fi cd "$TMP_DIR" -IMG_SIZE=$(qemu-img info "$TMP_IMG" | grep 'virtual size' | awk '{print $3;}' | tr -d 'G') +IMG_SIZE=$(qemu-img info "$TMP_IMG" | grep 'virtual size' | awk '{print int($3);}' | tr -d 'G') +echo "IMAGE SIZE ====> ${IMG_SIZE}" cat > metadata.json < Date: Mon, 5 Oct 2015 12:41:49 -0400 Subject: [PATCH 2/3] No need to use both grep and awk here - just grep will do. --- tools/create_box.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tools/create_box.sh b/tools/create_box.sh index bcae373..cd210af 100755 --- a/tools/create_box.sh +++ b/tools/create_box.sh @@ -81,8 +81,7 @@ fi cd "$TMP_DIR" -IMG_SIZE=$(qemu-img info "$TMP_IMG" | grep 'virtual size' | awk '{print int($3);}' | tr -d 'G') -echo "IMAGE SIZE ====> ${IMG_SIZE}" +IMG_SIZE=$(qemu-img info "$TMP_IMG" | awk '/virtual size/{print int($3);}' | tr -d 'G') cat > metadata.json < Date: Mon, 5 Oct 2015 13:43:38 -0400 Subject: [PATCH 3/3] Added comment to describe cahanges as requested --- tools/create_box.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/create_box.sh b/tools/create_box.sh index cd210af..87c98ec 100755 --- a/tools/create_box.sh +++ b/tools/create_box.sh @@ -81,6 +81,9 @@ fi cd "$TMP_DIR" +#Using the awk int function here to truncate the virtual image size to an +#integer since the fog-libvirt library does not seem to properly handle +#floating point. IMG_SIZE=$(qemu-img info "$TMP_IMG" | awk '/virtual size/{print int($3);}' | tr -d 'G') cat > metadata.json <