Damans227 opened a new issue, #14877:
URL: https://github.com/apache/cloudstack/issues/14877

   ### problem
   
   A QCOW2 image registered with format RAW is accepted, and its file length is 
saved as the template's virtual size. On managed block storage (FlashArray, 
Primera and others) the volume is then created at that wrong size, and the 
first deploy fails with:
   
   ```
   qemu-img: output file is smaller than input file
   ```
   
   RawImageProcessor.process() never looks at the image. It takes the file 
length as the virtual size. Many cloud images are QCOW2 with a .img or .raw 
name, so this is an easy mistake to make, and the error only shows up at deploy 
time.
   
   ### versions
   
   ACS 4.22.1.1 secondary storage, KVM, FlashArray over FibreChannel. Same on 
4.22 and main.
   
   ### The steps to reproduce the bug
   
   Run the raw template processor (what secondary storage runs after a 
download) on a real 3.5 GiB 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
   
   rawtpl.raw: accepted as RAW, virtual size recorded 67108864
   qcowtpl.raw: accepted as RAW, virtual size recorded 196664
   ```
   
   The QCOW2 is recorded as a 196 KiB template. In the FlashArray lab, a 
template registered this way recorded `virtualsize=621284352` while the image's 
real virtual size was 3758096384, and deploying it failed with the qemu-img 
error above.
   
   ### What to do about it?
   
   Check the image header when a template is registered as RAW, and fail the 
registration with a clear message when it is really QCOW2.
   


-- 
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]

Reply via email to