Damans227 opened a new pull request, #14878:
URL: https://github.com/apache/cloudstack/pull/14878
Fixes #14877
A QCOW2 image registered as RAW is accepted and its file length is saved as
the virtual size, so block storage later creates a volume that is too small and
the deploy fails with "output file is smaller than input file". This checks the
image header in RawImageProcessor and fails the template download with a clear
message when a template registered as RAW is really QCOW2. Real raw images are
unchanged.
### Test:
Run the raw template processor, the way secondary storage does after a
download, on a real 3.5 GiB QCOW2 made with `qemu-img create -f qcow2` and a 64
MiB raw image, both named .raw.
> qemu-img info qcowtpl.raw
file format: qcow2
virtual size: 3.5 GiB (3758096384 bytes)
disk size: 196 KiB
**Before:** the QCOW2 is accepted as a 196 KiB raw template.
rawtpl.raw: accepted as RAW, virtual size recorded 67108864
qcowtpl.raw: accepted as RAW, virtual size recorded 196664
**After:** the QCOW2 is rejected, the raw image is unchanged.
rawtpl.raw: accepted as RAW, virtual size recorded 67108864
qcowtpl.raw: rejected: Template qcowtpl was registered as RAW but the
image is QCOW2, register it again with format QCOW2
Also added unit tests for both cases.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]