From 87a18f51e38e8a43adf4d67d30229854355a181f Mon Sep 17 00:00:00 2001 From: Logan V Date: Tue, 7 May 2019 12:32:50 -0500 Subject: [PATCH] Use megabyte granularity for image extra space I want to use the new --image-extra-size flag[1] but my use-case calls for megabyte granularity of this value. Rather than adding 60% to an 800MB image, maybe I only want to add 100 or 200MB, etc. [1] https://review.opendev.org/#/c/655127/ Change-Id: I8fb9685d60ebb1260d5efcf03c5c23c561c24384 --- diskimage_builder/lib/disk-image-create | 4 ++-- doc/source/user_guide/building_an_image.rst | 2 +- .../notes/image-size-padding-mb-574104d40fdd2345.yaml | 5 +++++ 3 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 releasenotes/notes/image-size-padding-mb-574104d40fdd2345.yaml diff --git a/diskimage_builder/lib/disk-image-create b/diskimage_builder/lib/disk-image-create index cfd7cf40..7dd03909 100644 --- a/diskimage_builder/lib/disk-image-create +++ b/diskimage_builder/lib/disk-image-create @@ -381,8 +381,8 @@ else sudo du -a -c -x ${TMP_BUILD_DIR}/built > ${du_output} # the last line is the total size from "-c". if [ -n "$DIB_IMAGE_EXTRA_SIZE" ]; then - # add DIB_IMAGE_EXTRA_SIZE to create a bigger image as requested - du_extra_size=$(echo "$DIB_IMAGE_EXTRA_SIZE" | awk '{printf("%d\n",$1 * 1024 *1024)}') + # add DIB_IMAGE_EXTRA_SIZE megabytes to create a bigger image as requested + du_extra_size=$(echo "$DIB_IMAGE_EXTRA_SIZE" | awk '{printf("%d\n",$1 * 1024)}') du_size_tmp=$(tail -n1 ${du_output} | cut -f1) du_size=$(echo "$du_size_tmp $du_extra_size" | awk '{print int($1 + $2)}') else diff --git a/doc/source/user_guide/building_an_image.rst b/doc/source/user_guide/building_an_image.rst index b724e1b2..14aaee9e 100644 --- a/doc/source/user_guide/building_an_image.rst +++ b/doc/source/user_guide/building_an_image.rst @@ -627,7 +627,7 @@ following arguments: ``--image-extra-size`` Extra space to add when automatically calculating image size, in - gigabytes. This overrides the default 60% scale up as described + megabytes. This overrides the default 60% scale up as described above for ``--image-size``. Can also set ``DIB_IMAGE_EXTRA_SIZE``. The special node named ``mkfs_root`` is affected by the following; diff --git a/releasenotes/notes/image-size-padding-mb-574104d40fdd2345.yaml b/releasenotes/notes/image-size-padding-mb-574104d40fdd2345.yaml new file mode 100644 index 00000000..5eafd65e --- /dev/null +++ b/releasenotes/notes/image-size-padding-mb-574104d40fdd2345.yaml @@ -0,0 +1,5 @@ +--- +upgrade: + - | + The ``--image-extra-size`` argument has changed from gigabytes to + megabytes to make it more practical for use on smaller images.