Skip to content

Commit 0c6942c

Browse files
Merge pull request AlmaLinux#263 from KAUSHIK-KUMAR-RM/skip-resize-image-2
Skip resize image 2
2 parents 5032e1e + 394cae3 commit 0c6942c

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

tools/azure_uploader.sh

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,16 @@ main() {
487487
local -r blob_name="${image_name}.vhd"
488488
# convert input image to fixed VHD blob with size rounded to 1 MB
489489
local -r blob_size="$(get_rounded_size "${INPUT_IMAGE}")"
490-
execute qemu-img resize -q -f raw "${INPUT_IMAGE}" "${blob_size}"
490+
# Get actual image size in bytes
491+
local -r actual_size="$(qemu-img info -f raw --output json "${INPUT_IMAGE}" | jq '.["virtual-size"]')"
492+
493+
# Only resize if needed
494+
if [ "$actual_size" -ne "$blob_size" ]; then
495+
execute qemu-img resize -q -f raw "${INPUT_IMAGE}" "${blob_size}"
496+
else
497+
echo "Image already aligned to $blob_size, skipping resize."
498+
fi
499+
491500
execute qemu-img convert -f raw -o subformat=fixed,force_size -O vpc \
492501
"${INPUT_IMAGE}" "${blob_name}"
493502
local -r blob_md5="$(get_blob_md5 "${blob_name}")"

0 commit comments

Comments
 (0)